mb/google/brya: Create rull variant
[coreboot2.git] / src / ec / roda / it8518 / acpi / ec.asl
blob97ce1e0532bc57fba6995ffd9316d50d2ff82ae3
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <drivers/pc80/pc/ps2_controller.asl>
5 Device (EC0)
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)
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
38         Method (_STA, 0, NotSerialized)
39         {
40                 Return (0x0f)
41         }
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         }
52         Method (_REG, 2, NotSerialized)
53         {
54                 Printf ("-----> EC: _REG")
56                 ECOS = 0x01
58                 Printf ("<----- EC: _REG")
59         }
61         Method (_Q29, 0, NotSerialized)         // _Qxx: EC Query
62         {
63                 Printf ("-----> EC: _Q29")
65                 PWRS = 1
66                 Notify (AC, 0x80)
67                 Notify (AC, 0x00)
68                 Notify (BAT0, 0x00)
69                 Notify (BAT0, 0x80)
71                 Printf ("<----- EC: _Q29")
72         }
74         Method (_Q31, 0, NotSerialized)         // _Qxx: EC Query
75         {
76                 Printf ("-----> EC: _Q31")
78                 PWRS = 0
79                 Notify (AC, 0x80)
80                 Notify (AC, 0x00)
81                 Notify (BAT0, 0x00)
82                 Notify (BAT0, 0x80)
84                 Printf ("<----- EC: _Q31")
85         }
87         Method (_Q32, 0, NotSerialized)         // _Qxx: EC Query
88         {
89                 Printf ("-----> EC: _Q32")
91                 Sleep (2500)
92                 Notify (BAT0, 0x00)
93                 Notify (BAT0, 0x80)
94                 Notify (BAT0, 0x81)
95                 Notify (BAT0, 0x82)
97                 Printf ("<----- EC: _Q32")
98         }
100         Method (_Q33, 0, NotSerialized)         // _Qxx: EC Query
101         {
102                 Printf ("-----> EC: _Q33")
104                 Sleep (2500)
105                 Notify (BAT0, 0x00)
106                 Notify (BAT0, 0x80)
107                 Notify (BAT0, 0x81)
108                 Notify (BAT0, 0x82)
110                 Printf ("<---- EC: _Q33")
111         }
113         Method (_Q36, 0, NotSerialized)         // _Qxx: EC Query
114         {
115                 Printf ("-----> EC: _Q36")
117                 Notify (BAT0, 0x80)
119                 Printf ("<----- EC: _Q36")
120         }
122         Method (_Q37, 0, NotSerialized)         // _Qxx: EC Query
123         {
124                 Printf ("-----> EC: _Q37")
126                 Notify (BAT0, 0x80)
128                 Printf ("<----- EC: _Q37")
129         }
131         Method (_Q43, 0, NotSerialized)         // _Qxx: EC Query
132         {
133                 Printf ("-----> EC: _Q43")
135                 Local0 = BRIG + 1
136                 If (Local0 > 0xaa) {
137                         Local0 = 0xaa
138                 }
139                 BRIG = Local0
141                 \_SB.PCI0.GFX0.INCB ()
143                 Printf ("<---- EC: _Q43")
144         }
146         Method (_Q44, 0, NotSerialized)         // _Qxx: EC Query
147         {
148                 Printf ("-----> EC: _Q44")
150                 Local0 = BRIG - 1
151                 If (Local0 < 0xa0)
152                 {
153                         Local0 = 0xa0
154                 }
155                 BRIG = Local0
157                 \_SB.PCI0.GFX0.DECB ()
159                 Printf ("<---- EC: _Q44")
160         }
162         Method (_Q45, 0, NotSerialized)         // _Qxx: EC Query
163         {
164                 Printf ("-----> EC: _Q45")
166                 LIDS = 0
167                 Notify (LID, 0x80)
169                 Printf ("<----- EC: _Q45")
170         }
172         Method (_Q46, 0, NotSerialized)         // _Qxx: EC Query
173         {
174                 Printf ("-----> EC: _Q46")
176                 LIDS = 1
177                 Notify (LID, 0x80)
179                 Printf ("<----- EC: _Q46")
180         }
182         Method (_Q70, 0, NotSerialized)         // _Qxx: EC Query
183         {
184                 Printf ("-----> EC: _Q70")
186                 Notify (ALSD, 0x80)
188                 Printf ("<----- EC: _Q70")
189         }
191         #include "battery.asl"
192         #include "ac.asl"
193         #include "lid.asl"