Skip to contentSkip to conversation

HID: i2c-hid: disable interrupt on suspend

PATCH In review Mika Westerberg 3 participants 3 messages Nov 13, 2013 – Nov 25, 2013 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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).

---
 drivers/hid/i2c-hid/i2c-hid.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hid/i2c-hid/i2c-hid.c +2 -0
index c1336193b04b..dc8b575477b4 100644
@@ -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;
Signature · 1 line
1.8.4.3
#1 lore raw
Quoted 5 lines · Mika Westerberg

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.

Quoted 8 lines

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

---

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

#2 lore raw
Quoted 14 lines · Benjamin Tissoires
Quoted 5 lines

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.

Quoted 8 lines

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

---

Quoted 5 lines

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.

Signature · 2 lines
Jiri Kosina
SUSE Labs