1/* SPDX-License-Identifier: GPL-2.0-only */ 2 3#include <arch/x86/acpi/statdef.asl> 4 5Scope(\_TZ) 6{ 7#if defined(EC_LENOVO_H8_ME_WORKAROUND) 8 Name (MEB1, 0) 9 Name (MEB2, 0) 10#endif 11 12 Method(C2K, 1, NotSerialized) 13 { 14 Local0 = Arg0 * 10 15 Local0 += 2732 16 if (Local0 <= 2732) { 17 Return (3000) 18 } 19 20 if (Local0 > 4012) { 21 Return (3000) 22 } 23 Return (Local0) 24 } 25 26 ThermalZone(THM0) 27 { 28 /* Thermal zone polling frequency: 10 seconds */ 29 Name (_TZP, 100) 30 31 /* Thermal sampling period for passive cooling: 10 seconds */ 32 Name (_TSP, 100) 33 34 /* Coefficients for passive cooling */ 35 Name (_TC1, 0x02) 36 Name (_TC2, 0x05) 37 38/* Generated by acpigen */ 39External (\PPKG, MethodObj) 40 41 /* Processors used for passive cooling */ 42 Method (_PSL, 0, Serialized) 43 { 44 Return (\PPKG ()) 45 } 46 47 /* Get critical temperature in degree celsius */ 48 Method (GCRT, 0, NotSerialized) { 49 Local0 = \TCRT 50 if (Local0 > 0) { 51 Return (Local0) 52 } 53 Return (127) 54 } 55 56 /* Get passive temperature in degree celsius */ 57 Method (GPSV, 0, NotSerialized) { 58 Local0 = \TPSV 59 if (Local0 > 0) { 60 Return (Local0) 61 } 62 Return (95) 63 } 64 65 Method (_CRT, 0, NotSerialized) { 66 Return (C2K (GCRT ())) 67 } 68 69 Method (_PSV, 0, NotSerialized) { 70 Return (C2K (GPSV ())) 71 } 72 73 Method(_TMP) { 74#if defined(EC_LENOVO_H8_ME_WORKAROUND) 75 /* Avoid tripping alarm if ME isn't booted at all yet */ 76 If (!MEB1 && \_SB.PCI0.LPCB.EC.TMP0 == 128) { 77 Return (C2K(40)) 78 } 79 MEB1 = 1 80#endif 81 Return (C2K(\_SB.PCI0.LPCB.EC.TMP0)) 82 } 83 84 Method (_AC0) { 85 Local0 = GPSV () 86 87 /* Active fan 10 degree below passive threshold */ 88 Local0 -= 10 89 90 If (\FLVL) { 91 /* Turn of 5 degree below trip point */ 92 Local0 -= 5 93 } 94 95 Return (C2K (Local0)) 96 } 97 98 Name (_AL0, Package () { FAN }) 99 100 PowerResource (FPWR, 0, 0) 101 { 102 /* 103 * WINDOWS BUG: Don't read from EmbeddedControl 104 * in PowerResources. Use system-memory instead! 105 */ 106 Method (_STA) { 107 Return (\FLVL) 108 } 109 110 /* 111 * WINDOWS BUG: Don't write to FIELD elements located 112 * in another ACPI scope. Call a method that does it! 113 */ 114 Method (_ON) { 115 \_SB.PCI0.LPCB.EC.FANE(1) 116 \FLVL = 1 117 Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) 118 } 119 120 Method (_OFF) { 121 \_SB.PCI0.LPCB.EC.FANE(0) 122 \FLVL = 0 123 Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG) 124 } 125 } 126 127 Device (FAN) 128 { 129 Name (_HID, EISAID ("PNP0C0B")) 130 Name (_PR0, Package () { FPWR }) 131 } 132 } 133 134 ThermalZone(THM1) 135 { 136 /* Thermal zone polling frequency: 10 seconds */ 137 Name (_TZP, 100) 138 139 /* Thermal sampling period for passive cooling: 10 seconds */ 140 Name (_TSP, 100) 141 142 /* Coefficients for passive cooling */ 143 Name (_TC1, 0x02) 144 Name (_TC2, 0x05) 145 146 /* Processors used for passive cooling */ 147 Method (_PSL, 0, Serialized) 148 { 149 Return (\PPKG ()) 150 } 151 152 Method (_CRT, 0, NotSerialized) { 153 Return (C2K (99)) 154 } 155 156 Method (_PSV, 0, NotSerialized) { 157 Return (C2K (94)) 158 } 159 160 Method(_TMP) { 161#if defined(EC_LENOVO_H8_ME_WORKAROUND) 162 /* Avoid tripping alarm if ME isn't booted at all yet */ 163 If (!MEB2 && \_SB.PCI0.LPCB.EC.TMP1 == 128) { 164 Return (C2K(40)) 165 } 166 MEB2 = 1 167#endif 168 Return (C2K(\_SB.PCI0.LPCB.EC.TMP1)) 169 } 170 } 171} 172