blob: dbedbd1d8e7a3c3aca73e9f65c3399bb3e66b0aa [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Duncan Laurie4a2558b2019-02-01 11:44:14 -08002
3/*
4 * Intel Virtual Button driver compatible with the driver found in
5 * the Linux kernel at drivers/platform/x86/intel-vbtn.c
6 *
7 * For tablet/laptop and dock/undock events to work the board must
Kyösti Mälkki44a4c0a2020-06-07 14:11:50 +03008 * have SMBIOS_ENCLOSURE_CONVERTIBLE for the SMBIOS enclosure type to
Duncan Laurie4a2558b2019-02-01 11:44:14 -08009 * indicate the device is a convertible.
10 */
11
12Name (FLAP, 0x40) /* Flag indicating device is in laptop mode */
13
14/* Virtual events */
15Name (VPPB, 0xc0) /* Power Button press */
16Name (VRPB, 0xc1) /* Power Button release */
17Name (VPSP, 0xc2) /* Special key press (LEFTMETA in Linux) */
18Name (VRSP, 0xc3) /* Special key release (LEFTMETA in Linux) */
19Name (VPVU, 0xc4) /* Volume Up press */
20Name (VRVU, 0xc5) /* Volume Up release */
21Name (VPVD, 0xc6) /* Volume Down press */
22Name (VRVD, 0xc7) /* Volume Down release */
23Name (VPRL, 0xc8) /* Rotate Lock press */
24Name (VRRL, 0xc9) /* Rotate Lock release */
25Name (VDOC, 0xca) /* Docked */
26Name (VUND, 0xcb) /* Undocked */
27Name (VTBL, 0xcc) /* Tablet Mode */
28Name (VLAP, 0xcd) /* Laptop Mode */
29
30Device (VBTN)
31{
32 Name (_HID, "INT33D6")
Felix Singerca4b5872022-12-26 08:17:06 +010033 Name (_UID, 1)
Duncan Laurie4a2558b2019-02-01 11:44:14 -080034 Name (_DDN, "Intel Virtual Button Driver")
35
36 /*
37 * This method is called at driver probe time and must exist or
38 * the driver will not load.
39 */
40 Method (VBDL)
41 {
42 }
43
44 /*
45 * This method returns flags indicating tablet and dock modes.
46 * It is called at driver probe time so the OS knows what the
47 * state of the device is at boot.
48 */
49 Method (VGBS)
50 {
Felix Singer42efd7f2022-12-26 09:38:45 +010051 Local0 = 0
Duncan Laurie4a2558b2019-02-01 11:44:14 -080052
53 /* Check EC orientation for tablet mode flag */
54 If (R (OTBL)) {
55 Printf ("EC reports tablet mode at boot")
56 } Else {
57 Printf ("EC reports laptop mode at boot")
58 Local0 |= ^^FLAP
59 }
60 Return (Local0)
61 }
62
63 Method(_STA, 0)
64 {
65 Return (0xF)
66 }
67}
68
69Device (VBTO)
70{
71 Name (_HID, "INT33D3")
72 Name (_CID, "PNP0C60")
Felix Singerca4b5872022-12-26 08:17:06 +010073 Name (_UID, 1)
Duncan Laurie4a2558b2019-02-01 11:44:14 -080074 Name (_DDN, "Laptop/tablet mode indicator driver")
75
76 Method (_STA, 0)
77 {
78 Return (0xF)
79 }
80}