Angel Pons | feedf23 | 2020-04-05 13:22:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 2 | |
| 3 | // Thermal Zone |
| 4 | |
Arthur Heymans | 04008a9 | 2018-11-28 12:13:54 +0100 | [diff] [blame] | 5 | External (\PPKG, MethodObj) |
| 6 | |
Martin Roth | a50b1f9 | 2018-05-06 18:13:19 -0500 | [diff] [blame] | 7 | #define HAVE_THERMALZONE |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 8 | Scope (\_TZ) |
| 9 | { |
| 10 | ThermalZone (CRIT) |
| 11 | { |
| 12 | // Thermal zone polling frequency: 5 seconds |
| 13 | Name (_TZP, 50) |
| 14 | |
| 15 | // Convert from Degrees C to 1/10 Kelvin for ACPI |
| 16 | Method (CTOK, 1) { |
| 17 | // 10th of Degrees C |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 18 | Local0 = Arg0 * 10 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 19 | |
| 20 | // Convert to Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 21 | Local0 += 2732 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 22 | |
| 23 | Return (Local0) |
| 24 | } |
| 25 | |
| 26 | // Threshold for OS to shutdown |
| 27 | Method (_CRT, 0, Serialized) |
| 28 | { |
| 29 | Return (CTOK (\TCRT)) |
| 30 | } |
| 31 | |
| 32 | Method (_TMP, 0, Serialized) |
| 33 | { |
| 34 | // Get CPU Temperature from TIN9/PECI via EC |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 35 | Local0 = \_SB.PCI0.LPCB.EC0.TIN9 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 36 | |
Duncan Laurie | 433432b | 2013-06-03 10:38:22 -0700 | [diff] [blame] | 37 | // Check for sensor not calibrated |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 38 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) { |
Duncan Laurie | 433432b | 2013-06-03 10:38:22 -0700 | [diff] [blame] | 39 | Return (CTOK(0)) |
| 40 | } |
| 41 | |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 42 | // Check for sensor not present |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 43 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 44 | Return (CTOK(0)) |
| 45 | } |
| 46 | |
| 47 | // Check for sensor not powered |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 48 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 49 | Return (CTOK(0)) |
| 50 | } |
| 51 | |
| 52 | // Check for sensor bad reading |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 53 | If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 54 | Return (CTOK(0)) |
| 55 | } |
| 56 | |
| 57 | // Adjust by offset to get Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 58 | Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 59 | |
| 60 | // Convert to 1/10 Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 61 | Local0 *= 10 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 62 | Return (Local0) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | ThermalZone (THRM) |
| 67 | { |
| 68 | Name (_TC1, 0x02) |
| 69 | Name (_TC2, 0x05) |
| 70 | |
| 71 | // Thermal zone polling frequency: 10 seconds |
| 72 | Name (_TZP, 100) |
| 73 | |
| 74 | // Thermal sampling period for passive cooling: 2 seconds |
| 75 | Name (_TSP, 20) |
| 76 | |
| 77 | // Convert from Degrees C to 1/10 Kelvin for ACPI |
| 78 | Method (CTOK, 1) { |
| 79 | // 10th of Degrees C |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 80 | Local0 = Arg0 * 10 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 81 | |
| 82 | // Convert to Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 83 | Local0 += 2732 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 84 | |
| 85 | Return (Local0) |
| 86 | } |
| 87 | |
| 88 | // Threshold for OS to shutdown |
| 89 | Method (_CRT, 0, Serialized) |
| 90 | { |
| 91 | Return (CTOK (\TCRT)) |
| 92 | } |
| 93 | |
| 94 | // Threshold for passive cooling |
| 95 | Method (_PSV, 0, Serialized) |
| 96 | { |
| 97 | Return (CTOK (\TPSV)) |
| 98 | } |
| 99 | |
| 100 | // Processors used for passive cooling |
| 101 | Method (_PSL, 0, Serialized) |
| 102 | { |
| 103 | Return (\PPKG ()) |
| 104 | } |
| 105 | |
| 106 | Method (_TMP, 0, Serialized) |
| 107 | { |
| 108 | // Get Temperature from TIN# set in NVS |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 109 | Local0 = \_SB.PCI0.LPCB.EC0.TINS (TMPS) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 110 | |
| 111 | // Check for sensor not present |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 112 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 113 | Return (CTOK(0)) |
| 114 | } |
| 115 | |
| 116 | // Check for sensor not powered |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 117 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 118 | Return (CTOK(0)) |
| 119 | } |
| 120 | |
| 121 | // Check for sensor bad reading |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 122 | If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 123 | Return (CTOK(0)) |
| 124 | } |
| 125 | |
| 126 | // Adjust by offset to get Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 127 | Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 128 | |
| 129 | // Convert to 1/10 Kelvin |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 130 | Local0 *= 10 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 131 | Return (Local0) |
| 132 | } |
| 133 | |
| 134 | /* CTDP Down */ |
| 135 | Method (_AC0) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 136 | If (\FLVL <= 0) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 137 | Return (CTOK (\F0OF)) |
| 138 | } Else { |
| 139 | Return (CTOK (\F0ON)) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | /* CTDP Nominal */ |
| 144 | Method (_AC1) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 145 | If (\FLVL <= 1) { |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 146 | Return (CTOK (\F1OF)) |
| 147 | } Else { |
| 148 | Return (CTOK (\F1ON)) |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | Name (_AL0, Package () { TDP0 }) |
| 153 | Name (_AL1, Package () { TDP1 }) |
| 154 | |
| 155 | PowerResource (TNP0, 0, 0) |
| 156 | { |
| 157 | Method (_STA) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 158 | If (\FLVL <= 0) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 159 | Return (1) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 160 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 161 | Return (0) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 162 | } |
| 163 | } |
| 164 | Method (_ON) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 165 | \FLVL = 0 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 166 | \_SB.PCI0.MCHC.STND () |
| 167 | Notify (\_TZ.THRM, 0x81) |
| 168 | } |
| 169 | Method (_OFF) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 170 | \FLVL = 1 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 171 | \_SB.PCI0.MCHC.STDN () |
| 172 | Notify (\_TZ.THRM, 0x81) |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | PowerResource (TNP1, 0, 0) |
| 177 | { |
| 178 | Method (_STA) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 179 | If (\FLVL <= 1) { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame] | 180 | Return (1) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 181 | } Else { |
Felix Singer | fa06bcb | 2022-12-26 09:32:47 +0100 | [diff] [blame^] | 182 | Return (0) |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 183 | } |
| 184 | } |
| 185 | Method (_ON) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 186 | \FLVL = 1 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 187 | Notify (\_TZ.THRM, 0x81) |
| 188 | } |
| 189 | Method (_OFF) { |
Elyes HAOUAS | 527690c | 2020-10-08 09:33:16 +0200 | [diff] [blame] | 190 | \FLVL = 1 |
Stefan Reinauer | 49428d8 | 2013-02-21 15:48:37 -0800 | [diff] [blame] | 191 | Notify (\_TZ.THRM, 0x81) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | Device (TDP0) |
| 196 | { |
| 197 | Name (_HID, EISAID ("PNP0C0B")) |
| 198 | Name (_UID, 0) |
| 199 | Name (_PR0, Package () { TNP0 }) |
| 200 | } |
| 201 | |
| 202 | Device (TDP1) |
| 203 | { |
| 204 | Name (_HID, EISAID ("PNP0C0B")) |
| 205 | Name (_UID, 1) |
| 206 | Name (_PR0, Package () { TNP1 }) |
| 207 | } |
| 208 | } |
| 209 | } |