Angel Pons | d32b6de | 2020-04-03 01:23:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 2 | |
| 3 | // Thermal Zone |
| 4 | |
Arthur Heymans | 04008a9 | 2018-11-28 12:13:54 +0100 | [diff] [blame] | 5 | External (\PPKG, MethodObj) |
| 6 | |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 7 | Scope (\_TZ) |
| 8 | { |
| 9 | ThermalZone (THRM) |
| 10 | { |
| 11 | Name (_TC1, 0x02) |
| 12 | Name (_TC2, 0x05) |
| 13 | |
| 14 | // Thermal zone polling frequency: 10 seconds |
| 15 | Name (_TZP, 100) |
| 16 | |
| 17 | // Thermal sampling period for passive cooling: 2 seconds |
| 18 | Name (_TSP, 20) |
| 19 | |
| 20 | // Convert from Degrees C to 1/10 Kelvin for ACPI |
| 21 | Method (CTOK, 1) { |
| 22 | // 10th of Degrees C |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 23 | Local0 = Arg0 * 10 |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 24 | |
| 25 | // Convert to Kelvin |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 26 | Local0 += 2732 |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 27 | |
| 28 | Return (Local0) |
| 29 | } |
| 30 | |
| 31 | // Threshold for OS to shutdown |
| 32 | Method (_CRT, 0, Serialized) |
| 33 | { |
| 34 | Return (CTOK (\TCRT)) |
| 35 | } |
| 36 | |
| 37 | // Threshold for passive cooling |
| 38 | Method (_PSV, 0, Serialized) |
| 39 | { |
| 40 | Return (CTOK (\TPSV)) |
| 41 | } |
| 42 | |
| 43 | // Processors used for passive cooling |
| 44 | Method (_PSL, 0, Serialized) |
| 45 | { |
| 46 | Return (\PPKG ()) |
| 47 | } |
| 48 | |
| 49 | Method (_TMP, 0, Serialized) |
| 50 | { |
| 51 | // Get CPU Temperature from PECI via SuperIO TMPIN3 |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 52 | Local0 = \_SB.PCI0.LPCB.SIO.ENVC.TIN3 |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 53 | |
| 54 | // Check for invalid readings |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 55 | If ((Local0 == 255) || (Local0 == 0)) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 56 | Return (CTOK (\F2ON)) |
| 57 | } |
| 58 | |
| 59 | // PECI raw value is an offset from Tj_max |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 60 | Local1 = 255 - Local0 |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 61 | |
| 62 | // Handle values greater than Tj_max |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 63 | If (Local1 >= \TMAX) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 64 | Return (CTOK (\TMAX)) |
| 65 | } |
| 66 | |
| 67 | // Subtract from Tj_max to get temperature |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 68 | Local0 = \TMAX - Local1 |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 69 | Return (CTOK (Local0)) |
| 70 | } |
| 71 | |
| 72 | Method (_AC0) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 73 | If (\FLVL <= 0) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 74 | Return (CTOK (\F0OF)) |
| 75 | } Else { |
| 76 | Return (CTOK (\F0ON)) |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | Method (_AC1) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 81 | If (\FLVL <= 1) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 82 | Return (CTOK (\F1OF)) |
| 83 | } Else { |
| 84 | Return (CTOK (\F1ON)) |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | Method (_AC2) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 89 | If (\FLVL <= 2) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 90 | Return (CTOK (\F2OF)) |
| 91 | } Else { |
| 92 | Return (CTOK (\F2ON)) |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | Method (_AC3) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 97 | If (\FLVL <= 3) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 98 | Return (CTOK (\F3OF)) |
| 99 | } Else { |
| 100 | Return (CTOK (\F3ON)) |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | Method (_AC4) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 105 | If (\FLVL <= 4) { |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 106 | Return (CTOK (\F4OF)) |
| 107 | } Else { |
| 108 | Return (CTOK (\F4ON)) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | Name (_AL0, Package () { FAN0 }) |
| 113 | Name (_AL1, Package () { FAN1 }) |
| 114 | Name (_AL2, Package () { FAN2 }) |
| 115 | Name (_AL3, Package () { FAN3 }) |
| 116 | Name (_AL4, Package () { FAN4 }) |
| 117 | |
| 118 | PowerResource (FNP0, 0, 0) |
| 119 | { |
| 120 | Method (_STA) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 121 | If (\FLVL <= 0) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 122 | Return (1) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 123 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 124 | Return (0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 125 | } |
| 126 | } |
| 127 | Method (_ON) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 128 | \FLVL = 0 |
| 129 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F0PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 130 | Notify (\_TZ.THRM, 0x81) |
| 131 | } |
| 132 | Method (_OFF) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 133 | \FLVL = 1 |
| 134 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 135 | Notify (\_TZ.THRM, 0x81) |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | PowerResource (FNP1, 0, 0) |
| 140 | { |
| 141 | Method (_STA) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 142 | If (\FLVL <= 1) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 143 | Return (1) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 144 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 145 | Return (0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 146 | } |
| 147 | } |
| 148 | Method (_ON) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 149 | \FLVL = 1 |
| 150 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 151 | Notify (\_TZ.THRM, 0x81) |
| 152 | } |
| 153 | Method (_OFF) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 154 | \FLVL = 2 |
| 155 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 156 | Notify (\_TZ.THRM, 0x81) |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | PowerResource (FNP2, 0, 0) |
| 161 | { |
| 162 | Method (_STA) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 163 | If (\FLVL <= 2) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 164 | Return (1) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 165 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 166 | Return (0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 167 | } |
| 168 | } |
| 169 | Method (_ON) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 170 | \FLVL = 2 |
| 171 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 172 | Notify (\_TZ.THRM, 0x81) |
| 173 | } |
| 174 | Method (_OFF) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 175 | \FLVL = 3 |
| 176 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 177 | Notify (\_TZ.THRM, 0x81) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | PowerResource (FNP3, 0, 0) |
| 182 | { |
| 183 | Method (_STA) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 184 | If (\FLVL <= 3) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 185 | Return (1) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 186 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 187 | Return (0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 188 | } |
| 189 | } |
| 190 | Method (_ON) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 191 | \FLVL = 3 |
| 192 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 193 | Notify (\_TZ.THRM, 0x81) |
| 194 | } |
| 195 | Method (_OFF) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 196 | \FLVL = 4 |
| 197 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 198 | Notify (\_TZ.THRM, 0x81) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | PowerResource (FNP4, 0, 0) |
| 203 | { |
| 204 | Method (_STA) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 205 | If (\FLVL <= 4) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 206 | Return (1) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 207 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 208 | Return (0) |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | Method (_ON) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 212 | \FLVL = 4 |
| 213 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 214 | Notify (\_TZ.THRM, 0x81) |
| 215 | } |
| 216 | Method (_OFF) { |
Elyes HAOUAS | 38eaf3e | 2020-10-08 10:10:38 +0200 | [diff] [blame] | 217 | \FLVL = 4 |
| 218 | \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW |
Stefan Reinauer | e1ae4b2 | 2012-04-27 23:20:58 +0200 | [diff] [blame] | 219 | Notify (\_TZ.THRM, 0x81) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | Device (FAN0) |
| 224 | { |
| 225 | Name (_HID, EISAID ("PNP0C0B")) |
| 226 | Name (_UID, 0) |
| 227 | Name (_PR0, Package () { FNP0 }) |
| 228 | } |
| 229 | |
| 230 | Device (FAN1) |
| 231 | { |
| 232 | Name (_HID, EISAID ("PNP0C0B")) |
| 233 | Name (_UID, 1) |
| 234 | Name (_PR0, Package () { FNP1 }) |
| 235 | } |
| 236 | |
| 237 | Device (FAN2) |
| 238 | { |
| 239 | Name (_HID, EISAID ("PNP0C0B")) |
| 240 | Name (_UID, 2) |
| 241 | Name (_PR0, Package () { FNP2 }) |
| 242 | } |
| 243 | |
| 244 | Device (FAN3) |
| 245 | { |
| 246 | Name (_HID, EISAID ("PNP0C0B")) |
| 247 | Name (_UID, 3) |
| 248 | Name (_PR0, Package () { FNP3 }) |
| 249 | } |
| 250 | |
| 251 | Device (FAN4) |
| 252 | { |
| 253 | Name (_HID, EISAID ("PNP0C0B")) |
| 254 | Name (_UID, 4) |
| 255 | Name (_PR0, Package () { FNP4 }) |
| 256 | } |
| 257 | } |
| 258 | } |