tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / google / panther / acpi / thermal.asl
blob9fe77daa71c4b27b7adc18999b0d6e4ac27922c6
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
16 // Thermal Zone
18 Scope (\_TZ)
20         ThermalZone (THRM)
21         {
22                 Name (_TC1, 0x02)
23                 Name (_TC2, 0x05)
25                 // Thermal zone polling frequency: 10 seconds
26                 Name (_TZP, 100)
28                 // Thermal sampling period for passive cooling: 2 seconds
29                 Name (_TSP, 20)
31                 // Convert from Degrees C to 1/10 Kelvin for ACPI
32                 Method (CTOK, 1) {
33                         // 10th of Degrees C
34                         Multiply (Arg0, 10, Local0)
36                         // Convert to Kelvin
37                         Add (Local0, 2732, Local0)
39                         Return (Local0)
40                 }
42                 // Threshold for OS to shutdown
43                 Method (_CRT, 0, Serialized)
44                 {
45                         Return (CTOK (\TCRT))
46                 }
48                 // Threshold for passive cooling
49                 Method (_PSV, 0, Serialized)
50                 {
51                         Return (CTOK (\TPSV))
52                 }
54                 // Processors used for passive cooling
55                 Method (_PSL, 0, Serialized)
56                 {
57                         Return (\PPKG ())
58                 }
60                 // Start fan at state 4 = lowest temp state
61                 Method (_INI)
62                 {
63                         Store (4, \FLVL)
64                         Store (\F4PW, \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
65                         Notify (\_TZ.THRM, 0x81)
66                 }
68                 Method (TCHK, 0, Serialized)
69                 {
70                         // Get CPU Temperature from PECI via SuperIO TMPIN3
71                         Store (\_SB.PCI0.LPCB.SIO.ENVC.TIN3, Local0)
73                         // Check for "no reading available"
74                         If (LEqual (Local0, 0x80)) {
75                                 Return (CTOK (\F0ON))
76                         }
78                         // Check for invalid readings
79                         If (LOr (LEqual (Local0, 255), LEqual (Local0, 0))) {
80                                 Return (CTOK (\F0ON))
81                         }
83                         // PECI raw value is an offset from Tj_max
84                         Subtract (255, Local0, Local1)
86                         // Handle values greater than Tj_max
87                         If (LGreaterEqual (Local1, \TMAX)) {
88                                 Return (CTOK (\TMAX))
89                         }
91                         // Subtract from Tj_max to get temperature
92                         Subtract (\TMAX, Local1, Local0)
93                         Return (CTOK (Local0))
94                 }
96                 Method (_TMP, 0, Serialized)
97                 {
98                         // Get temperature from SuperIO in deci-kelvin
99                         Store (TCHK (), Local0)
101                         // Critical temperature in deci-kelvin
102                         Store (CTOK (\TMAX), Local1)
104                         If (LGreaterEqual (Local0, Local1)) {
105                                 Store ("CRITICAL TEMPERATURE", Debug)
106                                 Store (Local0, Debug)
108                                 // Wait 1 second for SuperIO to re-poll
109                                 Sleep (1000)
111                                 // Re-read temperature from SuperIO
112                                 Store (TCHK (), Local0)
114                                 Store ("RE-READ TEMPERATURE", Debug)
115                                 Store (Local0, Debug)
116                         }
118                         Return (Local0)
119                 }
121                 Method (_AC0) {
122                         If (LLessEqual (\FLVL, 0)) {
123                                 Return (CTOK (\F0OF))
124                         } Else {
125                                 Return (CTOK (\F0ON))
126                         }
127                 }
129                 Method (_AC1) {
130                         If (LLessEqual (\FLVL, 1)) {
131                                 Return (CTOK (\F1OF))
132                         } Else {
133                                 Return (CTOK (\F1ON))
134                         }
135                 }
137                 Method (_AC2) {
138                         If (LLessEqual (\FLVL, 2)) {
139                                 Return (CTOK (\F2OF))
140                         } Else {
141                                 Return (CTOK (\F2ON))
142                         }
143                 }
145                 Method (_AC3) {
146                         If (LLessEqual (\FLVL, 3)) {
147                                 Return (CTOK (\F3OF))
148                         } Else {
149                                 Return (CTOK (\F3ON))
150                         }
151                 }
153                 Method (_AC4) {
154                         If (LLessEqual (\FLVL, 4)) {
155                                 Return (CTOK (\F4OF))
156                         } Else {
157                                 Return (CTOK (\F4ON))
158                         }
159                 }
161                 Name (_AL0, Package () { FAN0 })
162                 Name (_AL1, Package () { FAN1 })
163                 Name (_AL2, Package () { FAN2 })
164                 Name (_AL3, Package () { FAN3 })
165                 Name (_AL4, Package () { FAN4 })
167                 PowerResource (FNP0, 0, 0)
168                 {
169                         Method (_STA) {
170                                 If (LLessEqual (\FLVL, 0)) {
171                                         Return (One)
172                                 } Else {
173                                         Return (Zero)
174                                 }
175                         }
176                         Method (_ON)  {
177                                 If (LNot (_STA ())) {
178                                         Store (0, \FLVL)
179                                         Store (\F0PW,
180                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
181                                         Notify (\_TZ.THRM, 0x81)
182                                 }
183                         }
184                         Method (_OFF) {
185                                 If (_STA ()) {
186                                         Store (1, \FLVL)
187                                         Store (\F1PW,
188                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
189                                         Notify (\_TZ.THRM, 0x81)
190                                 }
191                         }
192                 }
194                 PowerResource (FNP1, 0, 0)
195                 {
196                         Method (_STA) {
197                                 If (LLessEqual (\FLVL, 1)) {
198                                         Return (One)
199                                 } Else {
200                                         Return (Zero)
201                                 }
202                         }
203                         Method (_ON)  {
204                                 If (LNot (_STA ())) {
205                                         Store (1, \FLVL)
206                                         Store (\F1PW,
207                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
208                                         Notify (\_TZ.THRM, 0x81)
209                                 }
210                         }
211                         Method (_OFF) {
212                                 If (_STA ()) {
213                                         Store (2, \FLVL)
214                                         Store (\F2PW,
215                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
216                                         Notify (\_TZ.THRM, 0x81)
217                                 }
218                         }
219                 }
221                 PowerResource (FNP2, 0, 0)
222                 {
223                         Method (_STA) {
224                                 If (LLessEqual (\FLVL, 2)) {
225                                         Return (One)
226                                 } Else {
227                                         Return (Zero)
228                                 }
229                         }
230                         Method (_ON)  {
231                                 If (LNot (_STA ())) {
232                                         Store (2, \FLVL)
233                                         Store (\F2PW,
234                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
235                                         Notify (\_TZ.THRM, 0x81)
236                                 }
237                         }
238                         Method (_OFF) {
239                                 If (_STA ()) {
240                                         Store (3, \FLVL)
241                                         Store (\F3PW,
242                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
243                                         Notify (\_TZ.THRM, 0x81)
244                                 }
245                         }
246                 }
248                 PowerResource (FNP3, 0, 0)
249                 {
250                         Method (_STA) {
251                                 If (LLessEqual (\FLVL, 3)) {
252                                         Return (One)
253                                 } Else {
254                                         Return (Zero)
255                                 }
256                         }
257                         Method (_ON)  {
258                                 If (LNot (_STA ())) {
259                                         Store (3, \FLVL)
260                                         Store (\F3PW,
261                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
262                                         Notify (\_TZ.THRM, 0x81)
263                                 }
264                         }
265                         Method (_OFF) {
266                                 If (_STA ()) {
267                                         Store (4, \FLVL)
268                                         Store (\F4PW,
269                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
270                                         Notify (\_TZ.THRM, 0x81)
271                                 }
272                         }
273                 }
275                 PowerResource (FNP4, 0, 0)
276                 {
277                         Method (_STA) {
278                                 If (LLessEqual (\FLVL, 4)) {
279                                         Return (One)
280                                 } Else {
281                                         Return (Zero)
282                                 }
283                         }
284                         Method (_ON)  {
285                                 If (LNot (_STA ())) {
286                                         Store (4, \FLVL)
287                                         Store (\F4PW,
288                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
289                                         Notify (\_TZ.THRM, 0x81)
290                                 }
291                         }
292                         Method (_OFF) {
293                                 If (_STA ()) {
294                                         Store (4, \FLVL)
295                                         Store (\F4PW,
296                                                 \_SB.PCI0.LPCB.SIO.ENVC.F2PS)
297                                         Notify (\_TZ.THRM, 0x81)
298                                 }
299                         }
300                 }
302                 Device (FAN0)
303                 {
304                         Name (_HID, EISAID ("PNP0C0B"))
305                         Name (_UID, 0)
306                         Name (_PR0, Package () { FNP0 })
307                 }
309                 Device (FAN1)
310                 {
311                         Name (_HID, EISAID ("PNP0C0B"))
312                         Name (_UID, 1)
313                         Name (_PR0, Package () { FNP1 })
314                 }
316                 Device (FAN2)
317                 {
318                         Name (_HID, EISAID ("PNP0C0B"))
319                         Name (_UID, 2)
320                         Name (_PR0, Package () { FNP2 })
321                 }
323                 Device (FAN3)
324                 {
325                         Name (_HID, EISAID ("PNP0C0B"))
326                         Name (_UID, 3)
327                         Name (_PR0, Package () { FNP3 })
328                 }
330                 Device (FAN4)
331                 {
332                         Name (_HID, EISAID ("PNP0C0B"))
333                         Name (_UID, 4)
334                         Name (_PR0, Package () { FNP4 })
335                 }
336         }