• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2
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
8 * have SMBIOS_ENCLOSURE_CONVERTIBLE for the SMBIOS enclosure type to
9 * 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")
33	Name (_UID, 1)
34	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	{
51		Local0 = 0
52
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")
73	Name (_UID, 1)
74	Name (_DDN, "Laptop/tablet mode indicator driver")
75
76	Method (_STA, 0)
77	{
78		Return (0xF)
79	}
80}
81