blob: 73eee52deb6d8f1af59d64ce51b135bc1ca755e9 [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Patrick Rudolphf81f62a2017-11-14 18:48:13 +01002
3Device (HKEY)
4{
5 /* Generated by ssdt.c */
6 External (\HBDC, IntObj)
Patrick Rudolph60eca532017-08-13 12:55:41 +02007 External (\HWAN, IntObj)
Patrick Rudolph6b7178a2017-08-14 17:46:58 +02008 External (\HKBL, IntObj)
Patrick Rudolphf281b6d2017-08-14 18:41:32 +02009 External (\HUWB, IntObj)
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010010
Da Lao56f5cc72020-04-05 00:23:09 +080011 Name (_HID, EisaId (CONFIG_THINKPADEC_HKEY_EISAID))
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010012
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 {
Felix Singerf45a6c22022-12-12 04:54:01 +010037 Local0 = BTN
Felix Singercc039512022-01-02 02:49:59 +010038 If (Local0 != 0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010039 BTN = Zero
Felix Singera2ad07d2021-12-30 01:46:55 +010040 Local0 += 0x1000
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010041 Return (Local0)
42 }
Felix Singerf45a6c22022-12-12 04:54:01 +010043 Local0 = BTAB
Felix Singercc039512022-01-02 02:49:59 +010044 If (Local0 != 0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010045 BTAB = Zero
Felix Singera2ad07d2021-12-30 01:46:55 +010046 Local0 += 0x5000
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010047 Return (Local0)
48 }
49 Return (Zero)
50 }
51
52 /* Report event */
53 Method (RHK, 1, NotSerialized) {
Felix Singerca4b5872022-12-26 08:17:06 +010054 Local0 = 1 << (Arg0 - 1)
Felix Singer9a351fb2022-01-03 19:30:43 +010055 If (EMSK & Local0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010056 BTN = Arg0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010057 Notify (HKEY, 0x80)
58 }
59 }
60
61 /* Report tablet */
62 Method (RTAB, 1, NotSerialized) {
Felix Singerca4b5872022-12-26 08:17:06 +010063 Local0 = 1 << (Arg0 - 1)
Felix Singer9a351fb2022-01-03 19:30:43 +010064 If (ETAB & Local0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010065 BTAB = Arg0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010066 Notify (HKEY, 0x80)
67 }
68 }
69
70 /* Enable/disable all events. */
71 Method (MHKC, 1, NotSerialized) {
72 If (Arg0) {
Felix Singerf45a6c22022-12-12 04:54:01 +010073 EMSK = DHKN
74 ETAB = Ones
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010075 }
76 Else
77 {
Felix Singerf45a6c22022-12-12 04:54:01 +010078 EMSK = Zero
79 ETAB = Zero
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010080 }
Felix Singerf45a6c22022-12-12 04:54:01 +010081 EN = Arg0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010082 }
83
84 /* Enable/disable event. */
85 Method (MHKM, 2, NotSerialized) {
Felix Singer9fa818d2022-01-02 03:55:28 +010086 If (Arg0 <= 0x20) {
Felix Singerca4b5872022-12-26 08:17:06 +010087 Local0 = 1 << (Arg0 - 1)
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010088 If (Arg1)
89 {
Felix Singer86bc2e72022-12-16 04:40:39 +010090 DHKN |= Local0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010091 }
92 Else
93 {
Felix Singer1538d152022-08-03 01:31:30 +020094 DHKN = DHKN & ~Local0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010095 }
96 If (EN)
97 {
Felix Singerf45a6c22022-12-12 04:54:01 +010098 EMSK = DHKN
Patrick Rudolphf81f62a2017-11-14 18:48:13 +010099 }
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 {
Felix Singer372573e2022-12-16 03:49:55 +0100112 Return (TBSW << 3)
Patrick Rudolphf81f62a2017-11-14 18:48:13 +0100113 }
114
115 /* Mute audio */
116 Method (SSMS, 1, NotSerialized)
117 {
Felix Singerf45a6c22022-12-12 04:54:01 +0100118 ALMT = Arg0
Patrick Rudolphf81f62a2017-11-14 18:48:13 +0100119 }
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 }
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100145
Patrick Rudolphdbf5a5d2018-07-29 08:08:33 +0200146 /* Set to one on first boot */
147 Name (INIT, 0)
148
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100149 /* Has thinkpad_acpi module loaded */
150 Name (HAST, 0)
151
152 /* State after sleep */
153 Name (WBDC, 0)
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100154 /*
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 {
Felix Singerca4b5872022-12-26 08:17:06 +0100162 HAST = 1
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100163
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100164 If (HBDC) {
Felix Singerca4b5872022-12-26 08:17:06 +0100165 Local0 = 1
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100166 If(\_SB.PCI0.LPCB.EC.BTEB)
167 {
Felix Singer86bc2e72022-12-16 04:40:39 +0100168 Local0 |= 2
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100169 }
Felix Singer86bc2e72022-12-16 04:40:39 +0100170 Local0 |= WBDC << 2
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100171 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 {
Felix Singerca4b5872022-12-26 08:17:06 +0100184 HAST = 1
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100185
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100186 If (HBDC) {
Felix Singer034920c2022-12-16 02:25:30 +0100187 Local0 = (Arg0 & 2) >> 1
Felix Singerf45a6c22022-12-12 04:54:01 +0100188 \_SB.PCI0.LPCB.EC.BTEB = Local0
Felix Singer034920c2022-12-16 02:25:30 +0100189 Local0 = (Arg0 & 4) >> 2
Felix Singerf45a6c22022-12-12 04:54:01 +0100190 WBDC = Local0
Patrick Rudolphf1114d82017-11-14 19:00:20 +0100191 }
192 }
Patrick Rudolph60eca532017-08-13 12:55:41 +0200193
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100194 /* State after sleep */
195 Name (WWAN, 0)
Patrick Rudolph60eca532017-08-13 12:55:41 +0200196 /*
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 {
Felix Singerca4b5872022-12-26 08:17:06 +0100204 HAST = 1
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100205
Patrick Rudolph60eca532017-08-13 12:55:41 +0200206 If (HWAN) {
Felix Singerca4b5872022-12-26 08:17:06 +0100207 Local0 = 1
Patrick Rudolph60eca532017-08-13 12:55:41 +0200208 If(\_SB.PCI0.LPCB.EC.WWEB)
209 {
Felix Singer86bc2e72022-12-16 04:40:39 +0100210 Local0 |= 2
Patrick Rudolph60eca532017-08-13 12:55:41 +0200211 }
Felix Singer86bc2e72022-12-16 04:40:39 +0100212 Local0 |= WWAN << 2
Patrick Rudolph60eca532017-08-13 12:55:41 +0200213 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 {
Felix Singerca4b5872022-12-26 08:17:06 +0100226 HAST = 1
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100227
Patrick Rudolph60eca532017-08-13 12:55:41 +0200228 If (HWAN) {
Felix Singer034920c2022-12-16 02:25:30 +0100229 Local0 = (Arg0 & 2) >> 1
Felix Singerf45a6c22022-12-12 04:54:01 +0100230 \_SB.PCI0.LPCB.EC.WWEB = Local0
Felix Singer034920c2022-12-16 02:25:30 +0100231 WWAN = (Arg0 & 4) >> 2
Patrick Rudolph60eca532017-08-13 12:55:41 +0200232 }
233 }
Patrick Rudolph6b7178a2017-08-14 17:46:58 +0200234
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) {
Felix Singerf45a6c22022-12-12 04:54:01 +0100244 Local0 = 0x200
Patrick Rudolph6b7178a2017-08-14 17:46:58 +0200245 /* FIXME: Support 2bit brightness control */
Felix Singer86bc2e72022-12-16 04:40:39 +0100246 Local0 |= \_SB.PCI0.LPCB.EC.KBLT
Patrick Rudolph6b7178a2017-08-14 17:46:58 +0200247 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 */
Felix Singerf45a6c22022-12-12 04:54:01 +0100261 \_SB.PCI0.LPCB.EC.WWEB = Arg0 & 1
Patrick Rudolph6b7178a2017-08-14 17:46:58 +0200262 }
263 }
Patrick Rudolphf281b6d2017-08-14 18:41:32 +0200264
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) {
Felix Singerca4b5872022-12-26 08:17:06 +0100273 Local0 = 1
Patrick Rudolphf281b6d2017-08-14 18:41:32 +0200274 If(\_SB.PCI0.LPCB.EC.UWBE)
275 {
Felix Singer86bc2e72022-12-16 04:40:39 +0100276 Local0 |= 2
Patrick Rudolphf281b6d2017-08-14 18:41:32 +0200277 }
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) {
Felix Singer034920c2022-12-16 02:25:30 +0100291 Local0 = (Arg0 & 2) >> 1
Felix Singerf45a6c22022-12-12 04:54:01 +0100292 \_SB.PCI0.LPCB.EC.UWBE = Local0
Patrick Rudolphf281b6d2017-08-14 18:41:32 +0200293 }
294 }
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100295
296 /*
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100297 * Called from _WAK
298 */
299 Method (WAKE, 1)
300 {
301 If (HAST) {
Felix Singerf45a6c22022-12-12 04:54:01 +0100302 \_SB.PCI0.LPCB.EC.BTEB = WBDC
303 \_SB.PCI0.LPCB.EC.WWEB = WWAN
Patrick Rudolph31fb8462017-11-08 19:52:51 +0100304 }
305 }
Alexey Kharlamov93d6ba02018-01-09 00:50:06 +0300306
Peter Lemenkovb4703612022-05-02 17:47:35 +0200307 #if CONFIG(H8_HAS_BAT_THRESHOLDS_IMPL)
Alexey Kharlamov93d6ba02018-01-09 00:50:06 +0300308 #include "thinkpad_bat_thresholds.asl"
309 #endif
Patrick Rudolphf81f62a2017-11-14 18:48:13 +0100310}