linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>, Rajat Jain <rajatja@google.com>,
	Wolfram Sang <wsa@kernel.org>,
	Derek Basehore <dbasehore@chromium.org>,
	Thorsten Leemhuis <regressions@leemhuis.info>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	"loic.poulain@linaro.org" <loic.poulain@linaro.org>,
	Andrew Duggan <aduggan@synaptics.com>,
	vincent.huang@tw.synaptics.com, cheiny@synaptics.com,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-input <linux-input@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>
Subject: Re: 5.17-rc regression: rmi4 clients cannot deal with asynchronous suspend? (was: X1 Carbon touchpad not resumed)
Date: Sun, 13 Feb 2022 18:31:02 -0800	[thread overview]
Message-ID: <Ygm+5rS7Cxeea5Dp@google.com> (raw)
In-Reply-To: <6f1103af-595c-ed0a-b946-97a9331ed148@linux.intel.com>

Hi Hugh, Jarkko,

On Tue, Feb 08, 2022 at 04:57:53PM +0200, Jarkko Nikula wrote:
> Hi
> 
> On 2/8/22 04:50, Hugh Dickins wrote:
> > On Mon, 7 Feb 2022, Dmitry Torokhov wrote:
> > > On Mon, Feb 07, 2022 at 01:41:36PM -0800, Rajat Jain wrote:
> > > > > > > Bisection led to 172d931910e1db800f4e71e8ed92281b6f8c6ee2
> > > > > > > ("i2c: enable async suspend/resume on i2c client devices")
> > > > > > > and reverting that fixes it for me.
> > > > > > 
> > > > > > Thank you for the report plus bisection and sorry for the regression!
> > > > > 
> > > > > +1, Thanks for the bisection, and apologies for the inconveniences.
> > > > > 
> > > > > The problem here seems to be that for some reason, some devices (all
> > > > > connected to rmi4 adapter) failed to resume, but only when
> > > > > asynchronous suspend is enabled (by 172d931910e1):
> > > > > 
> > > > > [   79.221064] rmi4_smbus 6-002c: failed to get SMBus version number!
> > > > > [   79.265074] rmi4_physical rmi4-00: rmi_driver_reset_handler: Failed
> > > > > to read current IRQ mask.
> > > > > [   79.308330] rmi4_f01 rmi4-00.fn01: Failed to restore normal operation: -6.
> > > > > [   79.308335] rmi4_f01 rmi4-00.fn01: Resume failed with code -6.
> > > > > [   79.308339] rmi4_physical rmi4-00: Failed to suspend functions: -6
> > > > > [   79.308342] rmi4_smbus 6-002c: Failed to resume device: -6
> > > > > [   79.351967] rmi4_physical rmi4-00: Failed to read irqs, code=-6
> > > > > 
> 
> v5.17-rc3 on Lenovo ThinkPad X1 Carbon 8th don't even suspend due the same
> commit 172d931910e1. Sadly I tested the original patch on other machine(s)
> but not on this one with rmi4 :-(
> 
> [   39.957293] PM: suspend entry (s2idle)
> [   40.938666] Filesystems sync: 0.980 seconds
> [   40.942751] Freezing user space processes ... (elapsed 0.001 seconds)
> done.
> [   40.945511] OOM killer disabled.
> [   40.946111] Freezing remaining freezable tasks ... (elapsed 0.001
> seconds) done.
> [   40.948590] printk: Suspending console(s) (use no_console_suspend to
> debug)
> [   40.993123] i801_smbus 0000:00:1f.4: No response
> [   40.993218] rmi4_f01 rmi4-00.fn01: Failed to write sleep mode: -6.
> [   40.993232] rmi4_f01 rmi4-00.fn01: Suspend failed with code -6.
> [   40.993241] rmi4_physical rmi4-00: Failed to suspend functions: -6
> [   40.993404] rmi4_smbus 1-002c: Failed to suspend device: -6
> [   40.993414] PM: dpm_run_callback(): rmi_smb_suspend+0x0/0x30 [rmi_smbus]
> returns -6
> [   40.993438] rmi4_smbus 1-002c: PM: failed to suspend async: error -6
> [   41.014198] PM: Some devices failed to suspend, or early wake event
> detected
> [   41.021544] i801_smbus 0000:00:1f.4: No response
> [   41.021612] rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to
> F03 TX register (-6).
> [   41.022189] i801_smbus 0000:00:1f.4: No response
> [   41.022230] rmi4_f03 rmi4-00.fn03: rmi_f03_pt_write: Failed to write to
> F03 TX register (-6).
> [   41.023480] i801_smbus 0000:00:1f.4: No response
> [   41.023542] rmi4_physical rmi4-00: rmi_driver_clear_irq_bits: Failed to
> change enabled interrupts!
> [   41.033850] i801_smbus 0000:00:1f.4: No response
> [   41.034006] OOM killer enabled.
> [   41.035449] i801_smbus 0000:00:1f.4: No response
> [   41.035722] Restarting tasks ...
> [   41.036705] rmi4_physical rmi4-00: rmi_driver_set_irq_bits: Failed to
> change enabled interrupts!
> [   41.038367] done.
> [   41.039003] psmouse: probe of serio2 failed with error -1
> [   41.071700] PM: suspend exit

Sorry for the delay, but I wonder if you could try the patch below and
tell me if that also fixes the issue for you?

Also adding Hans as to make sure changes to psmouse_smbus make sense to
him.

Thanks!

diff --git a/drivers/input/mouse/psmouse-smbus.c b/drivers/input/mouse/psmouse-smbus.c
index a472489ccbad..164f6c757f6b 100644
--- a/drivers/input/mouse/psmouse-smbus.c
+++ b/drivers/input/mouse/psmouse-smbus.c
@@ -75,6 +75,8 @@ static void psmouse_smbus_detach_i2c_client(struct i2c_client *client)
 				    "Marking SMBus companion %s as gone\n",
 				    dev_name(&smbdev->client->dev));
 			smbdev->dead = true;
