Angel Pons | af4ecc2 | 2020-04-05 13:21:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 2 | |
Arthur Heymans | f7d1c8d | 2018-11-28 12:22:59 +0100 | [diff] [blame] | 3 | /* Generated by acpigen */ |
| 4 | External (\PPKG, MethodObj) |
| 5 | |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 6 | #include "../thermal.h" |
| 7 | |
| 8 | // Thermal Zone |
| 9 | |
Martin Roth | a50b1f9 | 2018-05-06 18:13:19 -0500 | [diff] [blame] | 10 | #define HAVE_THERMALZONE |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 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 |
Felix Singer | fc12747 | 2022-01-01 23:49:26 +0100 | [diff] [blame] | 27 | Local0 = Arg0 * 10 |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 28 | |
| 29 | // Convert to Kelvin |
Felix Singer | fe62d69 | 2021-12-30 01:35:49 +0100 | [diff] [blame] | 30 | Local0 += 2732 |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 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 | // Start fan at state 4 = lowest temp state |
| 54 | Method (_INI) |
| 55 | { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 56 | \FLVL = 4 |
| 57 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 58 | Notify (\_TZ.THRM, 0x81) |
| 59 | } |
| 60 | |
| 61 | Method (TCHK, 0, Serialized) |
| 62 | { |
| 63 | // Get CPU Temperature from PECI via SuperIO TMPIN3 |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 64 | Local0 = \_SB.PCI0.LPCB.SIO.ENVC.TIN3 |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 65 | |
| 66 | // Check for "no reading available |
Felix Singer | b6cbda2 | 2022-12-11 22:49:56 +0100 | [diff] [blame] | 67 | If (Local0 == 0x80) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 68 | Return (CTOK (FAN0_THRESHOLD_ON)) |
| 69 | } |
| 70 | |
| 71 | // Check for invalid readings |
Felix Singer | b6cbda2 | 2022-12-11 22:49:56 +0100 | [diff] [blame] | 72 | If (Local0 == 255 || Local0 == 0) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 73 | Return (CTOK (FAN0_THRESHOLD_ON)) |
| 74 | } |
| 75 | |
| 76 | // PECI raw value is an offset from Tj_max |
Felix Singer | 931a1ce | 2021-12-29 23:36:13 +0100 | [diff] [blame] | 77 | Local1 = 255 - Local0 |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 78 | |
| 79 | // Handle values greater than Tj_max |
Felix Singer | 6c84832 | 2022-01-02 02:28:21 +0100 | [diff] [blame] | 80 | If (Local1 >= \TMAX) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 81 | Return (CTOK (\TMAX)) |
| 82 | } |
| 83 | |
| 84 | // Subtract from Tj_max to get temperature |
Felix Singer | 931a1ce | 2021-12-29 23:36:13 +0100 | [diff] [blame] | 85 | Local0 = \TMAX - Local1 |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 86 | Return (CTOK (Local0)) |
| 87 | } |
| 88 | |
| 89 | Method (_TMP, 0, Serialized) |
| 90 | { |
| 91 | // Get temperature from SuperIO in deci-kelvin |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 92 | Local0 = TCHK () |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 93 | |
| 94 | // Critical temperature in deci-kelvin |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 95 | Local1 = CTOK (\TMAX) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 96 | |
Felix Singer | 6c84832 | 2022-01-02 02:28:21 +0100 | [diff] [blame] | 97 | If (Local0 >= Local1) { |
Felix Singer | 34dde85 | 2021-12-28 17:16:12 +0100 | [diff] [blame] | 98 | Printf ("CRITICAL TEMPERATURE: %o", Local0) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 99 | |
| 100 | // Wait 1 second for SuperIO to re-poll |
| 101 | Sleep (1000) |
| 102 | |
| 103 | // Re-read temperature from SuperIO |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 104 | Local0 = TCHK () |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 105 | |
Felix Singer | 34dde85 | 2021-12-28 17:16:12 +0100 | [diff] [blame] | 106 | Printf ("RE-READ TEMPERATURE: %o", Local0) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | Return (Local0) |
| 110 | } |
| 111 | |
| 112 | Method (_AC0) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 113 | If (\FLVL <= 0) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 114 | Return (CTOK (FAN0_THRESHOLD_OFF)) |
| 115 | } Else { |
| 116 | Return (CTOK (FAN0_THRESHOLD_ON)) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | Method (_AC1) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 121 | If (\FLVL <= 1) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 122 | Return (CTOK (FAN1_THRESHOLD_OFF)) |
| 123 | } Else { |
| 124 | Return (CTOK (FAN1_THRESHOLD_ON)) |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | Method (_AC2) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 129 | If (\FLVL <= 2) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 130 | Return (CTOK (FAN2_THRESHOLD_OFF)) |
| 131 | } Else { |
| 132 | Return (CTOK (FAN2_THRESHOLD_ON)) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | Method (_AC3) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 137 | If (\FLVL <= 3) { |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 138 | Return (CTOK (FAN3_THRESHOLD_OFF)) |
| 139 | } Else { |
| 140 | Return (CTOK (FAN3_THRESHOLD_ON)) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | Method (_AC4) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 145 | If (\FLVL <= 4) { |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 146 | Return (CTOK (0)) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 147 | } Else { |
Matt DeVillier | 0148fcb | 2016-12-17 17:13:23 -0600 | [diff] [blame] | 148 | Return (CTOK (0)) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 149 | } |
| 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 Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 161 | If (\FLVL <= 0) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 162 | Return (1) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 163 | } Else { |
| 164 | Return (Zero) |
| 165 | } |
| 166 | } |
| 167 | Method (_ON) { |
Felix Singer | 6af4200 | 2021-12-31 14:41:37 +0100 | [diff] [blame] | 168 | If (! _STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 169 | \FLVL = 0 |
| 170 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN0_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 171 | Notify (\_TZ.THRM, 0x81) |
| 172 | } |
| 173 | } |
| 174 | Method (_OFF) { |
| 175 | If (_STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 176 | \FLVL = 1 |
| 177 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN1_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 178 | Notify (\_TZ.THRM, 0x81) |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | PowerResource (FNP1, 0, 0) |
| 184 | { |
| 185 | Method (_STA) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 186 | If (\FLVL <= 1) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 187 | Return (1) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 188 | } Else { |
| 189 | Return (Zero) |
| 190 | } |
| 191 | } |
| 192 | Method (_ON) { |
Felix Singer | 6af4200 | 2021-12-31 14:41:37 +0100 | [diff] [blame] | 193 | If (! _STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 194 | \FLVL = 1 |
| 195 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN1_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 196 | Notify (\_TZ.THRM, 0x81) |
| 197 | } |
| 198 | } |
| 199 | Method (_OFF) { |
| 200 | If (_STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 201 | \FLVL = 2 |
| 202 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN2_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 203 | Notify (\_TZ.THRM, 0x81) |
| 204 | } |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | PowerResource (FNP2, 0, 0) |
| 209 | { |
| 210 | Method (_STA) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 211 | If (\FLVL <= 2) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 212 | Return (1) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 213 | } Else { |
| 214 | Return (Zero) |
| 215 | } |
| 216 | } |
| 217 | Method (_ON) { |
Felix Singer | 6af4200 | 2021-12-31 14:41:37 +0100 | [diff] [blame] | 218 | If (! _STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 219 | \FLVL = 2 |
| 220 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN2_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 221 | Notify (\_TZ.THRM, 0x81) |
| 222 | } |
| 223 | } |
| 224 | Method (_OFF) { |
| 225 | If (_STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 226 | \FLVL = 3 |
| 227 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN3_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 228 | Notify (\_TZ.THRM, 0x81) |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | PowerResource (FNP3, 0, 0) |
| 234 | { |
| 235 | Method (_STA) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 236 | If (\FLVL <= 3) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 237 | Return (1) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 238 | } Else { |
| 239 | Return (Zero) |
| 240 | } |
| 241 | } |
| 242 | Method (_ON) { |
Felix Singer | 6af4200 | 2021-12-31 14:41:37 +0100 | [diff] [blame] | 243 | If (! _STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 244 | \FLVL = 3 |
| 245 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN3_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 246 | Notify (\_TZ.THRM, 0x81) |
| 247 | } |
| 248 | } |
| 249 | Method (_OFF) { |
| 250 | If (_STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 251 | \FLVL = 4 |
| 252 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 253 | Notify (\_TZ.THRM, 0x81) |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | PowerResource (FNP4, 0, 0) |
| 259 | { |
| 260 | Method (_STA) { |
Felix Singer | 9a37ae6 | 2022-12-12 00:21:53 +0100 | [diff] [blame] | 261 | If (\FLVL <= 4) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 262 | Return (1) |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 263 | } Else { |
| 264 | Return (Zero) |
| 265 | } |
| 266 | } |
| 267 | Method (_ON) { |
Felix Singer | 6af4200 | 2021-12-31 14:41:37 +0100 | [diff] [blame] | 268 | If (! _STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 269 | \FLVL = 4 |
| 270 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 271 | Notify (\_TZ.THRM, 0x81) |
| 272 | } |
| 273 | } |
| 274 | Method (_OFF) { |
| 275 | If (_STA ()) { |
Felix Singer | 69b48d8 | 2022-12-12 05:00:01 +0100 | [diff] [blame] | 276 | \FLVL = 4 |
| 277 | \_SB.PCI0.LPCB.SIO.ENVC.F2PS = FAN4_PWM |
Matt DeVillier | 8e6b0a2 | 2015-11-03 23:20:10 -0600 | [diff] [blame] | 278 | 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 | } |