1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* Thermal Threshold Event Handler */
4 #define HAVE_THERM_EVENT_HANDLER
6 #if CONFIG(EC_SUPPORTS_DPTF_TEVT)
7 Method (TEVT, 1, NotSerialized)
9 Local0 = ToInteger (Arg0)
11 #ifdef DPTF_TSR0_SENSOR_ID
12 If (Local0 == DPTF_TSR0_SENSOR_ID) {
16 #ifdef DPTF_TSR1_SENSOR_ID
17 If (Local0 == DPTF_TSR1_SENSOR_ID) {
21 #ifdef DPTF_TSR2_SENSOR_ID
22 If (Local0 == DPTF_TSR2_SENSOR_ID) {
26 #ifdef DPTF_TSR3_SENSOR_ID
27 If (Local0 == DPTF_TSR3_SENSOR_ID) {
34 /* Thermal device initialization - Disable Aux Trip Points */
37 #ifdef DPTF_TSR0_SENSOR_ID
40 #ifdef DPTF_TSR1_SENSOR_ID
43 #ifdef DPTF_TSR2_SENSOR_ID
46 #ifdef DPTF_TSR3_SENSOR_ID
51 /* Thermal Trip Points Change Event Handler */
54 #ifdef DPTF_TSR0_SENSOR_ID
57 #ifdef DPTF_TSR1_SENSOR_ID
60 #ifdef DPTF_TSR2_SENSOR_ID
63 #ifdef DPTF_TSR3_SENSOR_ID
68 #ifndef EC_ENABLE_MULTIPLE_DPTF_PROFILES
69 External (\_SB.PCI0.LPCB.EC0.RCDP, MethodObj)
73 * Method to return trip temperature value depending upon the device mode.
74 * Arg0 --> Value to return when device is in tablet mode
75 * Arg1 --> Value to return when device is not in tablet mode.
77 Method (DTRP, 2, Serialized)
79 If (CondRefOf (\_SB.PCI0.LPCB.EC0.RCDP)) {
80 If (\_SB.PCI0.LPCB.EC0.RCDP == 1) {
87 #ifdef DPTF_TSR0_SENSOR_ID
89 #ifndef DPTF_TSR0_TABLET_PASSIVE
90 #define DPTF_TSR0_TABLET_PASSIVE DPTF_TSR0_PASSIVE
92 #ifndef DPTF_TSR0_TABLET_CRITICAL
93 #define DPTF_TSR0_TABLET_CRITICAL DPTF_TSR0_CRITICAL
98 Name (_HID, DPTF_GEN_DEVICE)
102 Name (TMPI, DPTF_TSR0_SENSOR_ID)
103 Name (_STR, Unicode (DPTF_TSR0_SENSOR_NAME))
104 Name (GTSH, 20) /* 2 degree hysteresis */
115 Method (_TMP, 0, Serialized)
117 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
122 Return (DTRP (DPTF_TSR0_TABLET_PASSIVE, DPTF_TSR0_PASSIVE))
127 Return (DTRP (DPTF_TSR0_TABLET_CRITICAL, DPTF_TSR0_CRITICAL))
132 /* Set Aux Trip Point */
133 Method (PAT0, 1, Serialized)
135 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
138 /* Set Aux Trip Point */
139 Method (PAT1, 1, Serialized)
141 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
144 /* Disable Aux Trip Point */
145 Method (PATD, 0, Serialized)
147 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
150 #ifdef DPTF_ENABLE_FAN_CONTROL
151 #ifdef DPTF_TSR0_ACTIVE_AC0
154 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC0))
157 #ifdef DPTF_TSR0_ACTIVE_AC1
160 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC1))
163 #ifdef DPTF_TSR0_ACTIVE_AC2
166 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC2))
169 #ifdef DPTF_TSR0_ACTIVE_AC3
172 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC3))
175 #ifdef DPTF_TSR0_ACTIVE_AC4
178 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC4))
181 #ifdef DPTF_TSR0_ACTIVE_AC5
184 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC5))
187 #ifdef DPTF_TSR0_ACTIVE_AC6
190 Return (\_SB.DPTF.CTOK (DPTF_TSR0_ACTIVE_AC6))
197 #ifdef DPTF_TSR1_SENSOR_ID
199 #ifndef DPTF_TSR1_TABLET_PASSIVE
200 #define DPTF_TSR1_TABLET_PASSIVE DPTF_TSR1_PASSIVE
202 #ifndef DPTF_TSR1_TABLET_CRITICAL
203 #define DPTF_TSR1_TABLET_CRITICAL DPTF_TSR1_CRITICAL
208 Name (_HID, DPTF_GEN_DEVICE)
212 Name (TMPI, DPTF_TSR1_SENSOR_ID)
213 Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME))
214 Name (GTSH, 20) /* 2 degree hysteresis */
225 Method (_TMP, 0, Serialized)
227 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
232 Return (DTRP (DPTF_TSR1_TABLET_PASSIVE, DPTF_TSR1_PASSIVE))
237 Return (DTRP (DPTF_TSR1_TABLET_CRITICAL, DPTF_TSR1_CRITICAL))
242 /* Set Aux Trip Point */
243 Method (PAT0, 1, Serialized)
245 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
248 /* Set Aux Trip Point */
249 Method (PAT1, 1, Serialized)
251 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
254 /* Disable Aux Trip Point */
255 Method (PATD, 0, Serialized)
257 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
260 #ifdef DPTF_ENABLE_FAN_CONTROL
261 #ifdef DPTF_TSR1_ACTIVE_AC0
264 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC0))
267 #ifdef DPTF_TSR1_ACTIVE_AC1
270 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC1))
273 #ifdef DPTF_TSR1_ACTIVE_AC2
276 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC2))
279 #ifdef DPTF_TSR1_ACTIVE_AC3
282 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC3))
285 #ifdef DPTF_TSR1_ACTIVE_AC4
288 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC4))
291 #ifdef DPTF_TSR1_ACTIVE_AC5
294 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC5))
297 #ifdef DPTF_TSR1_ACTIVE_AC6
300 Return (\_SB.DPTF.CTOK (DPTF_TSR1_ACTIVE_AC6))
307 #ifdef DPTF_TSR2_SENSOR_ID
309 #ifndef DPTF_TSR2_TABLET_PASSIVE
310 #define DPTF_TSR2_TABLET_PASSIVE DPTF_TSR2_PASSIVE
312 #ifndef DPTF_TSR2_TABLET_CRITICAL
313 #define DPTF_TSR2_TABLET_CRITICAL DPTF_TSR2_CRITICAL
318 Name (_HID, DPTF_GEN_DEVICE)
322 Name (TMPI, DPTF_TSR2_SENSOR_ID)
323 Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME))
324 Name (GTSH, 20) /* 2 degree hysteresis */
335 Method (_TMP, 0, Serialized)
337 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
342 Return (DTRP (DPTF_TSR2_TABLET_PASSIVE, DPTF_TSR2_PASSIVE))
347 Return (DTRP (DPTF_TSR2_TABLET_CRITICAL, DPTF_TSR2_CRITICAL))
352 /* Set Aux Trip Point */
353 Method (PAT0, 1, Serialized)
355 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
358 /* Set Aux Trip Point */
359 Method (PAT1, 1, Serialized)
361 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
364 /* Disable Aux Trip Point */
365 Method (PATD, 0, Serialized)
367 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
370 #ifdef DPTF_ENABLE_FAN_CONTROL
371 #ifdef DPTF_TSR2_ACTIVE_AC0
374 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC0))
377 #ifdef DPTF_TSR2_ACTIVE_AC1
380 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC1))
383 #ifdef DPTF_TSR2_ACTIVE_AC2
386 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC2))
389 #ifdef DPTF_TSR2_ACTIVE_AC3
392 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC3))
395 #ifdef DPTF_TSR2_ACTIVE_AC4
398 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC4))
401 #ifdef DPTF_TSR2_ACTIVE_AC5
404 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC5))
407 #ifdef DPTF_TSR2_ACTIVE_AC6
410 Return (\_SB.DPTF.CTOK (DPTF_TSR2_ACTIVE_AC6))
417 #ifdef DPTF_TSR3_SENSOR_ID
419 #ifndef DPTF_TSR3_TABLET_PASSIVE
420 #define DPTF_TSR3_TABLET_PASSIVE DPTF_TSR3_PASSIVE
422 #ifndef DPTF_TSR3_TABLET_CRITICAL
423 #define DPTF_TSR3_TABLET_CRITICAL DPTF_TSR3_CRITICAL
428 Name (_HID, DPTF_GEN_DEVICE)
432 Name (TMPI, DPTF_TSR3_SENSOR_ID)
433 Name (_STR, Unicode (DPTF_TSR3_SENSOR_NAME))
434 Name (GTSH, 20) /* 2 degree hysteresis */
445 Method (_TMP, 0, Serialized)
447 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
452 Return (DTRP (DPTF_TSR3_TABLET_PASSIVE, DPTF_TSR3_PASSIVE))
457 Return (DTRP (DPTF_TSR3_TABLET_CRITICAL, DPTF_TSR3_CRITICAL))
462 /* Set Aux Trip Point */
463 Method (PAT0, 1, Serialized)
465 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
468 /* Set Aux Trip Point */
469 Method (PAT1, 1, Serialized)
471 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
474 /* Disable Aux Trip Point */
475 Method (PATD, 0, Serialized)
477 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
480 #ifdef DPTF_ENABLE_FAN_CONTROL
481 #ifdef DPTF_TSR3_ACTIVE_AC0
484 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC0))
487 #ifdef DPTF_TSR3_ACTIVE_AC1
490 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC1))
493 #ifdef DPTF_TSR3_ACTIVE_AC2
496 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC2))
499 #ifdef DPTF_TSR3_ACTIVE_AC3
502 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC3))
505 #ifdef DPTF_TSR3_ACTIVE_AC4
508 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC4))
511 #ifdef DPTF_TSR3_ACTIVE_AC5
514 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC5))
517 #ifdef DPTF_TSR3_ACTIVE_AC6
520 Return (\_SB.DPTF.CTOK (DPTF_TSR3_ACTIVE_AC6))