+			device_link_remove(&smbdev->client->dev,
+					   &smbdev->psmouse->ps2dev.serio->dev);
 			serio_rescan(smbdev->psmouse->ps2dev.serio);
 		} else {
 			list_del(&smbdev->node);
@@ -174,6 +176,8 @@ static void psmouse_smbus_disconnect(struct psmouse *psmouse)
 		kfree(smbdev);
 	} else {
 		smbdev->dead = true;
+		device_link_remove(&smbdev->client->dev,
+				   &psmouse->ps2dev.serio->dev);
 		psmouse_dbg(smbdev->psmouse,
 			    "posting removal request for SMBus companion %s\n",
 			    dev_name(&smbdev->client->dev));
@@ -270,6 +274,12 @@ int psmouse_smbus_init(struct psmouse *psmouse,
 
 	if (smbdev->client) {
 		/* We have our companion device */
+		if (!device_link_add(&smbdev->client->dev,
+				     &psmouse->ps2dev.serio->dev,
+				     DL_FLAG_STATELESS))
+			psmouse_warn(psmouse,
+				     "failed to set up link with iSMBus companion %s\n",
+				     dev_name(&smbdev->client->dev));
 		return 0;
 	}
 

-- 
Dmitry

  reply	other threads:[~2022-02-14  2:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07 19:45 5.17-rc regression: X1 Carbon touchpad not resumed Hugh Dickins
2022-02-07 20:23 ` Wolfram Sang
2022-02-07 20:41   ` Hugh Dickins
2022-02-07 21:09   ` 5.17-rc regression: rmi4 clients cannot deal with asynchronous suspend? (was: X1 Carbon touchpad not resumed) Rajat Jain
2022-02-07 21:41     ` Rajat Jain
2022-02-08  2:20       ` Dmitry Torokhov
2022-02-08  2:50         ` Hugh Dickins
2022-02-08 10:02           ` Loic Poulain
2022-02-08 14:57           ` Jarkko Nikula
2022-02-14  2:31             ` Dmitry Torokhov [this message]
2022-02-14  7:36               ` Hugh Dickins
2022-02-14 12:11                 ` Jarkko Nikula
2022-02-14  8:57               ` Hans de Goede
2022-02-08  6:37 ` 5.17-rc regression: X1 Carbon touchpad not resumed Thorsten Leemhuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ygm+5rS7Cxeea5Dp@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=aduggan@synaptics.com \
    --cc=cheiny@synaptics.com \
    --cc=dbasehore@chromium.org \
    --cc=hdegoede@redhat.com \
    --cc=hughd@google.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=rafael@kernel.org \
    --cc=rajatja@google.com \
    --cc=regressions@leemhuis.info \
    --cc=vincent.huang@tw.synaptics.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).