mb/ocp/tiogapass: Fix GPIOs
[coreboot2.git] / src / mainboard / intel / emeraldlake2 / acpi / thermal.asl
blobaf6c41e572f4967f4029e8d65807a43ca1c4303f
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 // Thermal Zone
5 External (\PPKG, MethodObj)
7 #define HAVE_THERMALZONE
8 Scope (\_TZ)
10         ThermalZone (THRM)
11         {
12                 Name (_TC1, 0x02)
13                 Name (_TC2, 0x05)
15                 // Thermal zone polling frequency: 10 seconds
16                 Name (_TZP, 100)
18                 // Thermal sampling period for passive cooling: 2 seconds
19                 Name (_TSP, 20)
21                 // Convert from Degrees C to 1/10 Kelvin for ACPI
22                 Method (CTOK, 1) {
23                         // 10th of Degrees C
24                         Local0 = Arg0 * 10
26                         // Convert to Kelvin
27                         Local0 += 2732
29                         Return (Local0)
30                 }
32                 // Threshold for OS to shutdown
33                 Method (_CRT, 0, Serialized)
34                 {
35                         Return (CTOK (\TCRT))
36                 }
38                 // Threshold for passive cooling
39                 Method (_PSV, 0, Serialized)
40                 {
41                         Return (CTOK (\TPSV))
42                 }
44                 // Processors used for passive cooling
45                 Method (_PSL, 0, Serialized)
46                 {
47                         Return (\PPKG ())
48                 }
50                 Method (_TMP, 0, Serialized)
51                 {
52                         // Get CPU Temperature from PECI via SuperIO TMPIN3
53                         Local0 = \_SB.PCI0.LPCB.SIO.ENVC.TIN3
55                         // Check for invalid readings
56                         If ((Local0 == 255) || (Local0 == 0)) {
57                                 Return (CTOK (\F2ON))
58                         }
60                         // PECI raw value is an offset from Tj_max
61                         Local1 = 255 - Local0
63                         // Handle values greater than Tj_max
64                         If (Local1 >= \TMAX) {
65                                 Return (CTOK (\TMAX))
66                         }
68                         // Subtract from Tj_max to get temperature
69                         Local0 = \TMAX - Local1
70                         Return (CTOK (Local0))
71                 }
73                 Method (_AC0) {
74                         If (\FLVL <= 0) {
75                                 Return (CTOK (\F0OF))
76                         } Else {
77                                 Return (CTOK (\F0ON))
78                         }
79                 }
81                 Method (_AC1) {
82                         If (\FLVL <= 1) {
83                                 Return (CTOK (\F1OF))
84                         } Else {
85                                 Return (CTOK (\F1ON))
86                         }
87                 }
89                 Method (_AC2) {
90                         If (\FLVL <= 2) {
91                                 Return (CTOK (\F2OF))
92                         } Else {
93                                 Return (CTOK (\F2ON))
94                         }
95                 }
97                 Method (_AC3) {
98                         If (\FLVL <= 3) {
99                                 Return (CTOK (\F3OF))
100                         } Else {
101                                 Return (CTOK (\F3ON))
102                         }
103                 }
105                 Method (_AC4) {
106                         If (\FLVL <= 4) {
107                                 Return (CTOK (\F4OF))
108                         } Else {
109                                 Return (CTOK (\F4ON))
110                         }
111                 }
113                 Name (_AL0, Package () { FAN0 })
114                 Name (_AL1, Package () { FAN1 })
115                 Name (_AL2, Package () { FAN2 })
116                 Name (_AL3, Package () { FAN3 })
117                 Name (_AL4, Package () { FAN4 })
119                 PowerResource (FNP0, 0, 0)
120                 {
121                         Method (_STA) {
122                                 If (\FLVL <= 0) {
123                                         Return (1)
124                                 } Else {
125                                         Return (0)
126                                 }
127                         }
128                         Method (_ON)  {
129                                 \FLVL = 0
130                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F0PW
131                                 Notify (\_TZ.THRM, 0x81)
132                         }
133                         Method (_OFF) {
134                                 \FLVL = 1
135                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW
136                                 Notify (\_TZ.THRM, 0x81)
137                         }
138                 }
140                 PowerResource (FNP1, 0, 0)
141                 {
142                         Method (_STA) {
143                                 If (\FLVL <= 1) {
144                                         Return (1)
145                                 } Else {
146                                         Return (0)
147                                 }
148                         }
149                         Method (_ON)  {
150                                 \FLVL = 1
151                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F1PW
152                                 Notify (\_TZ.THRM, 0x81)
153                         }
154                         Method (_OFF) {
155                                 \FLVL = 2
156                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW
157                                 Notify (\_TZ.THRM, 0x81)
158                         }
159                 }
161                 PowerResource (FNP2, 0, 0)
162                 {
163                         Method (_STA) {
164                                 If (\FLVL <= 2) {
165                                         Return (1)
166                                 } Else {
167                                         Return (0)
168                                 }
169                         }
170                         Method (_ON)  {
171                                 \FLVL = 2
172                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F2PW
173                                 Notify (\_TZ.THRM, 0x81)
174                         }
175                         Method (_OFF) {
176                                 \FLVL = 3
177                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW
178                                 Notify (\_TZ.THRM, 0x81)
179                         }
180                 }
182                 PowerResource (FNP3, 0, 0)
183                 {
184                         Method (_STA) {
185                                 If (\FLVL <= 3) {
186                                         Return (1)
187                                 } Else {
188                                         Return (0)
189                                 }
190                         }
191                         Method (_ON)  {
192                                 \FLVL = 3
193                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F3PW
194                                 Notify (\_TZ.THRM, 0x81)
195                         }
196                         Method (_OFF) {
197                                 \FLVL = 4
198                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
199                                 Notify (\_TZ.THRM, 0x81)
200                         }
201                 }
203                 PowerResource (FNP4, 0, 0)
204                 {
205                         Method (_STA) {
206                                 If (\FLVL <= 4) {
207                                         Return (1)
208                                 } Else {
209                                         Return (0)
210                                 }
211                         }
212                         Method (_ON)  {
213                                 \FLVL = 4
214                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
215                                 Notify (\_TZ.THRM, 0x81)
216                         }
217                         Method (_OFF) {
218                                 \FLVL = 4
219                                 \_SB.PCI0.LPCB.SIO.ENVC.F3PS = \F4PW
220                                 Notify (\_TZ.THRM, 0x81)
221                         }
222                 }
224                 Device (FAN0)
225                 {
226                         Name (_HID, EISAID ("PNP0C0B"))
227                         Name (_UID, 0)
228                         Name (_PR0, Package () { FNP0 })
229                 }
231                 Device (FAN1)
232                 {
233                         Name (_HID, EISAID ("PNP0C0B"))
234                         Name (_UID, 1)
235                         Name (_PR0, Package () { FNP1 })
236                 }
238                 Device (FAN2)
239                 {
240                         Name (_HID, EISAID ("PNP0C0B"))
241                         Name (_UID, 2)
242                         Name (_PR0, Package () { FNP2 })
243                 }
245                 Device (FAN3)
246                 {
247                         Name (_HID, EISAID ("PNP0C0B"))
248                         Name (_UID, 3)
249                         Name (_PR0, Package () { FNP3 })
250                 }
252                 Device (FAN4)
253                 {
254                         Name (_HID, EISAID ("PNP0C0B"))
255                         Name (_UID, 4)
256                         Name (_PR0, Package () { FNP4 })
257                 }
258         }