soc/intel/alderlake: Add ADL-P 4+4 with 28W TDP
[coreboot.git] / src / ec / lenovo / h8 / acpi / thermal.asl
blob4f3b76e4dda493e6ad12a1ae6f8a74a7a0f6ad9c
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/x86/acpi/statdef.asl>
5 Scope(\_TZ)
7 #if defined(EC_LENOVO_H8_ME_WORKAROUND)
8         Name (MEB1, 0)
9         Name (MEB2, 0)
10 #endif
12         Method(C2K, 1, NotSerialized)
13         {
14                 Local0 = Arg0 * 10
15                 Local0 += 2732
16                 if (Local0 <= 2732) {
17                         Return (3000)
18                 }
20                 if (Local0 > 4012) {
21                         Return (3000)
22                 }
23                 Return (Local0)
24         }
26         ThermalZone(THM0)
27         {
28                 /* Thermal zone polling frequency: 10 seconds */
29                 Name (_TZP, 100)
31                 /* Thermal sampling period for passive cooling: 10 seconds */
32                 Name (_TSP, 100)
34                 /* Coefficients for passive cooling */
35                 Name (_TC1, 0x02)
36                 Name (_TC2, 0x05)
38 /* Generated by acpigen */
39 External (\PPKG, MethodObj)
41                 /* Processors used for passive cooling */
42                 Method (_PSL, 0, Serialized)
43                 {
44                         Return (\PPKG ())
45                 }
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                 }
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                 }
65                 Method (_CRT, 0, NotSerialized) {
66                         Return (C2K (GCRT ()))
67                 }
69                 Method (_PSV, 0, NotSerialized) {
70                         Return (C2K (GPSV ()))
71                 }
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                 }
84                 Method (_AC0) {
85                         Local0 = GPSV ()
87                         /* Active fan 10 degree below passive threshold */
88                         Local0 -= 10
90                         If (\FLVL) {
91                                 /* Turn of 5 degree below trip point */
92                                 Local0 -= 5
93                         }
95                         Return (C2K (Local0))
96                 }
98                 Name (_AL0, Package () { FAN })
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                         }
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                         }
120                         Method (_OFF) {
121                                 \_SB.PCI0.LPCB.EC.FANE(0)
122                                 \FLVL = 0
123                                 Notify (\_TZ.THM0, NOTIFY_TZ_TRIPPTCHG)
124                         }
125                 }
127                 Device (FAN)
128                 {
129                         Name (_HID, EISAID ("PNP0C0B"))
130                         Name (_PR0, Package () { FPwR })
131                 }
132         }
134         ThermalZone(THM1)
135         {
136                 /* Thermal zone polling frequency: 10 seconds */
137                 Name (_TZP, 100)
139                 /* Thermal sampling period for passive cooling: 10 seconds */
140                 Name (_TSP, 100)
142                 /* Coefficients for passive cooling */
143                 Name (_TC1, 0x02)
144                 Name (_TC2, 0x05)
146                 /* Processors used for passive cooling */
147                 Method (_PSL, 0, Serialized)
148                 {
149                         Return (\PPKG ())
150                 }
152                 Method (_CRT, 0, NotSerialized) {
153                         Return (C2K (99))
154                 }
156                 Method (_PSV, 0, NotSerialized) {
157                         Return (C2K (94))
158                 }
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         }