blob: a1bf8bc5b73feafdb20e0f806d1d2bac6e84f717 [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Sven Schnelleffcd1432011-04-11 19:43:32 +00002
Sven Schnelleffcd1432011-04-11 19:43:32 +00003Device(EC)
4{
5 Name (_HID, EISAID("PNP0C09"))
6 Name (_UID, 0)
7
Vladimir Serbinenko219f0682013-11-13 18:24:04 +01008 Name (_GPE, THINKPAD_EC_GPE)
Sven Schnelleffcd1432011-04-11 19:43:32 +00009 Mutex (ECLK, 0)
10
11 OperationRegion(ERAM, EmbeddedControl, 0x00, 0x100)
12 Field (ERAM, ByteAcc, NoLock, Preserve)
13 {
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010014 Offset (0x02),
Elyes HAOUASb9331092016-09-05 19:55:34 +020015 DKR1, 1, /* Dock register 1 */
Sven Schnelleffcd1432011-04-11 19:43:32 +000016 Offset (0x05),
17 HSPA, 1,
18 Offset (0x0C),
19 LEDS, 8, /* LED state */
Nicola Corna47f87bd2017-02-11 14:00:03 +010020 Offset (0x0F),
21 , 7,
22 TBSW, 1, /* Tablet mode switch */
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010023 Offset (0x1a),
Elyes HAOUASb9331092016-09-05 19:55:34 +020024 DKR2, 1, /* Dock register 2 */
Sven Schnelled8b60a02011-06-23 13:43:52 +020025 Offset (0x2a),
26 EVNT, 8, /* write will trigger EC event */
Patrick Rudolph0709dc02017-08-27 17:46:52 +020027 Offset (0x2f),
28 , 6,
29 FAND, 1, /* Fan disengage */
30 FANA, 1, /* Fan automatic mode enable */
Nicola Corna068edc12017-02-11 14:52:24 +010031 Offset (0x30),
32 , 6,
33 ALMT, 1, /* Audio Mute + LED */
Patrick Rudolphf281b6d2017-08-14 18:41:32 +020034 Offset (0x31),
35 , 2,
36 UWBE, 1, /* Ultra Wideband enable */
Sven Schnelleffcd1432011-04-11 19:43:32 +000037 Offset (0x3a),
Nicola Corna068edc12017-02-11 14:52:24 +010038 AMUT, 1, /* Audio Mute (internal use) */
Vladimir Serbinenkocbcf28f2015-05-13 18:22:49 +020039 , 3,
40 BTEB, 1,
41 WLEB, 1,
42 WWEB, 1,
Sven Schnelleffcd1432011-04-11 19:43:32 +000043 Offset (0x3B),
44 , 1,
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010045 KBLT, 1, /* Keyboard Light */
Sven Schnelle86e1aea2011-06-16 16:43:04 +020046 , 2,
47 USPW, 1, /* USB Power enable */
Patrick Rudolph112ae482017-08-13 18:05:13 +020048 Offset (0x48),
49 HPPI, 1, /* Headphone plugged in */
50 GSTS, 1, /* Master wireless switch */
Sven Schnelleffcd1432011-04-11 19:43:32 +000051 Offset (0x4e),
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010052 WAKE, 16,
Sven Schnelleffcd1432011-04-11 19:43:32 +000053 Offset (0x78),
54 TMP0, 8, /* Thermal Zone 0 temperature */
55 TMP1, 8, /* Thermal Zone 1 temperature */
56 Offset (0x81),
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010057 PAGE, 8, /* Information Page Selector */
58 Offset (0xfe),
59 , 4,
Elyes HAOUASb9331092016-09-05 19:55:34 +020060 DKR3, 1 /* Dock register 3 */
Vladimir Serbinenko969553e2013-11-14 19:08:38 +010061 }
Sven Schnelleffcd1432011-04-11 19:43:32 +000062
Patrick Rudolphdbf5a5d2018-07-29 08:08:33 +020063 /* Called on OperationRegion driver changes */
64 Method (_REG, 2, NotSerialized)
65 {
66 /* Wait for ERAM driver loaded */
Felix Singer95bfa032022-01-02 00:48:19 +010067 if (Arg1 == 1) {
Patrick Rudolphdbf5a5d2018-07-29 08:08:33 +020068 /* Fill HKEY defaults on first boot */
Felix Singer95bfa032022-01-02 00:48:19 +010069 if (^HKEY.INIT == 0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010070 ^HKEY.WBDC = BTEB
71 ^HKEY.WWAN = WWEB
Felix Singerca4b5872022-12-26 08:17:06 +010072 ^HKEY.INIT = 1
Patrick Rudolphdbf5a5d2018-07-29 08:08:33 +020073 }
74 }
75 }
76
Paul Menzel8ce7bc12017-10-08 16:03:57 +020077 Method (_CRS, 0, Serialized)
Sven Schnelleffcd1432011-04-11 19:43:32 +000078 {
79 Name (ECMD, ResourceTemplate()
80 {
81 IO (Decode16, 0x62, 0x62, 1, 1)
82 IO (Decode16, 0x66, 0x66, 1, 1)
83 })
84 Return (ECMD)
85 }
86
Vladimir Serbinenko7096a0c2014-08-28 01:31:33 +020087 Method (TLED, 1, NotSerialized)
Sven Schnelleffcd1432011-04-11 19:43:32 +000088 {
Felix Singerf45a6c22022-12-12 04:54:01 +010089 LEDS = Arg0
Sven Schnelleffcd1432011-04-11 19:43:32 +000090 }
91
Vladimir Serbinenko86035132014-08-28 01:41:20 +020092 /* Not used for coreboot. Provided for compatibility with thinkpad-acpi. */
93 Method (LED, 2, NotSerialized)
94 {
Felix Singer274fa642022-12-16 04:27:21 +010095 TLED(Arg0 | Arg1)
Vladimir Serbinenko86035132014-08-28 01:41:20 +020096 }
97
Sven Schnelleffcd1432011-04-11 19:43:32 +000098 Method (_INI, 0, NotSerialized)
99 {
100 }
101
102 Method (MUTE, 1, NotSerialized)
103 {
Felix Singerf45a6c22022-12-12 04:54:01 +0100104 AMUT = Arg0
Sven Schnelleffcd1432011-04-11 19:43:32 +0000105 }
106
Vladimir Serbinenkocbcf28f2015-05-13 18:22:49 +0200107 Method (RADI, 1, NotSerialized)
108 {
Felix Singerf45a6c22022-12-12 04:54:01 +0100109 WLEB = Arg0
110 WWEB = Arg0
111 BTEB = Arg0
Vladimir Serbinenkocbcf28f2015-05-13 18:22:49 +0200112 }
113
Sven Schnelle86e1aea2011-06-16 16:43:04 +0200114 Method (USBP, 1, NotSerialized)
115 {
Felix Singerf45a6c22022-12-12 04:54:01 +0100116 USPW = Arg0
Sven Schnelle86e1aea2011-06-16 16:43:04 +0200117 }
118
Stefan Ottf63fbdb2017-05-10 02:01:44 +0200119 Method (LGHT, 1, NotSerialized)
120 {
Felix Singerf45a6c22022-12-12 04:54:01 +0100121 KBLT = Arg0
Stefan Ottf63fbdb2017-05-10 02:01:44 +0200122 }
123
Sven Schnelle86e1aea2011-06-16 16:43:04 +0200124
Sven Schnelleffcd1432011-04-11 19:43:32 +0000125 /* Sleep Button pressed */
126 Method(_Q13, 0, NotSerialized)
127 {
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100128 Notify(^SLPB, 0x80)
Sven Schnelleffcd1432011-04-11 19:43:32 +0000129 }
130
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100131 /* Brightness up GPE */
132 Method(_Q14, 0, NotSerialized)
133 {
Vladimir Serbinenkodfc08812013-11-26 16:37:45 +0100134 BRIGHTNESS_UP()
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100135 }
136
137 /* Brightness down GPE */
138 Method(_Q15, 0, NotSerialized)
139 {
Vladimir Serbinenkodfc08812013-11-26 16:37:45 +0100140 BRIGHTNESS_DOWN()
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100141 }
142
143 /* Next display GPE */
144 Method(_Q16, 0, NotSerialized)
145 {
Angel Pons822148c2020-04-29 22:58:39 +0200146 Notify (\_SB.PCI0.GFX0, 0x82)
Sven Schnelleffcd1432011-04-11 19:43:32 +0000147 }
Angel Pons822148c2020-04-29 22:58:39 +0200148
Sven Schnelleffcd1432011-04-11 19:43:32 +0000149 /* AC status change: present */
150 Method(_Q26, 0, NotSerialized)
151 {
152 Notify (AC, 0x80)
Elyes HAOUAS610d4652018-05-29 11:02:43 +0200153 \PNOT()
Sven Schnelleffcd1432011-04-11 19:43:32 +0000154 }
155
156 /* AC status change: not present */
157 Method(_Q27, 0, NotSerialized)
158 {
159 Notify (AC, 0x80)
Felix Singerf45a6c22022-12-12 04:54:01 +0100160 EVNT = 0x50
Elyes HAOUAS610d4652018-05-29 11:02:43 +0200161 \PNOT()
Sven Schnelleffcd1432011-04-11 19:43:32 +0000162 }
163
Elyes HAOUASb9331092016-09-05 19:55:34 +0200164 Method(_Q2A, 0, NotSerialized)
165 {
166 Notify(^LID, 0x80)
167 }
Sven Schnelleffcd1432011-04-11 19:43:32 +0000168
Elyes HAOUASb9331092016-09-05 19:55:34 +0200169 Method(_Q2B, 0, NotSerialized)
170 {
171 Notify(^LID, 0x80)
172 }
Sven Schnelleffcd1432011-04-11 19:43:32 +0000173
174
Elyes HAOUASb9331092016-09-05 19:55:34 +0200175 /* IBM proprietary buttons. */
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100176
Elyes HAOUASb9331092016-09-05 19:55:34 +0200177 Method (_Q10, 0, NotSerialized)
178 {
179 ^HKEY.RHK (0x01)
180 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100181
Nicola Cornafab9ae82019-02-18 17:44:18 +0100182 /*
183 * Alternative layout (like in the Thinkpad X1 Carbon 1st generation):
184 * * Fn-F2 (_Q11) -> not mapped
185 * * Fn-F3 (_Q12) -> scancode 0x01 (KEY_COFFEE)
186 *
187 * Default layout (like in the Thinkpad X220):
188 * * Fn-F2 (_Q11) -> scancode 0x01 (KEY_COFFEE)
189 * * Fn-F3 (_Q12) -> scancode 0x02 (KEY_BATTERY)
190 */
191#ifdef EC_LENOVO_H8_ALT_FN_F2F3_LAYOUT
192 Method (_Q11, 0, NotSerialized)
193 {
194 // Not mapped
195 }
196
197 Method (_Q12, 0, NotSerialized)
198 {
199 ^HKEY.RHK (0x02)
200 }
201#else
Elyes HAOUASb9331092016-09-05 19:55:34 +0200202 Method (_Q11, 0, NotSerialized)
203 {
204 ^HKEY.RHK (0x02)
205 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100206
Elyes HAOUASb9331092016-09-05 19:55:34 +0200207 Method (_Q12, 0, NotSerialized)
208 {
209 ^HKEY.RHK (0x03)
210 }
Nicola Cornafab9ae82019-02-18 17:44:18 +0100211#endif
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100212
Elyes HAOUASb9331092016-09-05 19:55:34 +0200213 Method (_Q64, 0, NotSerialized)
214 {
215 ^HKEY.RHK (0x05)
216 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100217
Elyes HAOUASb9331092016-09-05 19:55:34 +0200218 Method (_Q65, 0, NotSerialized)
219 {
220 ^HKEY.RHK (0x06)
221 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100222
Elyes HAOUASb9331092016-09-05 19:55:34 +0200223 Method (_Q17, 0, NotSerialized)
224 {
225 ^HKEY.RHK (0x08)
226 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100227
Elyes HAOUASb9331092016-09-05 19:55:34 +0200228 Method (_Q66, 0, NotSerialized)
229 {
230 ^HKEY.RHK (0x0A)
231 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100232
Elyes HAOUASb9331092016-09-05 19:55:34 +0200233 Method (_Q6A, 0, NotSerialized)
234 {
235 ^HKEY.RHK (0x1B)
236 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100237
Elyes HAOUASb9331092016-09-05 19:55:34 +0200238 Method (_Q1A, 0, NotSerialized)
239 {
240 ^HKEY.RHK (0x0B)
241 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100242
Elyes HAOUASb9331092016-09-05 19:55:34 +0200243 Method (_Q1B, 0, NotSerialized)
244 {
245 ^HKEY.RHK (0x0C)
246 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100247
Elyes HAOUASb9331092016-09-05 19:55:34 +0200248 Method (_Q62, 0, NotSerialized)
249 {
250 ^HKEY.RHK (0x0D)
251 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100252
Elyes HAOUASb9331092016-09-05 19:55:34 +0200253 Method (_Q60, 0, NotSerialized)
254 {
255 ^HKEY.RHK (0x0E)
256 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100257
Elyes HAOUASb9331092016-09-05 19:55:34 +0200258 Method (_Q61, 0, NotSerialized)
259 {
260 ^HKEY.RHK (0x0F)
261 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100262
Elyes HAOUASb9331092016-09-05 19:55:34 +0200263 Method (_Q1F, 0, NotSerialized)
264 {
265 ^HKEY.RHK (0x12)
266 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100267
Elyes HAOUASb9331092016-09-05 19:55:34 +0200268 Method (_Q67, 0, NotSerialized)
269 {
270 ^HKEY.RHK (0x13)
271 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100272
Elyes HAOUASb9331092016-09-05 19:55:34 +0200273 Method (_Q63, 0, NotSerialized)
274 {
275 ^HKEY.RHK (0x14)
276 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100277
Elyes HAOUASb9331092016-09-05 19:55:34 +0200278 Method (_Q19, 0, NotSerialized)
279 {
280 ^HKEY.RHK (0x18)
281 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100282
Elyes HAOUASb9331092016-09-05 19:55:34 +0200283 Method (_Q1C, 0, NotSerialized)
284 {
285 ^HKEY.RHK (0x19)
286 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100287
Elyes HAOUASb9331092016-09-05 19:55:34 +0200288 Method (_Q1D, 0, NotSerialized)
289 {
290 ^HKEY.RHK (0x1A)
291 }
Vladimir Serbinenkod26558c2013-11-14 18:56:45 +0100292
Elyes HAOUASb9331092016-09-05 19:55:34 +0200293 Method (_Q5C, 0, NotSerialized)
294 {
295 ^HKEY.RTAB (0xB)
296 }
Vladimir Serbinenkofc10c342014-08-25 22:58:11 +0200297
Elyes HAOUASb9331092016-09-05 19:55:34 +0200298 Method (_Q5D, 0, NotSerialized)
299 {
300 ^HKEY.RTAB (0xC)
301 }
Vladimir Serbinenkofc10c342014-08-25 22:58:11 +0200302
Elyes HAOUASb9331092016-09-05 19:55:34 +0200303 Method (_Q5E, 0, NotSerialized)
304 {
305 ^HKEY.RTAB (0x9)
306 }
Vladimir Serbinenkofc10c342014-08-25 22:58:11 +0200307
Elyes HAOUASb9331092016-09-05 19:55:34 +0200308 Method (_Q5F, 0, NotSerialized)
309 {
310 ^HKEY.RTAB (0xA)
311 }
Vladimir Serbinenkofc10c342014-08-25 22:58:11 +0200312
Patrick Rudolph9b8ef112017-11-13 19:00:11 +0100313 /*
314 * Set FAN disengage:
315 * Arg0: 1: Run at full speed
316 * 0: Automatic fan control
317 */
318 Method (FANE, 1, Serialized)
319 {
320 If (Arg0) {
Felix Singerca4b5872022-12-26 08:17:06 +0100321 FAND = 1
Felix Singerf45a6c22022-12-12 04:54:01 +0100322 FANA = Zero
Patrick Rudolph9b8ef112017-11-13 19:00:11 +0100323 } Else {
Felix Singerf45a6c22022-12-12 04:54:01 +0100324 FAND = Zero
Felix Singerca4b5872022-12-26 08:17:06 +0100325 FANA = 1
Patrick Rudolph9b8ef112017-11-13 19:00:11 +0100326 }
327 }
328
Sven Schnelleffcd1432011-04-11 19:43:32 +0000329#include "ac.asl"
330#include "battery.asl"
331#include "sleepbutton.asl"
332#include "lid.asl"
333#include "beep.asl"
Sven Schnelle14748a52011-04-13 09:23:45 +0000334#include "thermal.asl"
Sven Schnelleee4c6f72011-04-17 14:55:21 +0000335#include "systemstatus.asl"
Patrick Rudolphf81f62a2017-11-14 18:48:13 +0100336#include "thinkpad.asl"
Sven Schnelleffcd1432011-04-11 19:43:32 +0000337}