Skip to content

Commit 3cbf654

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ishtp-hid: Clear suspended flag only after connected on resume
When resuming from suspend-to-RAM or hibernate, the ISH firmware is powered on from D3, causing all previous client connections between the firmware and driver to be lost. Although the underlying ishtp bus driver initiates a client reconnection flow, this process is asynchronous. As a result, when hid_ishtp_cl_resume_handler() is executed, the connection may not have been re-established yet. Clearing the suspended flag prematurely in this scenario can lead to a timeout when the upper-layer HID sensor driver set feature during resume. To prevent such timeouts, only clear the suspended flag after confirming that the connection state is ISHTP_CL_CONNECTED. Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 011aa2a commit 3cbf654

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/hid/intel-ish-hid/ishtp-hid-client.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,15 @@ static void hid_ishtp_cl_resume_handler(struct work_struct *work)
757757
struct ishtp_cl *hid_ishtp_cl = client_data->hid_ishtp_cl;
758758

759759
if (ishtp_wait_resume(ishtp_get_ishtp_device(hid_ishtp_cl))) {
760-
client_data->suspended = false;
761-
wake_up_interruptible(&client_data->ishtp_resume_wait);
760+
/*
761+
* Clear the suspended flag only when the connection is established.
762+
* If the connection is not established, the suspended flag will be cleared after
763+
* the connection is made.
764+
*/
765+
if (ishtp_get_connection_state(hid_ishtp_cl) == ISHTP_CL_CONNECTED) {
766+
client_data->suspended = false;
767+
wake_up_interruptible(&client_data->ishtp_resume_wait);
768+
}
762769
} else {
763770
hid_ishtp_trace(client_data, "hid client: wait for resume timed out");
764771
dev_err(cl_data_to_dev(client_data), "wait for resume timed out");

0 commit comments

Comments
 (0)