From eaf87422b1937089716fe2c82c1e52776104faf3 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 12 Aug 2024 09:58:23 +0100 Subject: [PATCH] ec/starlabs/merlin: Add Intel Virtual Button Driver for Tablet Mode This patch adds support for the Intel Virtual Button driver, which reports whether a tablet is docked or undocked. The GPIO used for detection is hardcoded to GPP_F15 for now, specific to the `mb/starlite_adl` board. The GPIO value is returned to the HID driver via the `_STA` and `VGBS` methods. These methods ensure proper notification to the OS, allowing it to show or hide the virtual keyboard depending on the docking status. Tested on `starlite_adl` with Ubuntu 24.04, confirming the virtual keyboard appears when the tablet is undocked and hides when docked. This was verified with ACPI debug enabled, as dmesg does not report the state of the GPIO. Change-Id: I574a1b2d3907b2341a0dfdc412151d574ba4848e Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/83879 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/ec/starlabs/merlin/acpi/dock.asl | 55 ++++++++++++++++++++++++++++ src/ec/starlabs/merlin/acpi/ec.asl | 1 + src/ec/starlabs/merlin/acpi/hid.asl | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/ec/starlabs/merlin/acpi/dock.asl diff --git a/src/ec/starlabs/merlin/acpi/dock.asl b/src/ec/starlabs/merlin/acpi/dock.asl new file mode 100644 index 0000000000..8d648bc8b9 --- /dev/null +++ b/src/ec/starlabs/merlin/acpi/dock.asl @@ -0,0 +1,55 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +Device (VBTN) +{ + Name (_HID, "INT33D6") + Name (_UID, 1) + Name (_DDN, "Intel Virtual Button Driver") + + Method (_STA, 0, NotSerialized) + { + Return (0x0f) + } + + Method (VBDL) + { + } + + Method (UPDK, 0, Serialized) + { + Local0 = VGBS() + + If (Local0 == 0) { + Printf ("Tablet Mode") + Notify (HIDD, 0xcc) /* Tablet */ + } Else { + Printf ("Docked") + Notify (HIDD, 0xcd) /* Docked */ + } + Return (Local0) + } + + Method (VGBS, 0) + { +#if CONFIG(SYSTEM_TYPE_DETACHABLE) + If (!GRXS (GPP_F15)) + { + Return (0x40) + } +#endif + Return (0x00) + } +} + +Device (VBTO) +{ + Name (_HID, "INT33D3") + Name (_CID, "PNP0C60") + Name (_UID, 1) + Name (_DDN, "Laptop/tablet mode indicator driver") + + Method (_STA, 0) + { + Return (0xf) + } +} diff --git a/src/ec/starlabs/merlin/acpi/ec.asl b/src/ec/starlabs/merlin/acpi/ec.asl index 52cab91883..7eec057aa6 100644 --- a/src/ec/starlabs/merlin/acpi/ec.asl +++ b/src/ec/starlabs/merlin/acpi/ec.asl @@ -137,6 +137,7 @@ Scope (\_SB.PCI0.LPCB) #include "battery.asl" #include "events.asl" #include "lid.asl" + #include "dock.asl" Method (_REG, 2, NotSerialized) { diff --git a/src/ec/starlabs/merlin/acpi/hid.asl b/src/ec/starlabs/merlin/acpi/hid.asl index a9de7da559..15f02fcfed 100644 --- a/src/ec/starlabs/merlin/acpi/hid.asl +++ b/src/ec/starlabs/merlin/acpi/hid.asl @@ -351,7 +351,7 @@ Device (HIDD) // HID Device // Case (0x08) { - Return (0x00) + Return (\_SB.PCI0.LPCB.EC.VBTN.VGBS()) } // // Function 9 H2BC. Button implemented state.