Re: [PATCH v12 2/2] platform/x86/lenovo: Add Yoga Book 9 keyboard dock detection driver
From: Ilpo Järvinen
Date: Tue Jul 21 2026 - 12:47:12 EST
On Mon, 13 Jul 2026, Dave Carey wrote:
> The Lenovo Yoga Book 9 14IAH10 ships with a detachable Bluetooth keyboard
> that magnetically attaches to the bottom (secondary) screen in one of two
> positions. The Embedded Controller tracks the attachment state in a 2-bit
> field called BKBD and signals changes via WMI event GUID
> 806BD2A2-177B-481D-BFB5-3BA0BB4A2285 (notify ID 0xEB on the WM10 ACPI
> device, _UID "GMZN").
>
> The device contains embedded BMOF data (WQDD, 20705 bytes) documenting
> both WMI interfaces used by this driver:
>
> LENOVO_BTKBD_EVENT (event GUID): WmiDataId(1) uint32 Status.
> The ACPI _WED(0xEB) method returns EC.BKBD directly as an integer,
> so the notify callback receives BKBD without a separate query.
>
> LENOVO_FEATURE_STATUS_DATA (block GUID, WQAF method): returns an
> 8-byte buffer {uint32 IDs=0x00060000, uint32 Status=BKBD}.
> Used for the initial state read on probe and after resume.
>
> BKBD encoding:
> 0 = keyboard detached
> 1 = keyboard docked on top half of bottom screen
> 2 = keyboard docked on bottom half of bottom screen
> 3 = reserved (not observed in practice)
>
> This driver registers two WMI drivers sharing a module-level
> BLOCKING_NOTIFIER_HEAD:
>
> - The event driver (LENOVO_BTKBD_EVENT) uses .notify_new() to receive
> a pre-parsed wmi_buffer and fires the notifier chain with the BKBD
> value extracted from the buffer.
>
> - The block driver (LENOVO_FEATURE_STATUS_DATA) owns the input_dev in
> its per-device private struct. At probe time it registers a
> notifier_block on the chain and reads the initial BKBD state via
> wmidev_query_block(). The WMI buffer is parsed as
> struct lenovo_feature_status { __le32 id; __le32 status; }, and the
> ID field is verified before the status is used.
>
> - SW_TABLET_MODE=1 is reported when the keyboard is detached;
> SW_TABLET_MODE=0 when docked in either position (keyboard present).
>
> - The raw BKBD value is exposed via read-only sysfs attribute
> "keyboard_position".
>
> - BKBD state is re-read via wmidev_query_block() on resume from
> suspend or hibernation.
>
> Tested on: Lenovo Yoga Book 9 14IAH10 (model 83KJ), kernel 7.0.
>
> Acked-by: Hans de Goede <johannes.goede@xxxxxxxxxxxxxxxx>
> Reviewed-by: Armin Wolf <W_Armin@xxxxxx>
> Signed-off-by: Dave Carey <carvsdriver@xxxxxxxxx>
Hi Dave,
Unfortunately this patch is somehow corrupted and I couldn't immediately
figure out where so you need to fix the problem and send the series again.
It may be worthwhile to send it yourself first and test you can apply it
with git am yourself to make sure nothing in the way you send an email is
causing the corruption. Once it works for you, it will likely work in my
end as well.
--
i.