]>
Commit | Line | Data |
---|---|---|
2c26872c GKH |
1 | From 72bfcee11cf89509795c56b0e40a3785ab00bbdd Mon Sep 17 00:00:00 2001 |
2 | From: Jarkko Nikula <jarkko.nikula@linux.intel.com> | |
3 | Date: Tue, 30 Apr 2019 17:23:22 +0300 | |
4 | Subject: i2c: Prevent runtime suspend of adapter when Host Notify is required | |
5 | ||
6 | From: Jarkko Nikula <jarkko.nikula@linux.intel.com> | |
7 | ||
8 | commit 72bfcee11cf89509795c56b0e40a3785ab00bbdd upstream. | |
9 | ||
10 | Multiple users have reported their Synaptics touchpad has stopped | |
11 | working between v4.20.1 and v4.20.2 when using SMBus interface. | |
12 | ||
13 | The culprit for this appeared to be commit c5eb1190074c ("PCI / PM: Allow | |
14 | runtime PM without callback functions") that fixed the runtime PM for | |
15 | i2c-i801 SMBus adapter. Those Synaptics touchpad are using i2c-i801 | |
16 | for SMBus communication and testing showed they are able to get back | |
17 | working by preventing the runtime suspend of adapter. | |
18 | ||
19 | Normally when i2c-i801 SMBus adapter transmits with the client it resumes | |
20 | before operation and autosuspends after. | |
21 | ||
22 | However, if client requires SMBus Host Notify protocol, what those | |
23 | Synaptics touchpads do, then the host adapter must not go to runtime | |
24 | suspend since then it cannot process incoming SMBus Host Notify commands | |
25 | the client may send. | |
26 | ||
27 | Fix this by keeping I2C/SMBus adapter active in case client requires | |
28 | Host Notify. | |
29 | ||
30 | Reported-by: Keijo Vaara <ferdasyn@rocketmail.com> | |
31 | Link: https://bugzilla.kernel.org/show_bug.cgi?id=203297 | |
32 | Fixes: c5eb1190074c ("PCI / PM: Allow runtime PM without callback functions") | |
33 | Cc: stable@vger.kernel.org # v4.20+ | |
34 | Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> | |
35 | Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | |
36 | Tested-by: Keijo Vaara <ferdasyn@rocketmail.com> | |
37 | Signed-off-by: Wolfram Sang <wsa@the-dreams.de> | |
38 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
39 | ||
40 | --- | |
41 | drivers/i2c/i2c-core-base.c | 4 ++++ | |
42 | 1 file changed, 4 insertions(+) | |
43 | ||
44 | --- a/drivers/i2c/i2c-core-base.c | |
45 | +++ b/drivers/i2c/i2c-core-base.c | |
46 | @@ -327,6 +327,8 @@ static int i2c_device_probe(struct devic | |
47 | ||
48 | if (client->flags & I2C_CLIENT_HOST_NOTIFY) { | |
49 | dev_dbg(dev, "Using Host Notify IRQ\n"); | |
50 | + /* Keep adapter active when Host Notify is required */ | |
51 | + pm_runtime_get_sync(&client->adapter->dev); | |
52 | irq = i2c_smbus_host_notify_to_irq(client); | |
53 | } else if (dev->of_node) { | |
54 | irq = of_irq_get_byname(dev->of_node, "irq"); | |
55 | @@ -431,6 +433,8 @@ static int i2c_device_remove(struct devi | |
56 | device_init_wakeup(&client->dev, false); | |
57 | ||
58 | client->irq = client->init_irq; | |
59 | + if (client->flags & I2C_CLIENT_HOST_NOTIFY) | |
60 | + pm_runtime_put(&client->adapter->dev); | |
61 | ||
62 | return status; | |
63 | } |