HID: google: whiskers: more robust tablet mode detection
authorDmitry Torokhov <dtor@chromium.org>
Fri, 13 Sep 2019 22:03:15 +0000 (15:03 -0700)
committerJiri Kosina <jkosina@suse.cz>
Tue, 1 Oct 2019 14:13:49 +0000 (16:13 +0200)
commit38e57f0693ad1b9a785b4f542ec019c5fdf91d57
tree13cb03beaee3a4ef69af7b38d736a13e92450ead
parent1ad0bc78948652edc3067b6b49ba31b1598faa4a
HID: google: whiskers: more robust tablet mode detection

The USB interface may get detected before the platform/EC one, so let's
note the state of the base (if we receive event) and use it to correctly
initialize the tablet mode switch state.

Also let's start the HID interface immediately when probing, this will
ensure that we correctly process "base folded" events that may be sent
as we initialize the base. Note that this requires us to add a remove()
function where we stop and close the hardware and switch the LED
registration away from devm interface as we need to make sure that we
destroy the LED instance before we stop the hardware.

Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-google-hammer.c