blob: 201ab51002aba9c164ad3ca173878cca721a052a [file] [log] [blame]
Duncan Laurie4a2558b2019-02-01 11:44:14 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2019 Google LLC
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17/*
18 * Intel Virtual Button driver compatible with the driver found in
19 * the Linux kernel at drivers/platform/x86/intel-vbtn.c
20 *
21 * For tablet/laptop and dock/undock events to work the board must
22 * select SYSTEM_TYPE_CONVERTIBLE for the SMBIOS enclosure type to
23 * indicate the device is a convertible.
24 */
25
26Name (FLAP, 0x40) /* Flag indicating device is in laptop mode */
27
28/* Virtual events */
29Name (VPPB, 0xc0) /* Power Button press */
30Name (VRPB, 0xc1) /* Power Button release */
31Name (VPSP, 0xc2) /* Special key press (LEFTMETA in Linux) */
32Name (VRSP, 0xc3) /* Special key release (LEFTMETA in Linux) */
33Name (VPVU, 0xc4) /* Volume Up press */
34Name (VRVU, 0xc5) /* Volume Up release */
35Name (VPVD, 0xc6) /* Volume Down press */
36Name (VRVD, 0xc7) /* Volume Down release */
37Name (VPRL, 0xc8) /* Rotate Lock press */
38Name (VRRL, 0xc9) /* Rotate Lock release */
39Name (VDOC, 0xca) /* Docked */
40Name (VUND, 0xcb) /* Undocked */
41Name (VTBL, 0xcc) /* Tablet Mode */
42Name (VLAP, 0xcd) /* Laptop Mode */
43
44Device (VBTN)
45{
46 Name (_HID, "INT33D6")
47 Name (_UID, One)
48 Name (_DDN, "Intel Virtual Button Driver")
49
50 /*
51 * This method is called at driver probe time and must exist or
52 * the driver will not load.
53 */
54 Method (VBDL)
55 {
56 }
57
58 /*
59 * This method returns flags indicating tablet and dock modes.
60 * It is called at driver probe time so the OS knows what the
61 * state of the device is at boot.
62 */
63 Method (VGBS)
64 {
65 Local0 = Zero
66
67 /* Check EC orientation for tablet mode flag */
68 If (R (OTBL)) {
69 Printf ("EC reports tablet mode at boot")
70 } Else {
71 Printf ("EC reports laptop mode at boot")
72 Local0 |= ^^FLAP
73 }
74 Return (Local0)
75 }
76
77 Method(_STA, 0)
78 {
79 Return (0xF)
80 }
81}
82
83Device (VBTO)
84{
85 Name (_HID, "INT33D3")
86 Name (_CID, "PNP0C60")
87 Name (_UID, One)
88 Name (_DDN, "Laptop/tablet mode indicator driver")
89
90 Method (_STA, 0)
91 {
92 Return (0xF)
93 }
94}