| 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.CTMP |
| 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.CTMP |
| 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 |
Return (CTOK (Local0)) |
| 78 |
} |
| 79 |
|
| 80 |
// The EC does all fan control. The is no Active Cooling Fan control (_ACx). |
| 81 |
|
| 82 |
} |
| 83 |
} |