blob: d4957f44a41ffe204f0139ecdade85411362931c [file] [log] [blame]
Angel Ponsaf4ecc22020-04-05 13:21:45 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Matt DeVillier8e6b0a22015-11-03 23:20:10 -06002
Arthur Heymansf7d1c8d2018-11-28 12:22:59 +01003/* Generated by acpigen */
4External (\PPKG, MethodObj)
5
Matt DeVillier8e6b0a22015-11-03 23:20:10 -06006#include "../thermal.h"
7
8// Thermal Zone
9
Martin Rotha50b1f92018-05-06 18:13:19 -050010#define HAVE_THERMALZONE
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060011Scope (\_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
Felix Singerfc127472022-01-01 23:49:26 +010027 Local0 = Arg0 * 10
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060028
29 // Convert to Kelvin
Felix Singerfe62d692021-12-30 01:35:49 +010030 Local0 += 2732
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060031
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 // Start fan at state 4 = lowest temp state
54 Method (_INI)
55 {
Felix Singer69b48d82022-12-12 05:00:01 +010056 \FLVL = 4
57 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060058 Notify (\_TZ.THRM, 0x81)
59 }
60
61 Method (TCHK, 0, Serialized)
62 {
63 // Get CPU Temperature from PECI via SuperIO TMPIN3
Felix Singer69b48d82022-12-12 05:00:01 +010064 Local0 = \_SB.PCI0.LPCB.SIO.ENVC.TIN3
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060065
66 // Check for "no reading available
Felix Singerb6cbda22022-12-11 22:49:56 +010067 If (Local0 == 0x80) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060068 Return (CTOK (FAN0_THRESHOLD_ON))
69 }
70
71 // Check for invalid readings
Felix Singerb6cbda22022-12-11 22:49:56 +010072 If (Local0 == 255 || Local0 == 0) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060073 Return (CTOK (FAN0_THRESHOLD_ON))
74 }
75
76 // PECI raw value is an offset from Tj_max
Felix Singer931a1ce2021-12-29 23:36:13 +010077 Local1 = 255 - Local0
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060078
79 // Handle values greater than Tj_max
Felix Singer6c848322022-01-02 02:28:21 +010080 If (Local1 >= \TMAX) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060081 Return (CTOK (\TMAX))
82 }
83
84 // Subtract from Tj_max to get temperature
Felix Singer931a1ce2021-12-29 23:36:13 +010085 Local0 = \TMAX - Local1
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060086 Return (CTOK (Local0))
87 }
88
89 Method (_TMP, 0, Serialized)
90 {
91 // Get temperature from SuperIO in deci-kelvin
Felix Singer69b48d82022-12-12 05:00:01 +010092 Local0 = TCHK ()
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060093
94 // Critical temperature in deci-kelvin
Felix Singer69b48d82022-12-12 05:00:01 +010095 Local1 = CTOK (\TMAX)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060096
Felix Singer6c848322022-01-02 02:28:21 +010097 If (Local0 >= Local1) {
Felix Singer34dde852021-12-28 17:16:12 +010098 Printf ("CRITICAL TEMPERATURE: %o", Local0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -060099
100 // Wait 1 second for SuperIO to re-poll
101 Sleep (1000)
102
103 // Re-read temperature from SuperIO
Felix Singer69b48d82022-12-12 05:00:01 +0100104 Local0 = TCHK ()
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600105
Felix Singer34dde852021-12-28 17:16:12 +0100106 Printf ("RE-READ TEMPERATURE: %o", Local0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600107 }
108
109 Return (Local0)
110 }
111
112 Method (_AC0) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100113 If (\FLVL <= 0) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600114 Return (CTOK (FAN0_THRESHOLD_OFF))
115 } Else {
116 Return (CTOK (FAN0_THRESHOLD_ON))
117 }
118 }
119
120 Method (_AC1) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100121 If (\FLVL <= 1) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600122 Return (CTOK (FAN1_THRESHOLD_OFF))
123 } Else {
124 Return (CTOK (FAN1_THRESHOLD_ON))
125 }
126 }
127
128 Method (_AC2) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100129 If (\FLVL <= 2) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600130 Return (CTOK (FAN2_THRESHOLD_OFF))
131 } Else {
132 Return (CTOK (FAN2_THRESHOLD_ON))
133 }
134 }
135
136 Method (_AC3) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100137 If (\FLVL <= 3) {
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600138 Return (CTOK (FAN3_THRESHOLD_OFF))
139 } Else {
140 Return (CTOK (FAN3_THRESHOLD_ON))
141 }
142 }
143
144 Method (_AC4) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100145 If (\FLVL <= 4) {
Matt DeVillier0148fcb2016-12-17 17:13:23 -0600146 Return (CTOK (0))
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600147 } Else {
Matt DeVillier0148fcb2016-12-17 17:13:23 -0600148 Return (CTOK (0))
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600149 }
150 }
151
152 Name (_AL0, Package () { FAN0 })
153 Name (_AL1, Package () { FAN1 })
154 Name (_AL2, Package () { FAN2 })
155 Name (_AL3, Package () { FAN3 })
156 Name (_AL4, Package () { FAN4 })
157
158 PowerResource (FNP0, 0, 0)
159 {
160 Method (_STA) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100161 If (\FLVL <= 0) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100162 Return (1)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600163 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100164 Return (0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600165 }
166 }
167 Method (_ON) {
Felix Singer6af42002021-12-31 14:41:37 +0100168 If (! _STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100169 \FLVL = 0
170 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN0_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600171 Notify (\_TZ.THRM, 0x81)
172 }
173 }
174 Method (_OFF) {
175 If (_STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100176 \FLVL = 1
177 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN1_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600178 Notify (\_TZ.THRM, 0x81)
179 }
180 }
181 }
182
183 PowerResource (FNP1, 0, 0)
184 {
185 Method (_STA) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100186 If (\FLVL <= 1) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100187 Return (1)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600188 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100189 Return (0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600190 }
191 }
192 Method (_ON) {
Felix Singer6af42002021-12-31 14:41:37 +0100193 If (! _STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100194 \FLVL = 1
195 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN1_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600196 Notify (\_TZ.THRM, 0x81)
197 }
198 }
199 Method (_OFF) {
200 If (_STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100201 \FLVL = 2
202 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN2_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600203 Notify (\_TZ.THRM, 0x81)
204 }
205 }
206 }
207
208 PowerResource (FNP2, 0, 0)
209 {
210 Method (_STA) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100211 If (\FLVL <= 2) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100212 Return (1)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600213 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100214 Return (0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600215 }
216 }
217 Method (_ON) {
Felix Singer6af42002021-12-31 14:41:37 +0100218 If (! _STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100219 \FLVL = 2
220 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN2_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600221 Notify (\_TZ.THRM, 0x81)
222 }
223 }
224 Method (_OFF) {
225 If (_STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100226 \FLVL = 3
227 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN3_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600228 Notify (\_TZ.THRM, 0x81)
229 }
230 }
231 }
232
233 PowerResource (FNP3, 0, 0)
234 {
235 Method (_STA) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100236 If (\FLVL <= 3) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100237 Return (1)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600238 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100239 Return (0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600240 }
241 }
242 Method (_ON) {
Felix Singer6af42002021-12-31 14:41:37 +0100243 If (! _STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100244 \FLVL = 3
245 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN3_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600246 Notify (\_TZ.THRM, 0x81)
247 }
248 }
249 Method (_OFF) {
250 If (_STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100251 \FLVL = 4
252 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600253 Notify (\_TZ.THRM, 0x81)
254 }
255 }
256 }
257
258 PowerResource (FNP4, 0, 0)
259 {
260 Method (_STA) {
Felix Singer9a37ae62022-12-12 00:21:53 +0100261 If (\FLVL <= 4) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100262 Return (1)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600263 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100264 Return (0)
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600265 }
266 }
267 Method (_ON) {
Felix Singer6af42002021-12-31 14:41:37 +0100268 If (! _STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100269 \FLVL = 4
270 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600271 Notify (\_TZ.THRM, 0x81)
272 }
273 }
274 Method (_OFF) {
275 If (_STA ()) {
Felix Singer69b48d82022-12-12 05:00:01 +0100276 \FLVL = 4
277 \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM
Matt DeVillier8e6b0a22015-11-03 23:20:10 -0600278 Notify (\_TZ.THRM, 0x81)
279 }
280 }
281 }
282
283 Device (FAN0)
284 {
285 Name (_HID, EISAID ("PNP0C0B"))
286 Name (_UID, 0)
287 Name (_PR0, Package () { FNP0 })
288 }
289
290 Device (FAN1)
291 {
292 Name (_HID, EISAID ("PNP0C0B"))
293 Name (_UID, 1)
294 Name (_PR0, Package () { FNP1 })
295 }
296
297 Device (FAN2)
298 {
299 Name (_HID, EISAID ("PNP0C0B"))
300 Name (_UID, 2)
301 Name (_PR0, Package () { FNP2 })
302 }
303
304 Device (FAN3)
305 {
306 Name (_HID, EISAID ("PNP0C0B"))
307 Name (_UID, 3)
308 Name (_PR0, Package () { FNP3 })
309 }
310
311 Device (FAN4)
312 {
313 Name (_HID, EISAID ("PNP0C0B"))
314 Name (_UID, 4)
315 Name (_PR0, Package () { FNP4 })
316 }
317 }
318}