Re: [PATCH v2] HID: i2c-hid: wait for i2c touchpad deep-sleep to power-up transition

From: Kenny Levinsen
Date: Tue Apr 23 2024 - 09:02:09 EST


On 4/23/24 1:32 PM, Łukasz Majczak wrote:
Unfortunately, your fix doesn't help in our case as there is no sleep
before the second call to
i2c_hid_fetch_hid_descriptor().

Yeah, I checked with a logic analyzer and only see ~50µs delay from the I2C timeout, and 50 is according to my quick math less than the 400 you mention is the requirement. That means that the current resume path also lacked a sleep, as it tried power commands in immediate succession.

I have made a v2 with your sleeps added, and added you as Co-developed-by.

Link: https://lore.kernel.org/all/20240423122518.34811-1-kl@xxxxxx/

Saying more, this STM exposes two i2c addresses (connected physically
to the same bus)
one is the HID interface and the other one gives an access to the base
firmware and is
served by cros_ec_i2c driver and actually thanks to this driver,
touchpad is woken up because
In the resume path cros_ec_i2c "starts talking" through the i2c bus
thus generating a wakeup
interrupt.

Ah, that explains why you did not find an issue with the resume path. In the patch-series I sent, the boot (hid descriptor fetch) and resume (power on) wake-up paths are fully aligned so neither have to rely on such "adjacent drivers" waking up the i2c-hid device.