Re: [PATCH v2] platform/x86: thinkpad-acpi: Add X1 Fold keyboard attachment detection

From: Hans de Goede

Date: Mon Jun 08 2026 - 13:21:07 EST


Hi,

On 8-Jun-26 11:09, Hans de Goede wrote:
> Hi,
>
> On 19-Apr-26 12:27 PM, Pit Henrich wrote:
>> ThinkPad X1 Fold 16 Gen 1 firmware reports whether the keyboard is magnetically
>> attached (on the screen), but thinkpad-acpi does not expose this to userspace.
>> The state can be obtained via ACPI methods: GDST (get device state).
>>
>> Add a read-only keyboard_attached_on_screen sysfs attribute, gated by
>> a DMI match. The state is read directly from the EC.
>>
>> Cache the state and emit a sysfs notification on
>> TP_HKEY_EV_TABLET_CHANGED (0x60c0) when it changes. Initialize the cache during
>> hotkey setup and refresh it before the resume notification to keep the state
>> consistent across suspend and resume.
>>
>> Signed-off-by: Pit Henrich <pithenrich2d@xxxxxxxxx>
>> ---
>> This replaced the v1 patch in:
>> https://lore.kernel.org/all/20260314142236.74514-1-pithenrich2d@xxxxxxxxx/
>>
>> Changes v1 -> v2:
>> * Use ACPI method instead of using the EC directly (thanks Mark).
>
> Thank you for your patch. It seems that this information is also exposed
> via WMI and a WMI driver exposing the same information is also being
> worked on:
>
> https://patchwork.kernel.org/project/platform-driver-x86/patch/20260527122701.242907-1-carvsdriver@xxxxxxxxx/
>
> +Cc Dave Carey (author of that driver) and Armin (WMI maintainer)

Ok, I should have looked closer, this patch is for a "ThinkPad X1 Fold 16
Gen 1" and the driver I linked above is for a "Yoga Book 9" so I was mistaken
that these drivers are duplicate, we will need both. Sorry, my bad.

Note not a full review, but before we can move forward with this driver,
you are going to need to document the new sysfs attribute under:

Documentation/admin-guide/laptops/thinkpad-acpi.rst

Please add a new "X1 Fold keyboard attachmen" section directly after
the "Hardware damage detection capability" section (or iow just above
the "Multiple Commands, Module Parameters" section).

Regards,

Hans