platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
authorSamuel Čavoj <samuel@cavoj.net>
Tue, 20 Oct 2020 22:09:44 +0000 (00:09 +0200)
committerHans de Goede <hdegoede@redhat.com>
Wed, 28 Oct 2020 11:47:37 +0000 (12:47 +0100)
commitea856ec266c1e6aecd2b107032d5b5d661f0686d
tree42702dc5bb8a21343f157c402461c60bee787a80
parent619821936203f0577aa88cf30d31b0202650a745
platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360

The UX360CA has a WMI device id 0x00060062, which reports whether the
lid is flipped in tablet mode (1) or in normal laptop mode (0).

Add a quirk (quirk_asus_use_lid_flip_devid) for devices on which this
WMI device should be used to figure out the SW_TABLET_MODE state, as
opposed to the quirk_asus_use_kbd_dock_devid.

Additionally, the device needs to be queried on resume and restore
because the firmware does not generate an event if the laptop is put to
sleep while in tablet mode, flipped to normal mode, and later awoken.

It is assumed other UX360* models have the same WMI device. As such, the
quirk is applied to devices with DMI_MATCH(DMI_PRODUCT_NAME, "UX360").
More devices with this feature need to be tested and added accordingly.

The reason for using an allowlist via the quirk mechanism is that the new
WMI device (0x00060062) is also present on some models which do not have
a 360 degree hinge (at least FX503VD and GL503VD from Hans' DSTS
collection) and therefore its presence cannot be relied on.

Signed-off-by: Samuel Čavoj <samuel@cavoj.net>
Cc: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20201020220944.1075530-1-samuel@cavoj.net
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/asus-nb-wmi.c
drivers/platform/x86/asus-wmi.c
drivers/platform/x86/asus-wmi.h
include/linux/platform_data/x86/asus-wmi.h