blob: 03309e8aca526a9a501f2d11938d32882aa88338 [file] [log] [blame]
Elyes HAOUAS7cf47cf2020-07-18 10:51:06 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Matthew Garrett2f62a352018-07-24 14:06:39 -07002
3Device (EC)
4{
5 Name (_HID, EisaId ("PNP0C09"))
6 Name (_UID, 0)
7
8 Name (_GPE, 0x4F) // _GPE: General Purpose Events
9 Name (_CRS, ResourceTemplate () {
10 IO (Decode16, 0x62, 0x62, 1, 1)
11 IO (Decode16, 0x66, 0x66, 1, 1)
12 })
13
Felix Singerfa06bcb2022-12-26 09:32:47 +010014 OperationRegion (ERAM, EmbeddedControl, 0, 0xFF)
Matthew Garrett2f62a352018-07-24 14:06:39 -070015 Field (ERAM, ByteAcc, Lock, Preserve)
16 {
17 Offset (0x50),
18 CTMP, 8,
19 CFAN, 8,
20 B1SS, 1,
21 BSTS, 2,
22 ACIN, 1,
23 Offset (0x53),
24 BKLG, 8,
25 TOUP, 1,
26 WIRE, 1,
27 BLTH, 1,
28 LIDC, 1,
29 APFG, 1,
30 WRST, 1,
31 BTST, 1,
32 ACEB, 1,
33 CAME, 1,
34 Offset (0x60),
35 DGCP, 16,
36 FLCP, 16,
37 DGVO, 16,
38 BDW, 16,
39 BDL, 16,
40 BPR, 16,
41 BRC, 16,
42 BPV, 16
43 }
44
45 Method (_REG, 2, NotSerialized)
46 {
47 /* Initialize AC power state */
Felix Singerb26e2552022-12-12 03:32:49 +010048 \PWRS = ACIN
Matthew Garrett2f62a352018-07-24 14:06:39 -070049
50 /* Initialize LID switch state */
Felix Singerb26e2552022-12-12 03:32:49 +010051 \LIDS = LIDC
Matthew Garrett2f62a352018-07-24 14:06:39 -070052 }
53
54 /* KEY_BRIGHTNESSUP */
55 Method (_Q04)
56 {
57 Notify(\_SB.PCI0.GFX0.LCD, 0x86)
58 }
59
60 /* KEY_BRIGHTNESSDOWN */
61 Method (_Q05)
62 {
63 Notify(\_SB.PCI0.GFX0.LCD, 0x87)
64 }
65
66 /* Battery Information Event */
67 Method (_Q0C)
68 {
69 Notify (BAT, 0x81)
70 }
71
72 /* AC event */
73 Method (_Q0D)
74 {
Felix Singerb26e2552022-12-12 03:32:49 +010075 \PWRS = ACIN
Matthew Garrett2f62a352018-07-24 14:06:39 -070076 Notify (AC, 0x80)
77 }
78
79 /* Lid event */
80 Method (_Q0E)
81 {
Felix Singerb26e2552022-12-12 03:32:49 +010082 \LIDS = LIDC
Matthew Garrett2f62a352018-07-24 14:06:39 -070083 Notify (LID0, 0x80)
84 }
85
86 /* Battery Information Event */
87 Method (_Q13)
88 {
89 Notify (BAT, 0x81)
90 }
91
92 /* Battery Status Event */
93 Method (_Q14)
94 {
95 Notify (BAT, 0x80)
96 }
97
98 Device (AC)
99 {
100 Name (_HID, "ACPI0003")
101 Name (_PCL, Package () { \_SB })
102
103 Method (_STA)
104 {
105 Return (0x0F)
106 }
107 Method (_PSR)
108 {
109 Return (\PWRS)
110 }
111 }
112
113 #include "battery.asl"
114}