mb/google/fatcat: config GPP_F23 as ISH gpio pin
[coreboot2.git] / src / mainboard / google / slippy / acpi / thermal.asl
blob38baad631b16f1d10705109b9d7f31cf51159fbf
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 // Thermal Zone
5 External (\PPKG, MethodObj)
7 #define HAVE_THERMALZONE
8 Scope (\_TZ)
10         // Handler for throttle requests on this platform
11         //  0 = Stop throttling
12         //  1 = Start throttling
13         Method (THRT, 1, Serialized)
14         {
15                 If (Arg0 == 0) {
16                         /* Disable Power Limit */
17                         \_SB.PCI0.MCHC.CTLD ()
18                 } Else {
19                         /* Enable Power Limit */
20                         \_SB.PCI0.MCHC.CTLE (\F0PW)
21                 }
22         }
24         ThermalZone (THRM)
25         {
26                 Name (_TC1, 0x02)
27                 Name (_TC2, 0x05)
29                 // Thermal zone polling frequency: 10 seconds
30                 Name (_TZP, 100)
32                 // Thermal sampling period for passive cooling: 2 seconds
33                 Name (_TSP, 20)
35                 // Convert from Degrees C to 1/10 Kelvin for ACPI
36                 Method (CTOK, 1) {
37                         // 10th of Degrees C
38                         Local0 = Arg0 * 10
40                         // Convert to Kelvin
41                         Local0 += 2732
43                         Return (Local0)
44                 }
46                 // Threshold for OS to shutdown
47                 Method (_CRT, 0, Serialized)
48                 {
49                         Return (CTOK (\TCRT))
50                 }
52                 // Threshold for passive cooling
53                 Method (_PSV, 0, Serialized)
54                 {
55                         Return (CTOK (\TPSV))
56                 }
58                 // Processors used for passive cooling
59                 Method (_PSL, 0, Serialized)
60                 {
61                         Return (\PPKG ())
62                 }
64                 Method (TCHK, 0, Serialized)
65                 {
66                         // Get Temperature from TIN# set in NVS
67                         Local0 = \_SB.PCI0.LPCB.EC0.TINS (TMPS)
69                         // Check for sensor not calibrated
70                         If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) {
71                                 Return (CTOK(0))
72                         }
74                         // Check for sensor not present
75                         If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) {
76                                 Return (CTOK(0))
77                         }
79                         // Check for sensor not powered
80                         If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) {
81                                 Return (CTOK(0))
82                         }
84                         // Check for sensor bad reading
85                         If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) {
86                                 Return (CTOK(0))
87                         }
89                         // Adjust by offset to get Kelvin
90                         Local0 += \_SB.PCI0.LPCB.EC0.TOFS
92                         // Convert to 1/10 Kelvin
93                         Local0 *= 10
94                         Return (Local0)
95                 }
97                 Method (_TMP, 0, Serialized)
98                 {
99                         // Get temperature from EC in deci-kelvin
100                         Local0 = TCHK ()
102                         // Critical temperature in deci-kelvin
103                         Local1 = CTOK (\TCRT)
105                         If (Local0 >= Local1) {
106                                 Printf ("CRITICAL TEMPERATURE: %o", Local0)
108                                 // Wait 1 second for EC to re-poll
109                                 Sleep (1000)
111                                 // Re-read temperature from EC
112                                 Local0 = TCHK ()
114                                 Printf ("RE-READ TEMPERATURE: %o", Local0)
115                         }
117                         Return (Local0)
118                 }
119         }