tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / google / peppy / acpi / thermal.asl
blobac84b5eddd9489e087d8b583dabbc51dca07a125
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2012 Google Inc.
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                 Method (_TMP, 0, Serialized)
61                 {
62                         // Get Temperature from TIN# set in NVS
63                         Store (\_SB.PCI0.LPCB.EC0.TINS (TMPS), Local0)
65                         // Check for sensor not calibrated
66                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNCA)) {
67                                 Return (CTOK(0))
68                         }
70                         // Check for sensor not present
71                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNPR)) {
72                                 Return (CTOK(0))
73                         }
75                         // Check for sensor not powered
76                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNOP)) {
77                                 Return (CTOK(0))
78                         }
80                         // Check for sensor bad reading
81                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TBAD)) {
82                                 Return (CTOK(0))
83                         }
85                         // Adjust by offset to get Kelvin
86                         Add (\_SB.PCI0.LPCB.EC0.TOFS, Local0, Local0)
88                         // Convert to 1/10 Kelvin
89                         Multiply (Local0, 10, Local0)
90                         Return (Local0)
91                 }
93                 /* CTDP Down */
94                 Method (_AC0) {
95                         If (LLessEqual (\FLVL, 0)) {
96                                 Return (CTOK (\F0OF))
97                         } Else {
98                                 Return (CTOK (\F0ON))
99                         }
100                 }
102                 /* CTDP Nominal */
103                 Method (_AC1) {
104                         If (LLessEqual (\FLVL, 1)) {
105                                 Return (CTOK (\F1OF))
106                         } Else {
107                                 Return (CTOK (\F1ON))
108                         }
109                 }
111                 Name (_AL0, Package () { TDP0 })
112                 Name (_AL1, Package () { TDP1 })
114                 PowerResource (TNP0, 0, 0)
115                 {
116                         Method (_STA) {
117                                 If (LLessEqual (\FLVL, 0)) {
118                                         Return (One)
119                                 } Else {
120                                         Return (Zero)
121                                 }
122                         }
123                         Method (_ON)  {
124                                 Store (0, \FLVL)
126                                 /* Enable Power Limit */
127                                 \_SB.PCI0.MCHC.CTLE (\F0PW)
129                                 Notify (\_TZ.THRM, 0x81)
130                         }
131                         Method (_OFF) {
132                                 Store (1, \FLVL)
134                                 /* Disable Power Limit */
135                                 \_SB.PCI0.MCHC.CTLD ()
137                                 Notify (\_TZ.THRM, 0x81)
138                         }
139                 }
141                 PowerResource (TNP1, 0, 0)
142                 {
143                         Method (_STA) {
144                                 If (LLessEqual (\FLVL, 1)) {
145                                         Return (One)
146                                 } Else {
147                                         Return (Zero)
148                                 }
149                         }
150                         Method (_ON)  {
151                                 Store (1, \FLVL)
152                                 Notify (\_TZ.THRM, 0x81)
153                         }
154                         Method (_OFF) {
155                                 Store (1, \FLVL)
156                                 Notify (\_TZ.THRM, 0x81)
157                         }
158                 }
160                 Device (TDP0)
161                 {
162                         Name (_HID, EISAID ("PNP0C0B"))
163                         Name (_UID, 0)
164                         Name (_PR0, Package () { TNP0 })
165                 }
167                 Device (TDP1)
168                 {
169                         Name (_HID, EISAID ("PNP0C0B"))
170                         Name (_UID, 1)
171                         Name (_PR0, Package () { TNP1 })
172                 }
173         }