Debian Codegraph @

src/ec/roda/it8518/acpi/ec.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <drivers/pc80/pc/ps2_controller.asl>
4
5 Device (EC0)
6 {
7 Name (_HID, EISAID ("PNP0C09")) // ACPI Embedded Controller
8 Name (_UID, 1)
9 Name (_GPE, EC_SCI_GPI)
10 Name (PWRS, 1)
11 Name (LIDS, 1)
12
13 // EC RAM fields
14 OperationRegion(ERAM, EmbeddedControl, 0, 0xff)
15 Field (ERAM, ByteAcc, NoLock, Preserve)
16 {
17 Offset(0x02), // [Configuration Space 0x2]
18 B0ST, 16, // Battery 0 State
19 B0FC, 16, // Battery 0 Last Full Charge Capacity
20 B0RC, 16, // Battery 0 Remaining Capacity
21 B0U1, 16, // Unknown
22 B0VT, 16, // Battery 0 Present Voltage
23 B0AC, 16, // Battery 0 Present Rate
24 Offset(0x40), // [Configuration Space 0x40]
25 ECOS, 8, // OS System Type (0: DOS, 1: ACPI-compatible)
26 CPUT, 8, // CPU Temperature
27 LOCT, 8, // LOC Temperature
28 OEMT, 8, // OEM Temperature
29 Offset (0x48), // [Configuration Space 0x48]
30 ECPS, 8, // EC Power Source
31 Offset (0x50), // [Configuration Space 0x50]
32 LUXH, 8, // Ambient Light Illuminance High
33 LUXL, 8, // Ambient Light Illuminance Low
34 Offset (0x5b), // [Configuration Space 0x5b]
35 BRIG, 8, // Brightness
36 } // End of ERAM
37
38 Method (_STA, 0, NotSerialized)
39 {
40 Return (0x0f)
41 }
42
43 Method (_CRS, 0, NotSerialized)
44 {
45 Return (ResourceTemplate()
46 {
47 IO (Decode16, 0x62, 0x62, 0x00, 0x01)
48 IO (Decode16, 0x66, 0x66, 0x00, 0x01)
49 })
50 }
51
52 Method (_REG, 2, NotSerialized)
53 {
54 Printf ("-----> EC: _REG")
55
56 ECOS = 0x01
57
58 Printf ("<----- EC: _REG")
59 }
60
61 Method (_Q29, 0, NotSerialized) // _Qxx: EC Query
62 {
63 Printf ("-----> EC: _Q29")
64
65 PWRS = 1
66 Notify (AC, 0x80)
67 Notify (AC, 0x00)
68 Notify (BAT0, 0x00)
69 Notify (BAT0, 0x80)
70
71 Printf ("<----- EC: _Q29")
72 }
73
74 Method (_Q31, 0, NotSerialized) // _Qxx: EC Query
75 {
76 Printf ("-----> EC: _Q31")
77
78 PWRS = 0
79 Notify (AC, 0x80)
80 Notify (AC, 0x00)
81 Notify (BAT0, 0x00)
82 Notify (BAT0, 0x80)
83
84 Printf ("<----- EC: _Q31")
85 }
86
87 Method (_Q32, 0, NotSerialized) // _Qxx: EC Query
88 {
89 Printf ("-----> EC: _Q32")
90
91 Sleep (2500)
92 Notify (BAT0, 0x00)
93 Notify (BAT0, 0x80)
94 Notify (BAT0, 0x81)
95 Notify (BAT0, 0x82)
96
97 Printf ("<----- EC: _Q32")
98 }
99
100 Method (_Q33, 0, NotSerialized) // _Qxx: EC Query
101 {
102 Printf ("-----> EC: _Q33")
103
104 Sleep (2500)
105 Notify (BAT0, 0x00)
106 Notify (BAT0, 0x80)
107 Notify (BAT0, 0x81)
108 Notify (BAT0, 0x82)
109
110 Printf ("<---- EC: _Q33")
111 }
112
113 Method (_Q36, 0, NotSerialized) // _Qxx: EC Query
114 {
115 Printf ("-----> EC: _Q36")
116
117 Notify (BAT0, 0x80)
118
119 Printf ("<----- EC: _Q36")
120 }
121
122 Method (_Q37, 0, NotSerialized) // _Qxx: EC Query
123 {
124 Printf ("-----> EC: _Q37")
125
126 Notify (BAT0, 0x80)
127
128 Printf ("<----- EC: _Q37")
129 }
130
131 Method (_Q43, 0, NotSerialized) // _Qxx: EC Query
132 {
133 Printf ("-----> EC: _Q43")
134
135 Local0 = BRIG + 1
136 If (Local0 > 0xaa) {
137 Local0 = 0xaa
138 }
139 BRIG = Local0
140
141 \_SB.PCI0.GFX0.INCB ()
142
143 Printf ("<---- EC: _Q43")
144 }
145
146 Method (_Q44, 0, NotSerialized) // _Qxx: EC Query
147 {
148 Printf ("-----> EC: _Q44")
149
150 Local0 = BRIG - 1
151 If (Local0 < 0xa0)
152 {
153 Local0 = 0xa0
154 }
155 BRIG = Local0
156
157 \_SB.PCI0.GFX0.DECB ()
158
159 Printf ("<---- EC: _Q44")
160 }
161
162 Method (_Q45, 0, NotSerialized) // _Qxx: EC Query
163 {
164 Printf ("-----> EC: _Q45")
165
166 LIDS = 0
167 Notify (LID, 0x80)
168
169 Printf ("<----- EC: _Q45")
170 }
171
172 Method (_Q46, 0, NotSerialized) // _Qxx: EC Query
173 {
174 Printf ("-----> EC: _Q46")
175
176 LIDS = 1
177 Notify (LID, 0x80)
178
179 Printf ("<----- EC: _Q46")
180 }
181
182 Method (_Q70, 0, NotSerialized) // _Qxx: EC Query
183 {
184 Printf ("-----> EC: _Q70")
185
186 Notify (ALSD, 0x80)
187
188 Printf ("<----- EC: _Q70")
189 }
190
191 #include "battery.asl"
192 #include "ac.asl"
193 #include "lid.asl"
194 }