1/* SPDX-License-Identifier: GPL-2.0-only */ 2 3Device(EC) 4{ 5 Name (_HID, EISAID("PNP0C09")) 6 Name (_UID, 0) 7 8 Name (_GPE, THINKPAD_EC_GPE) 9 Mutex (ECLK, 0) 10 11 OperationRegion(ERAM, EmbeddedControl, 0x00, 0x100) 12 Field (ERAM, ByteAcc, NoLock, Preserve) 13 { 14 Offset (0x02), 15 DKR1, 1, /* Dock register 1 */ 16 Offset (0x05), 17 HSPA, 1, 18 Offset (0x0C), 19 LEDS, 8, /* LED state */ 20 Offset (0x0F), 21 , 7, 22 TBSW, 1, /* Tablet mode switch */ 23 Offset (0x1a), 24 DKR2, 1, /* Dock register 2 */ 25 Offset (0x2a), 26 EVNT, 8, /* write will trigger EC event */ 27 Offset (0x2f), 28 , 6, 29 FAND, 1, /* Fan disengage */ 30 FANA, 1, /* Fan automatic mode enable */ 31 Offset (0x30), 32 , 6, 33 ALMT, 1, /* Audio Mute + LED */ 34 Offset (0x31), 35 , 2, 36 UWBE, 1, /* Ultra Wideband enable */ 37 Offset (0x3a), 38 AMUT, 1, /* Audio Mute (internal use) */ 39 , 3, 40 BTEB, 1, 41 WLEB, 1, 42 WWEB, 1, 43 Offset (0x3B), 44 , 1, 45 KBLT, 1, /* Keyboard Light */ 46 , 2, 47 USPW, 1, /* USB Power enable */ 48 Offset (0x48), 49 HPPI, 1, /* Headphone plugged in */ 50 GSTS, 1, /* Master wireless switch */ 51 Offset (0x4e), 52 WAKE, 16, 53 Offset (0x78), 54 TMP0, 8, /* Thermal Zone 0 temperature */ 55 TMP1, 8, /* Thermal Zone 1 temperature */ 56 Offset (0x81), 57 PAGE, 8, /* Information Page Selector */ 58 Offset (0xfe), 59 , 4, 60 DKR3, 1 /* Dock register 3 */ 61 } 62 63 /* Called on OperationRegion driver changes */ 64 Method (_REG, 2, NotSerialized) 65 { 66 /* Wait for ERAM driver loaded */ 67 if (Arg1 == 1) { 68 /* Fill HKEY defaults on first boot */ 69 if (^HKEY.INIT == 0) { 70 ^HKEY.WBDC = BTEB 71 ^HKEY.WWAN = WWEB 72 ^HKEY.INIT = 1 73 } 74 } 75 } 76 77 Method (_CRS, 0, Serialized) 78 { 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 87 Method (TLED, 1, NotSerialized) 88 { 89 LEDS = Arg0 90 } 91 92 /* Not used for coreboot. Provided for compatibility with thinkpad-acpi. */ 93 Method (LED, 2, NotSerialized) 94 { 95 TLED(Arg0 | Arg1) 96 } 97 98 Method (_INI, 0, NotSerialized) 99 { 100 } 101 102 Method (MUTE, 1, NotSerialized) 103 { 104 AMUT = Arg0 105 } 106 107 Method (RADI, 1, NotSerialized) 108 { 109 WLEB = Arg0 110 WWEB = Arg0 111 BTEB = Arg0 112 } 113 114 Method (USBP, 1, NotSerialized) 115 { 116 USPW = Arg0 117 } 118 119 Method (LGHT, 1, NotSerialized) 120 { 121 KBLT = Arg0 122 } 123 124 125 /* Sleep Button pressed */ 126 Method(_Q13, 0, NotSerialized) 127 { 128 Notify(^SLPB, 0x80) 129 } 130 131 /* Brightness up GPE */ 132 Method(_Q14, 0, NotSerialized) 133 { 134 BRIGHTNESS_UP() 135 } 136 137 /* Brightness down GPE */ 138 Method(_Q15, 0, NotSerialized) 139 { 140 BRIGHTNESS_DOWN() 141 } 142 143 /* Next display GPE */ 144 Method(_Q16, 0, NotSerialized) 145 { 146 Notify (\_SB.PCI0.GFX0, 0x82) 147 } 148 149 /* AC status change: present */ 150 Method(_Q26, 0, NotSerialized) 151 { 152 Notify (AC, 0x80) 153 \PNOT() 154 } 155 156 /* AC status change: not present */ 157 Method(_Q27, 0, NotSerialized) 158 { 159 Notify (AC, 0x80) 160 EVNT = 0x50 161 \PNOT() 162 } 163 164 Method(_Q2A, 0, NotSerialized) 165 { 166 Notify(^LID, 0x80) 167 } 168 169 Method(_Q2B, 0, NotSerialized) 170 { 171 Notify(^LID, 0x80) 172 } 173 174 175 /* IBM proprietary buttons. */ 176 177 Method (_Q10, 0, NotSerialized) 178 { 179 ^HKEY.RHK (0x01) 180 } 181 182 /* 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 202 Method (_Q11, 0, NotSerialized) 203 { 204 ^HKEY.RHK (0x02) 205 } 206 207 Method (_Q12, 0, NotSerialized) 208 { 209 ^HKEY.RHK (0x03) 210 } 211#endif 212 213 Method (_Q64, 0, NotSerialized) 214 { 215 ^HKEY.RHK (0x05) 216 } 217 218 Method (_Q65, 0, NotSerialized) 219 { 220 ^HKEY.RHK (0x06) 221 } 222 223 Method (_Q17, 0, NotSerialized) 224 { 225 ^HKEY.RHK (0x08) 226 } 227 228 Method (_Q66, 0, NotSerialized) 229 { 230 ^HKEY.RHK (0x0A) 231 } 232 233 Method (_Q6A, 0, NotSerialized) 234 { 235 ^HKEY.RHK (0x1B) 236 } 237 238 Method (_Q1A, 0, NotSerialized) 239 { 240 ^HKEY.RHK (0x0B) 241 } 242 243 Method (_Q1B, 0, NotSerialized) 244 { 245 ^HKEY.RHK (0x0C) 246 } 247 248 Method (_Q62, 0, NotSerialized) 249 { 250 ^HKEY.RHK (0x0D) 251 } 252 253 Method (_Q60, 0, NotSerialized) 254 { 255 ^HKEY.RHK (0x0E) 256 } 257 258 Method (_Q61, 0, NotSerialized) 259 { 260 ^HKEY.RHK (0x0F) 261 } 262 263 Method (_Q1F, 0, NotSerialized) 264 { 265 ^HKEY.RHK (0x12) 266 } 267 268 Method (_Q67, 0, NotSerialized) 269 { 270 ^HKEY.RHK (0x13) 271 } 272 273 Method (_Q63, 0, NotSerialized) 274 { 275 ^HKEY.RHK (0x14) 276 } 277 278 Method (_Q19, 0, NotSerialized) 279 { 280 ^HKEY.RHK (0x18) 281 } 282 283 Method (_Q1C, 0, NotSerialized) 284 { 285 ^HKEY.RHK (0x19) 286 } 287 288 Method (_Q1D, 0, NotSerialized) 289 { 290 ^HKEY.RHK (0x1A) 291 } 292 293 Method (_Q5C, 0, NotSerialized) 294 { 295 ^HKEY.RTAB (0xB) 296 } 297 298 Method (_Q5D, 0, NotSerialized) 299 { 300 ^HKEY.RTAB (0xC) 301 } 302 303 Method (_Q5E, 0, NotSerialized) 304 { 305 ^HKEY.RTAB (0x9) 306 } 307 308 Method (_Q5F, 0, NotSerialized) 309 { 310 ^HKEY.RTAB (0xA) 311 } 312 313 /* 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) { 321 FAND = 1 322 FANA = 0 323 } Else { 324 FAND = 0 325 FANA = 1 326 } 327 } 328 329#include "ac.asl" 330#include "battery.asl" 331#include "sleepbutton.asl" 332#include "lid.asl" 333#include "beep.asl" 334#include "thermal.asl" 335#include "systemstatus.asl" 336#include "thinkpad.asl" 337} 338