Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: thinkpad_acpi: Handle keyboard cover attach/detach events

Those events occur when a keyboard cover is attached to a ThinkPad
X1 Tablet series device. Typically, they are used to switch from normal
to tablet mode in userspace; e.g., to offer touch keyboard choices when
focus goes to a text box and no keyboard is attached, or to enable
autorotation of the display according to the builtin orientation sensor.

intel-vtbn already recognizes those events. To avoid sending duplicate
events to userspace, they are simply ignored. Thus, this patch only
avoids warnings about unknown and unhandled HKEYs 0x4012 and 0x4013.

For more information about the background and potential improvements for
different types of attachment options, such as the Pico cartridge dock
module, see
https://lore.kernel.org/platform-driver-x86/38cb8265-1e30-d547-9e12-b4ae290be737@a-kobel.de/

Signed-off-by: Alexander Kobel <a-kobel@a-kobel.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/83a0e45f-590d-0c7d-0afd-00a5a6322bd0@a-kobel.de
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

authored by

Alexander Kobel and committed by
Hans de Goede
0a053f01 03ee3183

+23
+23
drivers/platform/x86/thinkpad_acpi.c
··· 175 175 or port replicator */ 176 176 TP_HKEY_EV_HOTPLUG_UNDOCK = 0x4011, /* undocked from hotplug 177 177 dock or port replicator */ 178 + /* 179 + * Thinkpad X1 Tablet series devices emit 0x4012 and 0x4013 180 + * when keyboard cover is attached, detached or folded onto the back 181 + */ 182 + TP_HKEY_EV_KBD_COVER_ATTACH = 0x4012, /* keyboard cover attached */ 183 + TP_HKEY_EV_KBD_COVER_DETACH = 0x4013, /* keyboard cover detached or folded back */ 178 184 179 185 /* User-interface events */ 180 186 TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ ··· 3995 3989 return true; 3996 3990 case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */ 3997 3991 pr_info("undocked from hotplug port replicator\n"); 3992 + return true; 3993 + 3994 + /* 3995 + * Deliberately ignore attaching and detaching the keybord cover to avoid 3996 + * duplicates from intel-vbtn, which already emits SW_TABLET_MODE events 3997 + * to userspace. 3998 + * 3999 + * Please refer to the following thread for more information and a preliminary 4000 + * implementation using the GTOP ("Get Tablet OPtions") interface that could be 4001 + * extended to other attachment options of the ThinkPad X1 Tablet series, such as 4002 + * the Pico cartridge dock module: 4003 + * https://lore.kernel.org/platform-driver-x86/38cb8265-1e30-d547-9e12-b4ae290be737@a-kobel.de/ 4004 + */ 4005 + case TP_HKEY_EV_KBD_COVER_ATTACH: 4006 + case TP_HKEY_EV_KBD_COVER_DETACH: 4007 + *send_acpi_ev = false; 4008 + *ignore_acpi_ev = true; 3998 4009 return true; 3999 4010 4000 4011 default: