| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
// Thermal Zone |
| 4 |
|
| 5 |
External (\PPKG, MethodObj) |
| 6 |
|
| 7 |
#define HAVE_THERMALZONE |
| 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 |
| 18 |
Local0 = Arg0 * 10 |
| 19 |
|
| 20 |
// Convert to Kelvin |
| 21 |
Local0 += 2732 |
| 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 |
| 35 |
Local0 = \_SB.PCI0.LPCB.EC0.TIN9 |
| 36 |
|
| 37 |
// Check for sensor not calibrated |
| 38 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) { |
| 39 |
Return (CTOK(0)) |
| 40 |
} |
| 41 |
|
| 42 |
// Check for sensor not present |
| 43 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
| 44 |
Return (CTOK(0)) |
| 45 |
} |
| 46 |
|
| 47 |
// Check for sensor not powered |
| 48 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
| 49 |
Return (CTOK(0)) |
| 50 |
} |
| 51 |
|
| 52 |
// Check for sensor bad reading |
| 53 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
| 54 |
Return (CTOK(0)) |
| 55 |
} |
| 56 |
|
| 57 |
// Adjust by offset to get Kelvin |
| 58 |
Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
| 59 |
|
| 60 |
// Convert to 1/10 Kelvin |
| 61 |
Local0 *= 10 |
| 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 |
| 80 |
Local0 = Arg0 * 10 |
| 81 |
|
| 82 |
// Convert to Kelvin |
| 83 |
Local0 += 2732 |
| 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 |
| 109 |
Local0 = \_SB.PCI0.LPCB.EC0.TINS (TMPS) |
| 110 |
|
| 111 |
// Check for sensor not present |
| 112 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
| 113 |
Return (CTOK(0)) |
| 114 |
} |
| 115 |
|
| 116 |
// Check for sensor not powered |
| 117 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
| 118 |
Return (CTOK(0)) |
| 119 |
} |
| 120 |
|
| 121 |
// Check for sensor bad reading |
| 122 |
If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
| 123 |
Return (CTOK(0)) |
| 124 |
} |
| 125 |
|
| 126 |
// Adjust by offset to get Kelvin |
| 127 |
Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
| 128 |
|
| 129 |
// Convert to 1/10 Kelvin |
| 130 |
Local0 *= 10 |
| 131 |
Return (Local0) |
| 132 |
} |
| 133 |
|
| 134 |
/* CTDP Down */ |
| 135 |
Method (_AC0) { |
| 136 |
If (\FLVL <= 0) { |
| 137 |
Return (CTOK (\F0OF)) |
| 138 |
} Else { |
| 139 |
Return (CTOK (\F0ON)) |
| 140 |
} |
| 141 |
} |
| 142 |
|
| 143 |
/* CTDP Nominal */ |
| 144 |
Method (_AC1) { |
| 145 |
If (\FLVL <= 1) { |
| 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) { |
| 158 |
If (\FLVL <= 0) { |
| 159 |
Return (1) |
| 160 |
} Else { |
| 161 |
Return (0) |
| 162 |
} |
| 163 |
} |
| 164 |
Method (_ON) { |
| 165 |
\FLVL = 0 |
| 166 |
\_SB.PCI0.MCHC.STND () |
| 167 |
Notify (\_TZ.THRM, 0x81) |
| 168 |
} |
| 169 |
Method (_OFF) { |
| 170 |
\FLVL = 1 |
| 171 |
\_SB.PCI0.MCHC.STDN () |
| 172 |
Notify (\_TZ.THRM, 0x81) |
| 173 |
} |
| 174 |
} |
| 175 |
|
| 176 |
PowerResource (TNP1, 0, 0) |
| 177 |
{ |
| 178 |
Method (_STA) { |
| 179 |
If (\FLVL <= 1) { |
| 180 |
Return (1) |
| 181 |
} Else { |
| 182 |
Return (0) |
| 183 |
} |
| 184 |
} |
| 185 |
Method (_ON) { |
| 186 |
\FLVL = 1 |
| 187 |
Notify (\_TZ.THRM, 0x81) |
| 188 |
} |
| 189 |
Method (_OFF) { |
| 190 |
\FLVL = 1 |
| 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 |
} |