| 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 (THRM) |
| 11 |
{ |
| 12 |
Name (_TC1, 0x02) |
| 13 |
Name (_TC2, 0x05) |
| 14 |
|
| 15 |
// Ignore critical temps for the first few reads |
| 16 |
// at boot to prevent unexpected shutdown |
| 17 |
Name (IRDC, 4) |
| 18 |
Name (CRDC, 0) |
| 19 |
|
| 20 |
// Thermal zone polling frequency: 10 seconds |
| 21 |
Name (_TZP, 100) |
| 22 |
|
| 23 |
// Thermal sampling period for passive cooling: 2 seconds |
| 24 |
Name (_TSP, 20) |
| 25 |
|
| 26 |
// Convert from Degrees C to 1/10 Kelvin for ACPI |
| 27 |
Method (CTOK, 1) { |
| 28 |
// 10th of Degrees C |
| 29 |
Local0 = Arg0 * 10 |
| 30 |
|
| 31 |
// Convert to Kelvin |
| 32 |
Local0 += 2732 |
| 33 |
|
| 34 |
Return (Local0) |
| 35 |
} |
| 36 |
|
| 37 |
// Threshold for OS to shutdown |
| 38 |
Method (_CRT, 0, Serialized) |
| 39 |
{ |
| 40 |
Return (CTOK (\TCRT)) |
| 41 |
} |
| 42 |
|
| 43 |
// Threshold for passive cooling |
| 44 |
Method (_PSV, 0, Serialized) |
| 45 |
{ |
| 46 |
Return (CTOK (\TPSV)) |
| 47 |
} |
| 48 |
|
| 49 |
// Processors used for passive cooling |
| 50 |
Method (_PSL, 0, Serialized) |
| 51 |
{ |
| 52 |
Return (\PPKG ()) |
| 53 |
} |
| 54 |
|
| 55 |
Method (_TMP, 0, Serialized) |
| 56 |
{ |
| 57 |
// Get CPU Temperature from the Embedded Controller |
| 58 |
Local0 = \_SB.PCI0.LPCB.EC0.CPUT |
| 59 |
|
| 60 |
// Re-read from EC if the temperature is very high to |
| 61 |
// avoid OS shutdown if we got a bad reading. |
| 62 |
If (Local0 >= \TCRT) { |
| 63 |
Local0 = \_SB.PCI0.LPCB.EC0.CPUT |
| 64 |
If (Local0 >= \TCRT) { |
| 65 |
// Check if this is an early read |
| 66 |
If (CRDC < IRDC) { |
| 67 |
Local0 = 0 |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
// Keep track of first few reads by the OS |
| 73 |
If (CRDC < IRDC) { |
| 74 |
CRDC++ |
| 75 |
} |
| 76 |
|
| 77 |
// Invalid reading, ensure fan is spinning |
| 78 |
If (Local0 >= 0x80) { |
| 79 |
Return (CTOK (\F4ON)) |
| 80 |
} |
| 81 |
|
| 82 |
Return (CTOK (Local0)) |
| 83 |
} |
| 84 |
|
| 85 |
Method (_AC0) { |
| 86 |
If (\FLVL <= 0) { |
| 87 |
Return (CTOK (\F0OF)) |
| 88 |
} Else { |
| 89 |
Return (CTOK (\F0ON)) |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
Method (_AC1) { |
| 94 |
If (\FLVL <= 1) { |
| 95 |
Return (CTOK (\F1OF)) |
| 96 |
} Else { |
| 97 |
Return (CTOK (\F1ON)) |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
Method (_AC2) { |
| 102 |
If (\FLVL <= 2) { |
| 103 |
Return (CTOK (\F2OF)) |
| 104 |
} Else { |
| 105 |
Return (CTOK (\F2ON)) |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
Method (_AC3) { |
| 110 |
If (\FLVL <= 3) { |
| 111 |
Return (CTOK (\F3OF)) |
| 112 |
} Else { |
| 113 |
Return (CTOK (\F3ON)) |
| 114 |
} |
| 115 |
} |
| 116 |
|
| 117 |
Method (_AC4) { |
| 118 |
If (\FLVL <= 4) { |
| 119 |
Return (CTOK (\F4OF)) |
| 120 |
} Else { |
| 121 |
Return (CTOK (\F4ON)) |
| 122 |
} |
| 123 |
} |
| 124 |
|
| 125 |
Name (_AL0, Package () { \_SB.PCI0.LPCB.EC0.FAN0 }) |
| 126 |
Name (_AL1, Package () { \_SB.PCI0.LPCB.EC0.FAN1 }) |
| 127 |
Name (_AL2, Package () { \_SB.PCI0.LPCB.EC0.FAN2 }) |
| 128 |
Name (_AL3, Package () { \_SB.PCI0.LPCB.EC0.FAN3 }) |
| 129 |
Name (_AL4, Package () { \_SB.PCI0.LPCB.EC0.FAN4 }) |
| 130 |
} |
| 131 |
} |