HID: i2c: let RMI devices decide what constitutes wakeup event
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 18 Nov 2022 17:02:45 +0000 (09:02 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:14 +0000 (13:32 +0100)
commit1372f4f6fcb19d4e9c69d00c6f919163823bf785
tree610b16786a4b26c4653dca48afecfb35c0780c0a
parent3751ba4aec0b460a94aaa692013b9dd1a0cb14f7
HID: i2c: let RMI devices decide what constitutes wakeup event

[ Upstream commit 9984fbf55b9bd998b4ff66395cbb118020c1effa ]

HID-RMI is special in the sense that it does not carry HID events
directly, but rather uses HID protocol as a wrapper/transport for RMI
protocol.  Therefore we should not assume that all data coming from the
device via interrupt is associated with user activity and report wakeup
event indiscriminately, but rather let HID-RMI do that when appropriate.

HID-RMI devices tag responses to the commands issued by the host as
RMI_READ_DATA_REPORT_ID whereas motion and other input events from the
device are tagged as RMI_ATTN_REPORT_ID. Change hid-rmi to report wakeup
events when receiving the latter packets. This allows ChromeOS to
accurately identify wakeup source and make correct decision on the mode
of the resume the system should take ("dark" where the display stays off
vs normal one).

Fixes: d951ae1ce803 ("HID: i2c-hid: Report wakeup events")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-rmi.c
drivers/hid/i2c-hid/i2c-hid-core.c