Browse Source

HID: i2c-hid: disable interrupt on suspend

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>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Mika Westerberg 11 years ago
parent
commit
94037efe81
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/hid/i2c-hid/i2c-hid.c

+ 2 - 0
drivers/hid/i2c-hid/i2c-hid.c

@@ -1061,6 +1061,7 @@ static int i2c_hid_suspend(struct device *dev)
 {
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct i2c_client *client = to_i2c_client(dev);
 
 
+	disable_irq(client->irq);
 	if (device_may_wakeup(&client->dev))
 	if (device_may_wakeup(&client->dev))
 		enable_irq_wake(client->irq);
 		enable_irq_wake(client->irq);
 
 
@@ -1075,6 +1076,7 @@ static int i2c_hid_resume(struct device *dev)
 	int ret;
 	int ret;
 	struct i2c_client *client = to_i2c_client(dev);
 	struct i2c_client *client = to_i2c_client(dev);
 
 
+	enable_irq(client->irq);
 	ret = i2c_hid_hwreset(client);
 	ret = i2c_hid_hwreset(client);
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;