1/* SPDX-License-Identifier: GPL-2.0-only */ 2 3Device (HKEY) 4{ 5 /* Generated by ssdt.c */ 6 External (\HBDC, IntObj) 7 External (\HWAN, IntObj) 8 External (\HKBL, IntObj) 9 External (\HUWB, IntObj) 10 11 Name (_HID, EisaId (CONFIG_THINKPADEC_HKEY_EISAID)) 12 13 Name (BTN, 0) 14 15 Name (BTAB, 0) 16 17 /* MASK */ 18 Name (DHKN, 0x080C) 19 20 /* Effective Mask */ 21 Name (EMSK, 0) 22 23 /* Effective Mask for tablet */ 24 Name (ETAB, 0) 25 26 /* Device enabled. */ 27 Name (EN, 0) 28 29 Method (_STA, 0, NotSerialized) 30 { 31 Return (0x0F) 32 } 33 34 /* Retrieve event. */ 35 Method (MHKP, 0, NotSerialized) 36 { 37 Local0 = BTN 38 If (Local0 != 0) { 39 BTN = 0 40 Local0 += 0x1000 41 Return (Local0) 42 } 43 Local0 = BTAB 44 If (Local0 != 0) { 45 BTAB = 0 46 Local0 += 0x5000 47 Return (Local0) 48 } 49 Return (0) 50 } 51 52 /* Report event */ 53 Method (RHK, 1, NotSerialized) { 54 Local0 = 1 << (Arg0 - 1) 55 If (EMSK & Local0) { 56 BTN = Arg0 57 Notify (HKEY, 0x80) 58 } 59 } 60 61 /* Report tablet */ 62 Method (RTAB, 1, NotSerialized) { 63 Local0 = 1 << (Arg0 - 1) 64 If (ETAB & Local0) { 65 BTAB = Arg0 66 Notify (HKEY, 0x80) 67 } 68 } 69 70 /* Enable/disable all events. */ 71 Method (MHKC, 1, NotSerialized) { 72 If (Arg0) { 73 EMSK = DHKN 74 ETAB = Ones 75 } 76 Else 77 { 78 EMSK = 0 79 ETAB = 0 80 } 81 EN = Arg0 82 } 83 84 /* Enable/disable event. */ 85 Method (MHKM, 2, NotSerialized) { 86 If (Arg0 <= 0x20) { 87 Local0 = 1 << (Arg0 - 1) 88 If (Arg1) 89 { 90 DHKN |= Local0 91 } 92 Else 93 { 94 DHKN = DHKN & ~Local0 95 } 96 If (EN) 97 { 98 EMSK = DHKN 99 } 100 } 101 } 102 103 /* Mask hotkey all. */ 104 Method (MHKA, 0, NotSerialized) 105 { 106 Return (0x07FFFFFF) 107 } 108 109 /* Report tablet mode switch state */ 110 Method (MHKG, 0, NotSerialized) 111 { 112 Return (TBSW << 3) 113 } 114 115 /* Mute audio */ 116 Method (SSMS, 1, NotSerialized) 117 { 118 ALMT = Arg0 119 } 120 121 /* Control mute microphone LED */ 122 Method (MMTS, 1, NotSerialized) 123 { 124 If (Arg0) 125 { 126 TLED(0x8E) 127 } 128 Else 129 { 130 TLED(0x0E) 131 } 132 } 133 134 /* Version */ 135 Method (MHKV, 0, NotSerialized) 136 { 137 Return (0x0100) 138 } 139 140 /* Master wireless switch state */ 141 Method (WLSW, 0, NotSerialized) 142 { 143 Return (\_SB.PCI0.LPCB.EC.GSTS) 144 } 145 146 /* Set to one on first boot */ 147 Name (INIT, 0) 148 149 /* Has thinkpad_acpi module loaded */ 150 Name (HAST, 0) 151 152 /* State after sleep */ 153 Name (WBDC, 0) 154 /* 155 * Returns the current state: 156 * Bit 0: BT HW present 157 * Bit 1: BT radio enabled 158 * Bit 2: BT state at resume 159 */ 160 Method (GBDC, 0) 161 { 162 HAST = 1 163 164 If (HBDC) { 165 Local0 = 1 166 If(\_SB.PCI0.LPCB.EC.BTEB) 167 { 168 Local0 |= 2 169 } 170 Local0 |= WBDC << 2 171 Return (Local0) 172 } Else { 173 Return (0) 174 } 175 } 176 177 /* 178 * Set the current state: 179 * Bit 1: BT radio enabled 180 * Bit 2: BT state at resume 181 */ 182 Method (SBDC, 1) 183 { 184 HAST = 1 185 186 If (HBDC) { 187 Local0 = (Arg0 & 2) >> 1 188 \_SB.PCI0.LPCB.EC.BTEB = Local0 189 Local0 = (Arg0 & 4) >> 2 190 WBDC = Local0 191 } 192 } 193 194 /* State after sleep */ 195 Name (WWAN, 0) 196 /* 197 * Returns the current state: 198 * Bit 0: WWAN HW present 199 * Bit 1: WWAN radio enabled 200 * Bit 2: WWAN state at resume 201 */ 202 Method (GWAN, 0) 203 { 204 HAST = 1 205 206 If (HWAN) { 207 Local0 = 1 208 If(\_SB.PCI0.LPCB.EC.WWEB) 209 { 210 Local0 |= 2 211 } 212 Local0 |= WWAN << 2 213 Return (Local0) 214 } Else { 215 Return (0) 216 } 217 } 218 219 /* 220 * Set the current state: 221 * Bit 1: WWAN radio enabled 222 * Bit 2: WWAN state at resume 223 */ 224 Method (SWAN, 1) 225 { 226 HAST = 1 227 228 If (HWAN) { 229 Local0 = (Arg0 & 2) >> 1 230 \_SB.PCI0.LPCB.EC.WWEB = Local0 231 WWAN = (Arg0 & 4) >> 2 232 } 233 } 234 235 /* 236 * Argument is unused. 237 * Returns the current state: 238 * Bit 9: Backlight HW present 239 * Bit 0-1: Brightness level 240 */ 241 Method (MLCG, 1) 242 { 243 If (HKBL) { 244 Local0 = 0x200 245 /* FIXME: Support 2bit brightness control */ 246 Local0 |= \_SB.PCI0.LPCB.EC.KBLT 247 Return (Local0) 248 } Else { 249 Return (0) 250 } 251 } 252 253 /* 254 * Set the current state: 255 * Bit 0-1: Brightness level 256 */ 257 Method (MLCS, 1) 258 { 259 If (HKBL) { 260 /* FIXME: Support 2bit brightness control */ 261 \_SB.PCI0.LPCB.EC.WWEB = Arg0 & 1 262 } 263 } 264 265 /* 266 * Returns the current state: 267 * Bit 0: UWB HW present 268 * Bit 1: UWB radio enabled 269 */ 270 Method (GUWB, 0) 271 { 272 If (HUWB) { 273 Local0 = 1 274 If(\_SB.PCI0.LPCB.EC.UWBE) 275 { 276 Local0 |= 2 277 } 278 Return (Local0) 279 } Else { 280 Return (0) 281 } 282 } 283 284 /* 285 * Set the current state: 286 * Bit 1: UWB radio enabled 287 */ 288 Method (SUWB, 1) 289 { 290 If (HUWB) { 291 Local0 = (Arg0 & 2) >> 1 292 \_SB.PCI0.LPCB.EC.UWBE = Local0 293 } 294 } 295 296 /* 297 * Called from _WAK 298 */ 299 Method (WAKE, 1) 300 { 301 If (HAST) { 302 \_SB.PCI0.LPCB.EC.BTEB = WBDC 303 \_SB.PCI0.LPCB.EC.WWEB = WWAN 304 } 305 } 306 307 #if CONFIG(H8_HAS_BAT_THRESHOLDS_IMPL) 308 #include "thinkpad_bat_thresholds.asl" 309 #endif 310} 311