linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: i2c-hid: disable interrupt on suspend
@ 2013-11-13 11:34 Mika Westerberg
  2013-11-25 15:41 ` Benjamin Tissoires
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Westerberg @ 2013-11-13 11:34 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: Benjamin Tissoires, Jean Delvare, linux-input, linux-kernel,
	Mika Westerberg, Jerome Blin

When an I2C HID device is powered of during system sleep, as a result of
removing its power resources (by the ACPI core) the interrupt line might go
low as well. This results inadvertent interrupt and wakes the system from
sleep immediately.

To prevent this we disable the device interrupt in the drivers suspend
method and enable it on resume. The device can still wake the system up if
it is wake capable (this also means that not all of its power will be
removed to keep the interrupt line high).

Reported-by: Jerome Blin <jerome.blin@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/hid/i2c-hid/i2c-hid.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index c1336193b04b..dc8b575477b4 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -1073,6 +1073,7 @@ static int i2c_hid_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
+	disable_irq(client->irq);
 	if (device_may_wakeup(&client->dev))
 		enable_irq_wake(client->irq);
 
@@ -1087,6 +1088,7 @@ static int i2c_hid_resume(struct device *dev)
 	int ret;
 	struct i2c_client *client = to_i2c_client(dev);
 
+	enable_irq(client->irq);
 	ret = i2c_hid_hwreset(client);
 	if (ret)
 		return ret;
-- 
1.8.4.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: i2c-hid: disable interrupt on suspend
  2013-11-13 11:34 [PATCH] HID: i2c-hid: disable interrupt on suspend Mika Westerberg
@ 2013-11-25 15:41 ` Benjamin Tissoires
  2013-11-25 22:18   ` Jiri Kosina
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Tissoires @ 2013-11-25 15:41 UTC (permalink / raw)
  To: Mika Westerberg, Jiri Kosina
  Cc: Jean Delvare, linux-input, linux-kernel, Jerome Blin

On 13/11/13 06:34, Mika Westerberg wrote:
> When an I2C HID device is powered of during system sleep, as a result of
> removing its power resources (by the ACPI core) the interrupt line might go
> low as well. This results inadvertent interrupt and wakes the system from
> sleep immediately.
> 
> To prevent this we disable the device interrupt in the drivers suspend
> method and enable it on resume. The device can still wake the system up if
> it is wake capable (this also means that not all of its power will be
> removed to keep the interrupt line high).
> 
> Reported-by: Jerome Blin <jerome.blin@intel.com>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---

Jiri, just FYI, I still do not have any final consumer ready i2c-hid
hardware. So I can not test/debug anything related to the suspend-resume.

If Mika tested it properly (which I expect), you may consider pulling
this one.

Cheers,
Benjamin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: i2c-hid: disable interrupt on suspend
  2013-11-25 15:41 ` Benjamin Tissoires
@ 2013-11-25 22:18   ` Jiri Kosina
  0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2013-11-25 22:18 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Mika Westerberg, Jean Delvare, linux-input, linux-kernel, Jerome Blin

On Mon, 25 Nov 2013, Benjamin Tissoires wrote:

> > When an I2C HID device is powered of during system sleep, as a result of
> > removing its power resources (by the ACPI core) the interrupt line might go
> > low as well. This results inadvertent interrupt and wakes the system from
> > sleep immediately.
> > 
> > To prevent this we disable the device interrupt in the drivers suspend
> > method and enable it on resume. The device can still wake the system up if
> > it is wake capable (this also means that not all of its power will be
> > removed to keep the interrupt line high).
> > 
> > Reported-by: Jerome Blin <jerome.blin@intel.com>
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> 
> Jiri, just FYI, I still do not have any final consumer ready i2c-hid
> hardware. So I can not test/debug anything related to the suspend-resume.
> 
> If Mika tested it properly (which I expect), you may consider pulling
> this one.

Understood, thanks guys.

Applied now.

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-25 22:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-13 11:34 [PATCH] HID: i2c-hid: disable interrupt on suspend Mika Westerberg
2013-11-25 15:41 ` Benjamin Tissoires
2013-11-25 22:18   ` Jiri Kosina

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).