summaryrefslogtreecommitdiff
path: root/src/ec/google/wilco/acpi/vbtn.asl
blob: 201ab51002aba9c164ad3ca173878cca721a052a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
 * This file is part of the coreboot project.
 *
 * Copyright 2019 Google LLC
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; version 2 of
 * the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

/*
 * Intel Virtual Button driver compatible with the driver found in
 * the Linux kernel at drivers/platform/x86/intel-vbtn.c
 *
 * For tablet/laptop and dock/undock events to work the board must
 * select SYSTEM_TYPE_CONVERTIBLE for the SMBIOS enclosure type to
 * indicate the device is a convertible.
 */

Name (FLAP, 0x40) /* Flag indicating device is in laptop mode */

/* Virtual events */
Name (VPPB, 0xc0) /* Power Button press */
Name (VRPB, 0xc1) /* Power Button release */
Name (VPSP, 0xc2) /* Special key press (LEFTMETA in Linux) */
Name (VRSP, 0xc3) /* Special key release (LEFTMETA in Linux) */
Name (VPVU, 0xc4) /* Volume Up press */
Name (VRVU, 0xc5) /* Volume Up release */
Name (VPVD, 0xc6) /* Volume Down press */
Name (VRVD, 0xc7) /* Volume Down release */
Name (VPRL, 0xc8) /* Rotate Lock press */
Name (VRRL, 0xc9) /* Rotate Lock release */
Name (VDOC, 0xca) /* Docked */
Name (VUND, 0xcb) /* Undocked */
Name (VTBL, 0xcc) /* Tablet Mode */
Name (VLAP, 0xcd) /* Laptop Mode */

Device (VBTN)
{
	Name (_HID, "INT33D6")
	Name (_UID, One)
	Name (_DDN, "Intel Virtual Button Driver")

	/*
	 * This method is called at driver probe time and must exist or
	 * the driver will not load.
	 */
	Method (VBDL)
	{
	}

	/*
	 * This method returns flags indicating tablet and dock modes.
	 * It is called at driver probe time so the OS knows what the
	 * state of the device is at boot.
	 */
	Method (VGBS)
	{
		Local0 = Zero

		/* Check EC orientation for tablet mode flag */
		If (R (OTBL)) {
			Printf ("EC reports tablet mode at boot")
		} Else {
			Printf ("EC reports laptop mode at boot")
			Local0 |= ^^FLAP
		}
		Return (Local0)
	}

	Method(_STA, 0)
	{
		Return (0xF)
	}
}

Device (VBTO)
{
	Name (_HID, "INT33D3")
	Name (_CID, "PNP0C60")
	Name (_UID, One)
	Name (_DDN, "Laptop/tablet mode indicator driver")

	Method (_STA, 0)
	{
		Return (0xF)
	}
}