Skip to content

Commit 7d6f065

Browse files
kennylevinsenJiri Kosina
authored andcommitted
HID: i2c-hid: Use address probe to wake on resume
Certain devices, both from STM and Weida Tech, need to be woken up after having entered a deeper sleep state. The relevant places to wake up such device is during our initial HID probe, and after resuming. A retry for power commands was previously added to i2c_hid_set_power to wake up Weida Tech devices, but lacked sufficient sleep for STM devices. Replace the power command retry with the same address probe we using during our initial HID probe. Signed-off-by: Kenny Levinsen <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent ab5ec06 commit 7d6f065

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

drivers/hid/i2c-hid/i2c-hid-core.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -408,19 +408,6 @@ static int i2c_hid_set_power(struct i2c_hid *ihid, int power_state)
408408

409409
i2c_hid_dbg(ihid, "%s\n", __func__);
410410

411-
/*
412-
* Some devices require to send a command to wakeup before power on.
413-
* The call will get a return value (EREMOTEIO) but device will be
414-
* triggered and activated. After that, it goes like a normal device.
415-
*/
416-
if (power_state == I2C_HID_PWR_ON) {
417-
ret = i2c_hid_set_power_command(ihid, I2C_HID_PWR_ON);
418-
419-
/* Device was already activated */
420-
if (!ret)
421-
goto set_pwr_exit;
422-
}
423-
424411
ret = i2c_hid_set_power_command(ihid, power_state);
425412
if (ret)
426413
dev_err(&ihid->client->dev,
@@ -999,6 +986,14 @@ static int i2c_hid_core_resume(struct i2c_hid *ihid)
999986

1000987
enable_irq(client->irq);
1001988

989+
/* Make sure the device is awake on the bus */
990+
ret = i2c_hid_probe_address(ihid);
991+
if (ret < 0) {
992+
dev_err(&client->dev, "nothing at address after resume: %d\n",
993+
ret);
994+
return -ENXIO;
995+
}
996+
1002997
/* Instead of resetting device, simply powers the device on. This
1003998
* solves "incomplete reports" on Raydium devices 2386:3118 and
1004999
* 2386:4B33 and fixes various SIS touchscreens no longer sending

0 commit comments

Comments
 (0)