blob: 4c3c8db8f2362ded3725a8ca5e2d2393cb2472d0 [file] [log] [blame]
Simon Glassca75c3f2020-09-22 12:44:49 -06001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright (C) 2014 Google Inc.
4 * Copyright (C) 2016 Intel Corporation.
5 */
6
7/* Thermal Threshold Event Handler */
8#define HAVE_THERM_EVENT_HANDLER
9Method (TEVT, 1, NotSerialized)
10{
11 Store (ToInteger (Arg0), Local0)
12
13#ifdef DPTF_TSR0_SENSOR_ID
14 If (LEqual (Local0, DPTF_TSR0_SENSOR_ID)) {
15 Notify (^TSR0, 0x90)
16 }
17#endif
18#ifdef DPTF_TSR1_SENSOR_ID
19 If (LEqual (Local0, DPTF_TSR1_SENSOR_ID)) {
20 Notify (^TSR1, 0x90)
21 }
22#endif
23#ifdef DPTF_TSR2_SENSOR_ID
24 If (LEqual (Local0, DPTF_TSR2_SENSOR_ID)) {
25 Notify (^TSR2, 0x90)
26 }
27#endif
28#ifdef DPTF_TSR3_SENSOR_ID
29 If (LEqual (Local0, DPTF_TSR3_SENSOR_ID)) {
30 Notify (^TSR3, 0x90)
31 }
32#endif
33}
34
35/* Thermal device initialization - Disable Aux Trip Points */
36Method (TINI)
37{
38#ifdef DPTF_TSR0_SENSOR_ID
39 ^TSR0.PATD ()
40#endif
41#ifdef DPTF_TSR1_SENSOR_ID
42 ^TSR1.PATD ()
43#endif
44#ifdef DPTF_TSR2_SENSOR_ID
45 ^TSR2.PATD ()
46#endif
47#ifdef DPTF_TSR3_SENSOR_ID
48 ^TSR3.PATD ()
49#endif
50}
51
52/* Thermal Trip Points Change Event Handler */
53Method (TPET)
54{
55#ifdef DPTF_TSR0_SENSOR_ID
56 Notify (^TSR0, 0x81)
57#endif
58#ifdef DPTF_TSR1_SENSOR_ID
59 Notify (^TSR1, 0x81)
60#endif
61#ifdef DPTF_TSR2_SENSOR_ID
62 Notify (^TSR2, 0x81)
63#endif
64#ifdef DPTF_TSR3_SENSOR_ID
65 Notify (^TSR3, 0x81)
66#endif
67}
68
69/*
70 * Method to return trip temperature value depending upon the device mode.
71 * Arg0 --> Value to return when device is in tablet mode
72 * Arg1 --> Value to return when device is not in tablet mode.
73 */
74Method (DTRP, 2, Serialized)
75{
76#ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES
77 If (LEqual (\_SB.PCI0.LPCB.EC0.RCDP, One)) {
78 Return (CTOK (Arg0))
79 } Else {
80#endif
81 Return (CTOK (Arg1))
82#ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES
83 }
84#endif
85}
86
87#ifdef DPTF_TSR0_SENSOR_ID
88
89#ifndef DPTF_TSR0_TABLET_PASSIVE
90#define DPTF_TSR0_TABLET_PASSIVE DPTF_TSR0_PASSIVE
91#endif
92#ifndef DPTF_TSR0_TABLET_CRITICAL
93#define DPTF_TSR0_TABLET_CRITICAL DPTF_TSR0_CRITICAL
94#endif
95
96Device (TSR0)
97{
98 Name (_HID, EISAID ("INT3403"))
99 Name (_UID, 1)
100 Name (PTYP, 0x03)
101 Name (TMPI, DPTF_TSR0_SENSOR_ID)
102 Name (_STR, Unicode (DPTF_TSR0_SENSOR_NAME))
103 Name (GTSH, 20) /* 2 degree hysteresis */
104
105 Method (_STA)
106 {
107 If (LEqual (\DPTE, One)) {
108 Return (0xF)
109 } Else {
110 Return (0x0)
111 }
112 }
113
114 Method (_TMP, 0, Serialized)
115 {
116 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
117 }
118
119 Method (_PSV)
120 {
121 Return (DTRP (DPTF_TSR0_TABLET_PASSIVE, DPTF_TSR0_PASSIVE))
122 }
123
124 Method (_CRT)
125 {
126 Return (DTRP (DPTF_TSR0_TABLET_CRITICAL, DPTF_TSR0_CRITICAL))
127 }
128
129 Name (PATC, 2)
130
131 /* Set Aux Trip Point */
132 Method (PAT0, 1, Serialized)
133 {
134 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
135 }
136
137 /* Set Aux Trip Point */
138 Method (PAT1, 1, Serialized)
139 {
140 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
141 }
142
143 /* Disable Aux Trip Point */
144 Method (PATD, 0, Serialized)
145 {
146 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
147 }
148
149#ifdef DPTF_ENABLE_FAN_CONTROL
150#ifdef DPTF_TSR0_ACTIVE_AC0
151 Method (_AC0)
152 {
153 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC0))
154 }
155#endif
156#ifdef DPTF_TSR0_ACTIVE_AC1
157 Method (_AC1)
158 {
159 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC1))
160 }
161#endif
162#ifdef DPTF_TSR0_ACTIVE_AC2
163 Method (_AC2)
164 {
165 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC2))
166 }
167#endif
168#ifdef DPTF_TSR0_ACTIVE_AC3
169 Method (_AC3)
170 {
171 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC3))
172 }
173#endif
174#ifdef DPTF_TSR0_ACTIVE_AC4
175 Method (_AC4)
176 {
177 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC4))
178 }
179#endif
180#ifdef DPTF_TSR0_ACTIVE_AC5
181 Method (_AC5)
182 {
183 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC5))
184 }
185#endif
186#ifdef DPTF_TSR0_ACTIVE_AC6
187 Method (_AC6)
188 {
189 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC6))
190 }
191#endif
192#endif
193}
194#endif
195
196#ifdef DPTF_TSR1_SENSOR_ID
197
198#ifndef DPTF_TSR1_TABLET_PASSIVE
199#define DPTF_TSR1_TABLET_PASSIVE DPTF_TSR1_PASSIVE
200#endif
201#ifndef DPTF_TSR1_TABLET_CRITICAL
202#define DPTF_TSR1_TABLET_CRITICAL DPTF_TSR1_CRITICAL
203#endif
204
205Device (TSR1)
206{
207 Name (_HID, EISAID ("INT3403"))
208 Name (_UID, 2)
209 Name (PTYP, 0x03)
210 Name (TMPI, DPTF_TSR1_SENSOR_ID)
211 Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME))
212 Name (GTSH, 20) /* 2 degree hysteresis */
213
214 Method (_STA)
215 {
216 If (LEqual (\DPTE, One)) {
217 Return (0xF)
218 } Else {
219 Return (0x0)
220 }
221 }
222
223 Method (_TMP, 0, Serialized)
224 {
225 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
226 }
227
228 Method (_PSV)
229 {
230 Return (DTRP (DPTF_TSR1_TABLET_PASSIVE, DPTF_TSR1_PASSIVE))
231 }
232
233 Method (_CRT)
234 {
235 Return (DTRP (DPTF_TSR1_TABLET_CRITICAL, DPTF_TSR1_CRITICAL))
236 }
237
238 Name (PATC, 2)
239
240 /* Set Aux Trip Point */
241 Method (PAT0, 1, Serialized)
242 {
243 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
244 }
245
246 /* Set Aux Trip Point */
247 Method (PAT1, 1, Serialized)
248 {
249 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
250 }
251
252 /* Disable Aux Trip Point */
253 Method (PATD, 0, Serialized)
254 {
255 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
256 }
257
258#ifdef DPTF_ENABLE_FAN_CONTROL
259#ifdef DPTF_TSR1_ACTIVE_AC0
260 Method (_AC0)
261 {
262 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC0))
263 }
264#endif
265#ifdef DPTF_TSR1_ACTIVE_AC1
266 Method (_AC1)
267 {
268 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC1))
269 }
270#endif
271#ifdef DPTF_TSR1_ACTIVE_AC2
272 Method (_AC2)
273 {
274 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC2))
275 }
276#endif
277#ifdef DPTF_TSR1_ACTIVE_AC3
278 Method (_AC3)
279 {
280 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC3))
281 }
282#endif
283#ifdef DPTF_TSR1_ACTIVE_AC4
284 Method (_AC4)
285 {
286 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC4))
287 }
288#endif
289#ifdef DPTF_TSR1_ACTIVE_AC5
290 Method (_AC5)
291 {
292 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC5))
293 }
294#endif
295#ifdef DPTF_TSR1_ACTIVE_AC6
296 Method (_AC6)
297 {
298 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC6))
299 }
300#endif
301#endif
302}
303#endif
304
305#ifdef DPTF_TSR2_SENSOR_ID
306
307#ifndef DPTF_TSR2_TABLET_PASSIVE
308#define DPTF_TSR2_TABLET_PASSIVE DPTF_TSR2_PASSIVE
309#endif
310#ifndef DPTF_TSR2_TABLET_CRITICAL
311#define DPTF_TSR2_TABLET_CRITICAL DPTF_TSR2_CRITICAL
312#endif
313
314Device (TSR2)
315{
316 Name (_HID, EISAID ("INT3403"))
317 Name (_UID, 3)
318 Name (PTYP, 0x03)
319 Name (TMPI, DPTF_TSR2_SENSOR_ID)
320 Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME))
321 Name (GTSH, 20) /* 2 degree hysteresis */
322
323 Method (_STA)
324 {
325 If (LEqual (\DPTE, One)) {
326 Return (0xF)
327 } Else {
328 Return (0x0)
329 }
330 }
331
332 Method (_TMP, 0, Serialized)
333 {
334 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
335 }
336
337 Method (_PSV)
338 {
339 Return (DTRP (DPTF_TSR2_TABLET_PASSIVE, DPTF_TSR2_PASSIVE))
340 }
341
342 Method (_CRT)
343 {
344 Return (DTRP (DPTF_TSR2_TABLET_CRITICAL, DPTF_TSR2_CRITICAL))
345 }
346
347 Name (PATC, 2)
348
349 /* Set Aux Trip Point */
350 Method (PAT0, 1, Serialized)
351 {
352 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
353 }
354
355 /* Set Aux Trip Point */
356 Method (PAT1, 1, Serialized)
357 {
358 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
359 }
360
361 /* Disable Aux Trip Point */
362 Method (PATD, 0, Serialized)
363 {
364 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
365 }
366
367#ifdef DPTF_ENABLE_FAN_CONTROL
368#ifdef DPTF_TSR2_ACTIVE_AC0
369 Method (_AC0)
370 {
371 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC0))
372 }
373#endif
374#ifdef DPTF_TSR2_ACTIVE_AC1
375 Method (_AC1)
376 {
377 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC1))
378 }
379#endif
380#ifdef DPTF_TSR2_ACTIVE_AC2
381 Method (_AC2)
382 {
383 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC2))
384 }
385#endif
386#ifdef DPTF_TSR2_ACTIVE_AC3
387 Method (_AC3)
388 {
389 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC3))
390 }
391#endif
392#ifdef DPTF_TSR2_ACTIVE_AC4
393 Method (_AC4)
394 {
395 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC4))
396 }
397#endif
398#ifdef DPTF_TSR2_ACTIVE_AC5
399 Method (_AC5)
400 {
401 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC5))
402 }
403#endif
404#ifdef DPTF_TSR2_ACTIVE_AC6
405 Method (_AC6)
406 {
407 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC6))
408 }
409#endif
410#endif
411}
412#endif
413
414#ifdef DPTF_TSR3_SENSOR_ID
415
416#ifndef DPTF_TSR3_TABLET_PASSIVE
417#define DPTF_TSR3_TABLET_PASSIVE DPTF_TSR3_PASSIVE
418#endif
419#ifndef DPTF_TSR3_TABLET_CRITICAL
420#define DPTF_TSR3_TABLET_CRITICAL DPTF_TSR3_CRITICAL
421#endif
422
423Device (TSR3)
424{
425 Name (_HID, EISAID ("INT3403"))
426 Name (_UID, 4)
427 Name (PTYP, 0x03)
428 Name (TMPI, DPTF_TSR3_SENSOR_ID)
429 Name (_STR, Unicode (DPTF_TSR3_SENSOR_NAME))
430 Name (GTSH, 20) /* 2 degree hysteresis */
431
432 Method (_STA)
433 {
434 If (LEqual (\DPTE, One)) {
435 Return (0xF)
436 } Else {
437 Return (0x0)
438 }
439 }
440
441 Method (_TMP, 0, Serialized)
442 {
443 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
444 }
445
446 Method (_PSV)
447 {
448 Return (DTRP (DPTF_TSR3_TABLET_PASSIVE, DPTF_TSR3_PASSIVE))
449 }
450
451 Method (_CRT)
452 {
453 Return (DTRP (DPTF_TSR3_TABLET_CRITICAL, DPTF_TSR3_CRITICAL))
454 }
455
456 Name (PATC, 2)
457
458 /* Set Aux Trip Point */
459 Method (PAT0, 1, Serialized)
460 {
461 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
462 }
463
464 /* Set Aux Trip Point */
465 Method (PAT1, 1, Serialized)
466 {
467 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
468 }
469
470 /* Disable Aux Trip Point */
471 Method (PATD, 0, Serialized)
472 {
473 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
474 }
475
476#ifdef DPTF_ENABLE_FAN_CONTROL
477#ifdef DPTF_TSR3_ACTIVE_AC0
478 Method (_AC0)
479 {
480 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC0))
481 }
482#endif
483#ifdef DPTF_TSR3_ACTIVE_AC1
484 Method (_AC1)
485 {
486 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC1))
487 }
488#endif
489#ifdef DPTF_TSR3_ACTIVE_AC2
490 Method (_AC2)
491 {
492 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC2))
493 }
494#endif
495#ifdef DPTF_TSR3_ACTIVE_AC3
496 Method (_AC3)
497 {
498 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC3))
499 }
500#endif
501#ifdef DPTF_TSR3_ACTIVE_AC4
502 Method (_AC4)
503 {
504 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC4))
505 }
506#endif
507#ifdef DPTF_TSR3_ACTIVE_AC5
508 Method (_AC5)
509 {
510 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC5))
511 }
512#endif
513#ifdef DPTF_TSR3_ACTIVE_AC6
514 Method (_AC6)
515 {
516 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC6))
517 }
518#endif
519#endif
520}
521#endif