blob: 94c80da10dea18b55e03eb65e1a9a119848ceb4e [file] [log] [blame]
Angel Pons2de6bdf2020-04-05 13:21:00 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Matt DeVillier2f7813f2017-08-24 16:31:41 -05002
3/* Thermal Threshold Event Handler */
Martin Roth15f232d2018-04-29 22:41:58 -05004#define HAVE_THERM_EVENT_HANDLER
Frans Hendriks9cb88a72019-12-06 11:54:01 +01005
6#if CONFIG(EC_SUPPORTS_DPTF_TEVT)
Matt DeVillier2f7813f2017-08-24 16:31:41 -05007Method (TEVT, 1, NotSerialized)
8{
Felix Singer3e90ce52022-12-12 07:26:08 +01009 Local0 = ToInteger (Arg0)
Matt DeVillier2f7813f2017-08-24 16:31:41 -050010
11#ifdef DPTF_TSR0_SENSOR_ID
Felix Singer096158d2022-12-11 23:02:09 +010012 If (Local0 == DPTF_TSR0_SENSOR_ID) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -050013 Notify (^TSR0, 0x90)
14 }
15#endif
16#ifdef DPTF_TSR1_SENSOR_ID
Felix Singer096158d2022-12-11 23:02:09 +010017 If (Local0 == DPTF_TSR1_SENSOR_ID) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -050018 Notify (^TSR1, 0x90)
19 }
20#endif
21#ifdef DPTF_TSR2_SENSOR_ID
Felix Singer096158d2022-12-11 23:02:09 +010022 If (Local0 == DPTF_TSR2_SENSOR_ID) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -050023 Notify (^TSR2, 0x90)
24 }
25#endif
26}
Frans Hendriks9cb88a72019-12-06 11:54:01 +010027#endif
Matt DeVillier2f7813f2017-08-24 16:31:41 -050028
29/* Thermal device initialization - Disable Aux Trip Points */
30Method (TINI)
31{
32#ifdef DPTF_TSR0_SENSOR_ID
33 ^TSR0.PATD ()
34#endif
35#ifdef DPTF_TSR1_SENSOR_ID
36 ^TSR1.PATD ()
37#endif
38#ifdef DPTF_TSR2_SENSOR_ID
39 ^TSR2.PATD ()
40#endif
41}
42
43#ifdef DPTF_TSR0_SENSOR_ID
44Device (TSR0)
45{
46 Name (_HID, EISAID ("INT3403"))
47 Name (_UID, 1)
48 Name (PTYP, 0x03)
49 Name (TMPI, DPTF_TSR0_SENSOR_ID)
50 Name (_STR, Unicode (DPTF_TSR0_SENSOR_NAME))
51 Name (GTSH, 20) /* 2 degree hysteresis */
52
53 Method (_STA)
54 {
Felix Singerdfbb6342022-12-26 08:39:35 +010055 If (\DPTE == 1) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -050056 Return (0xF)
57 } Else {
58 Return (0x0)
59 }
60 }
61
62 Method (_TMP, 0, Serialized)
63 {
64 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
65 }
66
67 /* Return passive thermal point defined by Terra2 or Terra3 mainboard */
68 Method (_PSV)
69 {
Felix Singer096158d2022-12-11 23:02:09 +010070 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -050071 {
72 Return (CTOK (DPTF_TERRA2_TSR0_PASSIVE))
73 } Else {
74 Return (CTOK (DPTF_TERRA3_TSR0_PASSIVE))
75 }
76 }
77
78 /* Return critical thermal point defined by Terra2 or Terra3 mainboard */
79 Method (_CRT)
80 {
Felix Singer096158d2022-12-11 23:02:09 +010081 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -050082 {
83 Return (CTOK (DPTF_TERRA2_TSR0_CRITICAL))
84 } Else {
85 Return (CTOK (DPTF_TERRA3_TSR0_CRITICAL))
86 }
87 }
88
89 Name (PATC, 2)
90
91 /* Set Aux Trip Point */
92 Method (PAT0, 1, Serialized)
93 {
94 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
95 }
96
97 /* Set Aux Trip Point */
98 Method (PAT1, 1, Serialized)
99 {
100 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
101 }
102
103 /* Disable Aux Trip Point */
104 Method (PATD, 0, Serialized)
105 {
106 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
107 }
108}
109#endif
110
111#ifdef DPTF_TSR1_SENSOR_ID
112Device (TSR1)
113{
114 Name (_HID, EISAID ("INT3403"))
115 Name (_UID, 2)
116 Name (PTYP, 0x03)
117 Name (TMPI, DPTF_TSR1_SENSOR_ID)
118 Name (_STR, Unicode (DPTF_TSR1_SENSOR_NAME))
119 Name (GTSH, 20) /* 2 degree hysteresis */
120
121 Method (_STA)
122 {
Felix Singerdfbb6342022-12-26 08:39:35 +0100123 If (\DPTE == 1) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500124 Return (0xF)
125 } Else {
126 Return (0x0)
127 }
128 }
129
130 Method (_TMP, 0, Serialized)
131 {
132 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
133 }
134
135 /* Return passive thermal point defined by Terra2 or Terra3 mainboard */
136 Method (_PSV)
137 {
Felix Singer096158d2022-12-11 23:02:09 +0100138 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500139 {
140 Return (CTOK (DPTF_TERRA2_TSR1_PASSIVE))
141 } Else {
142 Return (CTOK (DPTF_TERRA3_TSR1_PASSIVE))
143 }
144 }
145
146 /* Return critical thermal point defined by Terra2 or Terra3 mainboard */
147 Method (_CRT)
148 {
Felix Singer096158d2022-12-11 23:02:09 +0100149 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500150 {
151 Return (CTOK (DPTF_TERRA2_TSR1_CRITICAL))
152 } Else {
153 Return (CTOK (DPTF_TERRA3_TSR1_CRITICAL))
154 }
155 }
156
157 Name (PATC, 2)
158
159 /* Set Aux Trip Point */
160 Method (PAT0, 1, Serialized)
161 {
162 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
163 }
164
165 /* Set Aux Trip Point */
166 Method (PAT1, 1, Serialized)
167 {
168 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
169 }
170
171 /* Disable Aux Trip Point */
172 Method (PATD, 0, Serialized)
173 {
174 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
175 }
176}
177#endif
178
179#ifdef DPTF_TSR2_SENSOR_ID
180Device (TSR2)
181{
182 Name (_HID, EISAID ("INT3403"))
183 Name (_UID, 3)
184 Name (PTYP, 0x03)
185 Name (TMPI, DPTF_TSR2_SENSOR_ID)
186 Name (_STR, Unicode (DPTF_TSR2_SENSOR_NAME))
187 Name (GTSH, 20) /* 2 degree hysteresis */
188
189 Method (_STA)
190 {
Felix Singerdfbb6342022-12-26 08:39:35 +0100191 If (\DPTE == 1) {
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500192 Return (0xF)
193 } Else {
194 Return (0x0)
195 }
196 }
197
198 Method (_TMP, 0, Serialized)
199 {
200 Return (\_SB.PCI0.LPCB.EC0.TSRD (TMPI))
201 }
202
203 /* Return passive thermal point defined by Terra2 or Terra3 mainboard */
204 Method (_PSV)
205 {
Felix Singer096158d2022-12-11 23:02:09 +0100206 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500207 {
208 Return (CTOK (DPTF_TERRA2_TSR2_PASSIVE))
209 } Else {
210 Return (CTOK (DPTF_TERRA3_TSR2_PASSIVE))
211 }
212 }
213
214 /* Return critical thermal point defined by Terra2 or Terra3 mainboard */
215 Method (_CRT)
216 {
Felix Singer096158d2022-12-11 23:02:09 +0100217 If (\_SB.GPID == TERRA2_PROJECT_ID)
Matt DeVillier2f7813f2017-08-24 16:31:41 -0500218 {
219 Return (CTOK (DPTF_TERRA2_TSR2_CRITICAL))
220 } Else {
221 Return (CTOK (DPTF_TERRA3_TSR2_CRITICAL))
222 }
223 }
224
225 Name (PATC, 2)
226
227 /* Set Aux Trip Point */
228 Method (PAT0, 1, Serialized)
229 {
230 \_SB.PCI0.LPCB.EC0.PAT0 (TMPI, Arg0)
231 }
232
233 /* Set Aux Trip Point */
234 Method (PAT1, 1, Serialized)
235 {
236 \_SB.PCI0.LPCB.EC0.PAT1 (TMPI, Arg0)
237 }
238
239 /* Disable Aux Trip Point */
240 Method (PATD, 0, Serialized)
241 {
242 \_SB.PCI0.LPCB.EC0.PATD (TMPI)
243 }
244}
245#endif