Add support for Google's Chromebook Pixel
[coreboot.git] / src / mainboard / google / link / acpi / thermal.asl
blob357c096a17a1f955fe951ba3ddb64e475fd298fe
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2011 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  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  */
20 // Thermal Zone
22 Scope (\_TZ)
24         ThermalZone (CRIT)
25         {
26                 // Thermal zone polling frequency: 5 seconds
27                 Name (_TZP, 50)
29                 // Convert from Degrees C to 1/10 Kelvin for ACPI
30                 Method (CTOK, 1) {
31                         // 10th of Degrees C
32                         Multiply (Arg0, 10, Local0)
34                         // Convert to Kelvin
35                         Add (Local0, 2732, Local0)
37                         Return (Local0)
38                 }
40                 // Threshold for OS to shutdown
41                 Method (_CRT, 0, Serialized)
42                 {
43                         Return (CTOK (\TCRT))
44                 }
46                 Method (_TMP, 0, Serialized)
47                 {
48                         // Get CPU Temperature from TIN9/PECI via EC
49                         Store (\_SB.PCI0.LPCB.EC0.TIN9, Local0)
51                         // Check for sensor not present
52                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNPR)) {
53                                 Return (CTOK(0))
54                         }
56                         // Check for sensor not powered
57                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNOP)) {
58                                 Return (CTOK(0))
59                         }
61                         // Check for sensor bad reading
62                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TBAD)) {
63                                 Return (CTOK(0))
64                         }
66                         // Adjust by offset to get Kelvin
67                         Add (\_SB.PCI0.LPCB.EC0.TOFS, Local0, Local0)
69                         // Convert to 1/10 Kelvin
70                         Multiply (Local0, 10, Local0)
71                         Return (Local0)
72                 }
73         }
75         ThermalZone (THRM)
76         {
77                 Name (_TC1, 0x02)
78                 Name (_TC2, 0x05)
80                 // Thermal zone polling frequency: 10 seconds
81                 Name (_TZP, 100)
83                 // Thermal sampling period for passive cooling: 2 seconds
84                 Name (_TSP, 20)
86                 // Convert from Degrees C to 1/10 Kelvin for ACPI
87                 Method (CTOK, 1) {
88                         // 10th of Degrees C
89                         Multiply (Arg0, 10, Local0)
91                         // Convert to Kelvin
92                         Add (Local0, 2732, Local0)
94                         Return (Local0)
95                 }
97                 // Threshold for OS to shutdown
98                 Method (_CRT, 0, Serialized)
99                 {
100                         Return (CTOK (\TCRT))
101                 }
103                 // Threshold for passive cooling
104                 Method (_PSV, 0, Serialized)
105                 {
106                         Return (CTOK (\TPSV))
107                 }
109                 // Processors used for passive cooling
110                 Method (_PSL, 0, Serialized)
111                 {
112                         Return (\PPKG ())
113                 }
115                 Method (_TMP, 0, Serialized)
116                 {
117                         // Get Temperature from TIN# set in NVS
118                         Store (\_SB.PCI0.LPCB.EC0.TINS (TMPS), Local0)
120                         // Check for sensor not present
121                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNPR)) {
122                                 Return (CTOK(0))
123                         }
125                         // Check for sensor not powered
126                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNOP)) {
127                                 Return (CTOK(0))
128                         }
130                         // Check for sensor bad reading
131                         If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TBAD)) {
132                                 Return (CTOK(0))
133                         }
135                         // Adjust by offset to get Kelvin
136                         Add (\_SB.PCI0.LPCB.EC0.TOFS, Local0, Local0)
138                         // Convert to 1/10 Kelvin
139                         Multiply (Local0, 10, Local0)
140                         Return (Local0)
141                 }
143                 /* CTDP Down */
144                 Method (_AC0) {
145                         If (LLessEqual (\FLVL, 0)) {
146                                 Return (CTOK (\F0OF))
147                         } Else {
148                                 Return (CTOK (\F0ON))
149                         }
150                 }
152                 /* CTDP Nominal */
153                 Method (_AC1) {
154                         If (LLessEqual (\FLVL, 1)) {
155                                 Return (CTOK (\F1OF))
156                         } Else {
157                                 Return (CTOK (\F1ON))
158                         }
159                 }
161                 Name (_AL0, Package () { TDP0 })
162                 Name (_AL1, Package () { TDP1 })
164                 PowerResource (TNP0, 0, 0)
165                 {
166                         Method (_STA) {
167                                 If (LLessEqual (\FLVL, 0)) {
168                                         Return (One)
169                                 } Else {
170                                         Return (Zero)
171                                 }
172                         }
173                         Method (_ON)  {
174                                 Store (0, \FLVL)
175                                 \_SB.PCI0.MCHC.STND ()
176                                 Notify (\_TZ.THRM, 0x81)
177                         }
178                         Method (_OFF) {
179                                 Store (1, \FLVL)
180                                 \_SB.PCI0.MCHC.STDN ()
181                                 Notify (\_TZ.THRM, 0x81)
182                         }
183                 }
185                 PowerResource (TNP1, 0, 0)
186                 {
187                         Method (_STA) {
188                                 If (LLessEqual (\FLVL, 1)) {
189                                         Return (One)
190                                 } Else {
191                                         Return (Zero)
192                                 }
193                         }
194                         Method (_ON)  {
195                                 Store (1, \FLVL)
196                                 Notify (\_TZ.THRM, 0x81)
197                         }
198                         Method (_OFF) {
199                                 Store (1, \FLVL)
200                                 Notify (\_TZ.THRM, 0x81)
201                         }
202                 }
204                 Device (TDP0)
205                 {
206                         Name (_HID, EISAID ("PNP0C0B"))
207                         Name (_UID, 0)
208                         Name (_PR0, Package () { TNP0 })
209                 }
211                 Device (TDP1)
212                 {
213                         Name (_HID, EISAID ("PNP0C0B"))
214                         Name (_UID, 1)
215                         Name (_PR0, Package () { TNP1 })
216                 }
217         }