blob: af6c41e572f4967f4029e8d65807a43ca1c4303f [file] [log] [blame]
Angel Pons60ec3652020-04-03 01:22:13 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer6651da32012-04-27 23:16:30 +02002
3// Thermal Zone
4
Arthur Heymans04008a92018-11-28 12:13:54 +01005External (\PPKG, MethodObj)
6
Martin Rotha50b1f92018-05-06 18:13:19 -05007#define HAVE_THERMALZONE
Stefan Reinauer6651da32012-04-27 23:16:30 +02008Scope (\_TZ)
9{
10 ThermalZone (THRM)
11 {
12 Name (_TC1, 0x02)
13 Name (_TC2, 0x05)
14
15 // Thermal zone polling frequency: 10 seconds
16 Name (_TZP, 100)
17
18 // Thermal sampling period for passive cooling: 2 seconds
19 Name (_TSP, 20)
20
21 // Convert from Degrees C to 1/10 Kelvin for ACPI
22 Method (CTOK, 1) {
23 // 10th of Degrees C
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020024 Local0 = Arg0 * 10
Stefan Reinauer6651da32012-04-27 23:16:30 +020025
26 // Convert to Kelvin
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020027 Local0 += 2732
Stefan Reinauer6651da32012-04-27 23:16:30 +020028
29 Return (Local0)
30 }
31
32 // Threshold for OS to shutdown
33 Method (_CRT, 0, Serialized)
34 {
35 Return (CTOK (\TCRT))
36 }
37
38 // Threshold for passive cooling
39 Method (_PSV, 0, Serialized)
40 {
41 Return (CTOK (\TPSV))
42 }
43
44 // Processors used for passive cooling
45 Method (_PSL, 0, Serialized)
46 {
47 Return (\PPKG ())
48 }
49
50 Method (_TMP, 0, Serialized)
51 {
52 // Get CPU Temperature from PECI via SuperIO TMPIN3
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020053 Local0 = \_SB.PCI0.LPCB.SIO.ENVC.TIN3
Stefan Reinauer6651da32012-04-27 23:16:30 +020054
55 // Check for invalid readings
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020056 If ((Local0 == 255) || (Local0 == 0)) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020057 Return (CTOK (\F2ON))
58 }
59
60 // PECI raw value is an offset from Tj_max
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020061 Local1 = 255 - Local0
Stefan Reinauer6651da32012-04-27 23:16:30 +020062
63 // Handle values greater than Tj_max
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020064 If (Local1 >= \TMAX) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020065 Return (CTOK (\TMAX))
66 }
67
68 // Subtract from Tj_max to get temperature
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020069 Local0 = \TMAX - Local1
Stefan Reinauer6651da32012-04-27 23:16:30 +020070 Return (CTOK (Local0))
71 }
72
73 Method (_AC0) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020074 If (\FLVL <= 0) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020075 Return (CTOK (\F0OF))
76 } Else {
77 Return (CTOK (\F0ON))
78 }
79 }
80
81 Method (_AC1) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020082 If (\FLVL <= 1) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020083 Return (CTOK (\F1OF))
84 } Else {
85 Return (CTOK (\F1ON))
86 }
87 }
88
89 Method (_AC2) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020090 If (\FLVL <= 2) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020091 Return (CTOK (\F2OF))
92 } Else {
93 Return (CTOK (\F2ON))
94 }
95 }
96
97 Method (_AC3) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +020098 If (\FLVL <= 3) {
Stefan Reinauer6651da32012-04-27 23:16:30 +020099 Return (CTOK (\F3OF))
100 } Else {
101 Return (CTOK (\F3ON))
102 }
103 }
104
105 Method (_AC4) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200106 If (\FLVL <= 4) {
Stefan Reinauer6651da32012-04-27 23:16:30 +0200107 Return (CTOK (\F4OF))
108 } Else {
109 Return (CTOK (\F4ON))
110 }
111 }
112
113 Name (_AL0, Package () { FAN0 })
114 Name (_AL1, Package () { FAN1 })
115 Name (_AL2, Package () { FAN2 })
116 Name (_AL3, Package () { FAN3 })
117 Name (_AL4, Package () { FAN4 })
118
119 PowerResource (FNP0, 0, 0)
120 {
121 Method (_STA) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200122 If (\FLVL <= 0) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100123 Return (1)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200124 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100125 Return (0)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200126 }
127 }
128 Method (_ON) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200129 \FLVL = 0
130 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F0PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200131 Notify (\_TZ.THRM, 0x81)
132 }
133 Method (_OFF) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200134 \FLVL = 1
135 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200136 Notify (\_TZ.THRM, 0x81)
137 }
138 }
139
140 PowerResource (FNP1, 0, 0)
141 {
142 Method (_STA) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200143 If (\FLVL <= 1) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100144 Return (1)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200145 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100146 Return (0)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200147 }
148 }
149 Method (_ON) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200150 \FLVL = 1
151 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200152 Notify (\_TZ.THRM, 0x81)
153 }
154 Method (_OFF) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200155 \FLVL = 2
156 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200157 Notify (\_TZ.THRM, 0x81)
158 }
159 }
160
161 PowerResource (FNP2, 0, 0)
162 {
163 Method (_STA) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200164 If (\FLVL <= 2) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100165 Return (1)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200166 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100167 Return (0)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200168 }
169 }
170 Method (_ON) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200171 \FLVL = 2
172 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200173 Notify (\_TZ.THRM, 0x81)
174 }
175 Method (_OFF) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200176 \FLVL = 3
177 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200178 Notify (\_TZ.THRM, 0x81)
179 }
180 }
181
182 PowerResource (FNP3, 0, 0)
183 {
184 Method (_STA) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200185 If (\FLVL <= 3) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100186 Return (1)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200187 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100188 Return (0)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200189 }
190 }
191 Method (_ON) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200192 \FLVL = 3
193 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200194 Notify (\_TZ.THRM, 0x81)
195 }
196 Method (_OFF) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200197 \FLVL = 4
198 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200199 Notify (\_TZ.THRM, 0x81)
200 }
201 }
202
203 PowerResource (FNP4, 0, 0)
204 {
205 Method (_STA) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200206 If (\FLVL <= 4) {
Felix Singerdfbb6342022-12-26 08:39:35 +0100207 Return (1)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200208 } Else {
Felix Singerfa06bcb2022-12-26 09:32:47 +0100209 Return (0)
Stefan Reinauer6651da32012-04-27 23:16:30 +0200210 }
211 }
212 Method (_ON) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200213 \FLVL = 4
214 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200215 Notify (\_TZ.THRM, 0x81)
216 }
217 Method (_OFF) {
Elyes HAOUAS2f1b51ac2020-10-08 09:38:36 +0200218 \FLVL = 4
219 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
Stefan Reinauer6651da32012-04-27 23:16:30 +0200220 Notify (\_TZ.THRM, 0x81)
221 }
222 }
223
224 Device (FAN0)
225 {
226 Name (_HID, EISAID ("PNP0C0B"))
227 Name (_UID, 0)
228 Name (_PR0, Package () { FNP0 })
229 }
230
231 Device (FAN1)
232 {
233 Name (_HID, EISAID ("PNP0C0B"))
234 Name (_UID, 1)
235 Name (_PR0, Package () { FNP1 })
236 }
237
238 Device (FAN2)
239 {
240 Name (_HID, EISAID ("PNP0C0B"))
241 Name (_UID, 2)
242 Name (_PR0, Package () { FNP2 })
243 }
244
245 Device (FAN3)
246 {
247 Name (_HID, EISAID ("PNP0C0B"))
248 Name (_UID, 3)
249 Name (_PR0, Package () { FNP3 })
250 }
251
252 Device (FAN4)
253 {
254 Name (_HID, EISAID ("PNP0C0B"))
255 Name (_UID, 4)
256 Name (_PR0, Package () { FNP4 })
257 }
258 }
259}