Debian Codegraph @

src/mainboard/google/auron/acpi/thermal.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 /* Generated by acpigen */
4 External (\PPKG, MethodObj)
5
6 #include <variant/thermal.h>
7
8 // Thermal Zone
9
10 #define HAVE_THERMALZONE
11 Scope (\_TZ)
12 {
13 ThermalZone (THRM)
14 {
15 Name (_TC1, 0x02)
16 Name (_TC2, 0x05)
17
18 // Thermal zone polling frequency: 10 seconds
19 Name (_TZP, 100)
20
21 // Thermal sampling period for passive cooling: 2 seconds
22 Name (_TSP, 20)
23
24 // Convert from Degrees C to 1/10 Kelvin for ACPI
25 Method (CTOK, 1) {
26 // 10th of Degrees C
27 Local0 = Arg0 * 10
28
29 // Convert to Kelvin
30 Local0 += 2732
31
32 Return (Local0)
33 }
34
35 // Threshold for OS to shutdown
36 Method (_CRT, 0, Serialized)
37 {
38 Return (CTOK (\TCRT))
39 }
40
41 // Threshold for passive cooling
42 Method (_PSV, 0, Serialized)
43 {
44 Return (CTOK (\TPSV))
45 }
46
47 // Processors used for passive cooling
48 Method (_PSL, 0, Serialized)
49 {
50 Return (\PPKG ())
51 }
52
53 Method (TCHK, 0, Serialized)
54 {
55 // Get Temperature from TIN# set in NVS
56 Local0 = \_SB.PCI0.LPCB.EC0.TINS (TMPS)
57
58 // Check for sensor not calibrated
59 If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) {
60 Return (CTOK(0))
61 }
62
63 // Check for sensor not present
64 If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) {
65 Return (CTOK(0))
66 }
67
68 // Check for sensor not powered
69 If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) {
70 Return (CTOK(0))
71 }
72
73 // Check for sensor bad reading
74 If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) {
75 Return (CTOK(0))
76 }
77
78 // Adjust by offset to get Kelvin
79 Local0 += \_SB.PCI0.LPCB.EC0.TOFS
80
81 // Convert to 1/10 Kelvin
82 Local0 *= 10
83 Return (Local0)
84 }
85
86 Method (_TMP, 0, Serialized)
87 {
88 // Get temperature from EC in deci-kelvin
89 Local0 = TCHK ()
90
91 // Critical temperature in deci-kelvin
92 Local1 = CTOK (\TCRT)
93
94 If (Local0 >= Local1) {
95 Printf ("CRITICAL TEMPERATURE: %o", Local0)
96
97 // Wait 1 second for EC to re-poll
98 Sleep (1000)
99
100 // Re-read temperature from EC
101 Local0 = TCHK ()
102
103 Printf ("RE-READ TEMPERATURE: %o", Local0)
104 }
105
106 Return (Local0)
107 }
108
109 /* CTDP Down */
110 Method (_AC0) {
111 If (\FLVL <= 0) {
112 Return (CTOK (CTL_TDP_THRESHOLD_OFF))
113 } Else {
114 Return (CTOK (CTL_TDP_THRESHOLD_ON))
115 }
116 }
117
118 /* CTDP Nominal */
119 Method (_AC1) {
120 If (\FLVL <= 1) {
121 Return (CTOK (CTL_TDP_THRESHILD_NORMAL))
122 } Else {
123 Return (CTOK (CTL_TDP_THRESHILD_NORMAL))
124 }
125 }
126
127 Name (_AL0, Package () { TDP0 })
128 Name (_AL1, Package () { TDP1 })
129
130 PowerResource (TNP0, 0, 0)
131 {
132 Method (_STA) {
133 If (\FLVL <= 0) {
134 Return (1)
135 } Else {
136 Return (0)
137 }
138 }
139 Method (_ON) {
140 \FLVL = 0
141
142 /* Enable Power Limit */
143 \_SB.PCI0.MCHC.CTLE (CTL_TDP_POWER_LIMIT)
144
145 Notify (\_TZ.THRM, 0x81)
146 }
147 Method (_OFF) {
148 \FLVL = 1
149
150 /* Disable Power Limit */
151 \_SB.PCI0.MCHC.CTLD ()
152
153 Notify (\_TZ.THRM, 0x81)
154 }
155 }
156
157 PowerResource (TNP1, 0, 0)
158 {
159 Method (_STA) {
160 If (\FLVL <= 1) {
161 Return (1)
162 } Else {
163 Return (0)
164 }
165 }
166 Method (_ON) {
167 \FLVL = 1
168 Notify (\_TZ.THRM, 0x81)
169 }
170 Method (_OFF) {
171 \FLVL = 1
172 Notify (\_TZ.THRM, 0x81)
173 }
174 }
175
176 Device (TDP0)
177 {
178 Name (_HID, EISAID ("PNP0C0B"))
179 Name (_UID, 0)
180 Name (_PR0, Package () { TNP0 })
181 }
182
183 Device (TDP1)
184 {
185 Name (_HID, EISAID ("PNP0C0B"))
186 Name (_UID, 1)
187 Name (_PR0, Package () { TNP1 })
188 }
189 }
190 }