blob: ce2455f30b97f84f09910b63b4f52b90b0aa5b4b [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauerd6682e82013-02-21 15:39:35 -08002
3/*
4 * The mainboard must define a PNOT method to handle power
5 * state notifications and Notify CPU device objects to
6 * re-evaluate their _PPC and _CST tables.
7 */
8
Duncan Lauried338b462013-07-31 15:30:41 -07009// Mainboard specific throttle handler
Freddy Paule8cc52f2015-10-02 19:06:57 -070010#ifdef DPTF_ENABLE_CHARGER
Duncan Laurie3f1500f2014-03-06 08:37:49 -080011External (\_SB.DPTF.TCHG, DeviceObj)
Freddy Paule8cc52f2015-10-02 19:06:57 -070012#endif
Chris Wange019bd92020-08-06 16:38:04 +080013/* Enable DPTC interface with AMD ALIB */
14#ifdef EC_ENABLE_AMD_DPTC_SUPPORT
15External(\_SB.DPTC, MethodObj)
16#endif
Duncan Lauried338b462013-07-31 15:30:41 -070017
Stefan Reinauerd6682e82013-02-21 15:39:35 -080018Device (EC0)
19{
20 Name (_HID, EISAID ("PNP0C09"))
21 Name (_UID, 1)
Duncan Laurie045222f2013-05-21 07:49:11 -070022 Name (_GPE, EC_SCI_GPI)
Stefan Reinauerd6682e82013-02-21 15:39:35 -080023 Name (TOFS, EC_TEMP_SENSOR_OFFSET)
Duncan Laurie433432b2013-06-03 10:38:22 -070024 Name (TNCA, EC_TEMP_SENSOR_NOT_CALIBRATED)
25 Name (TNOP, EC_TEMP_SENSOR_NOT_POWERED)
26 Name (TBAD, EC_TEMP_SENSOR_ERROR)
27 Name (TNPR, EC_TEMP_SENSOR_NOT_PRESENT)
Stefan Reinauerd6682e82013-02-21 15:39:35 -080028 Name (DWRN, 15) // Battery capacity warning at 15%
29 Name (DLOW, 10) // Battery capacity low at 10%
30
Shawn Nematbakhsh37b7a662015-03-24 11:07:51 -070031 OperationRegion (ERAM, EmbeddedControl, 0x00, EC_ACPI_MEM_MAPPED_BEGIN)
Stefan Reinauerd6682e82013-02-21 15:39:35 -080032 Field (ERAM, ByteAcc, Lock, Preserve)
33 {
34 Offset (0x00),
35 RAMV, 8, // EC RAM Version
36 TSTB, 8, // Test Byte
37 TSTC, 8, // Complement of Test Byte
Patrick Georgif9267f92017-08-24 23:12:55 +020038 KBLV, 8, // Keyboard Backlight value
Duncan Lauriead8d9132013-12-10 07:41:33 -080039 FAND, 8, // Set Fan Duty Cycle
Duncan Laurie93e24442014-01-06 12:30:52 -080040 PATI, 8, // Programmable Auxiliary Trip Sensor ID
41 PATT, 8, // Programmable Auxiliary Trip Threshold
42 PATC, 8, // Programmable Auxiliary Trip Commit
Duncan Lauriee6b280e2014-02-10 16:21:05 -080043 CHGL, 8, // Charger Current Limit
jiazi Yang51fc93f2016-07-28 05:15:01 -040044 TBMD, 1, // Tablet mode
Karthikeyan Ramasubramanian036ccd72018-10-23 22:16:36 -060045 DDPN, 3, // Device DPTF Profile Number
Patrick Georgif9267f92017-08-24 23:12:55 +020046 // DFUD must be 0 for the other 31 values to be valid
Patrick Georgi4bd68b82017-08-18 21:06:24 +020047 Offset (0x0a),
Patrick Georgif9267f92017-08-24 23:12:55 +020048 DFUD, 1, // Device Features Undefined
49 FLSH, 1, // Flash commands present
50 PFAN, 1, // PWM Fan control present
51 KBLE, 1, // Keyboard Backlight present
52 LTBR, 1, // Lightbar present
53 LEDC, 1, // LED control
54 MTNS, 1, // Motion sensors present
55 KEYB, 1, // EC is keyboard controller
56 PSTR, 1, // Persistent storage
57 P80P, 1, // EC serves I/O Port 80h
58 THRM, 1, // EC supports thermal management
59 SBKL, 1, // Screen backlight switch present
60 WIFI, 1, // WIFI switch present
61 HOST, 1, // EC monitors host events (eg SCI, SMI)
62 GPIO, 1, // EC provides GPIO commands
63 I2CB, 1, // EC provides I2C controller access
64 CHRG, 1, // EC provides commands for charger control
65 BATT, 1, // Simply Battery support
66 SBAT, 1, // Smart Battery support
67 HANG, 1, // EC can detect host hang
68 PMUI, 1, // Power Information
69 DSEC, 1, // another EC exists downstream
70 UPDC, 1, // supports USB Power Delivery
71 UMUX, 1, // supports USB Mux
72 MSFF, 1, // Motion Sense has FIFO
73 TVST, 1, // supports temporary secure vstore
74 TCMV, 1, // USB Type C Muxing is virtual (host assisted)
75 RTCD, 1, // EC provides an RTC device
76 FPRD, 1, // EC provides a fingerprint reader device
77 TPAD, 1, // EC provides a touchpad device
78 RWSG, 1, // EC has RWSIG task enabled
79 DEVE, 1, // EC supports device events
80 // make sure we're within our space envelope
81 Offset (0x0e),
Nicolas Boichat07fe6182018-01-26 14:37:16 +080082 Offset (0x12),
83 BTID, 8, // Battery index that host wants to read
Emil Lundmark9d5f9f22018-05-22 19:31:37 +020084 USPP, 8, // USB Port Power
Subrata Banikf5c3e292020-11-30 16:10:34 +053085 }
Stefan Reinauerd6682e82013-02-21 15:39:35 -080086
Julius Wernercd49cce2019-03-05 16:53:33 -080087#if CONFIG(EC_GOOGLE_CHROMEEC_ACPI_MEMMAP)
Shawn Nematbakhsh37b7a662015-03-24 11:07:51 -070088 OperationRegion (EMEM, EmbeddedControl,
89 EC_ACPI_MEM_MAPPED_BEGIN, EC_ACPI_MEM_MAPPED_SIZE)
90 Field (EMEM, ByteAcc, Lock, Preserve)
91#else
Stefan Reinauerd6682e82013-02-21 15:39:35 -080092 OperationRegion (EMEM, SystemIO, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE)
93 Field (EMEM, ByteAcc, NoLock, Preserve)
Shawn Nematbakhsh37b7a662015-03-24 11:07:51 -070094#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -080095 {
Shawn Nematbakhsh37b7a662015-03-24 11:07:51 -070096 #include "emem.asl"
Stefan Reinauerd6682e82013-02-21 15:39:35 -080097 }
98
Aaron Durbin05201d72016-09-23 16:06:14 -050099#ifdef EC_ENABLE_LID_SWITCH
100 /* LID Switch */
101 Device (LID0)
102 {
103 Name (_HID, EisaId ("PNP0C0D"))
104 Method (_LID, 0)
105 {
106 Return (^^LIDS)
107 }
108
109#ifdef EC_ENABLE_WAKE_PIN
110 Name (_PRW, Package () { EC_ENABLE_WAKE_PIN, 0x5 })
111#endif
112 }
113#endif
114
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800115 Method (TINS, 1, Serialized)
116 {
117 Switch (ToInteger (Arg0))
118 {
119 Case (0) { Return (TIN0) }
120 Case (1) { Return (TIN1) }
121 Case (2) { Return (TIN2) }
122 Case (3) { Return (TIN3) }
123 Case (4) { Return (TIN4) }
124 Case (5) { Return (TIN5) }
125 Case (6) { Return (TIN6) }
126 Case (7) { Return (TIN7) }
127 Case (8) { Return (TIN8) }
128 Case (9) { Return (TIN9) }
129 Default { Return (TIN0) }
130 }
131 }
132
Duncan Laurie20373c02015-09-22 09:40:37 -0700133 Method (_CRS, 0, Serialized)
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800134 {
135 Name (ECMD, ResourceTemplate()
136 {
137 IO (Decode16,
138 EC_LPC_ADDR_ACPI_DATA,
139 EC_LPC_ADDR_ACPI_DATA,
140 0, 1)
141 IO (Decode16,
142 EC_LPC_ADDR_ACPI_CMD,
143 EC_LPC_ADDR_ACPI_CMD,
144 0, 1)
145 })
146 Return (ECMD)
147 }
148
149 Method (_REG, 2, NotSerialized)
150 {
151 // Initialize AC power state
152 Store (ACEX, \PWRS)
Furquan Shaikh80c555d2020-06-12 10:01:20 -0700153 /*
154 * Inform platform code about the current AC power state.
155 * This allows the platform to take any action based on the initialized state.
156 * PWRS isn't valid before this point.
157 */
158 \PNOT ()
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800159
160 // Initialize LID switch state
161 Store (LIDS, \LIDS)
Kevin Chiu83f0c692020-09-22 00:48:36 +0800162
163#ifdef EC_ENABLE_AMD_DPTC_SUPPORT
164 /*
165 * Per the device mode (clamshell or tablet) to initialize
166 * the thermal setting on OS startup.
167 */
168 If (CondRefOf (\_SB.DPTC)) {
169 \_SB.DPTC()
170 }
171#endif
172
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800173 }
174
Duncan Lauriead8d9132013-12-10 07:41:33 -0800175 /* Read requested temperature and check against EC error values */
176 Method (TSRD, 1, Serialized)
177 {
178 Store (\_SB.PCI0.LPCB.EC0.TINS (Arg0), Local0)
179
180 /* Check for sensor not calibrated */
181 If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNCA)) {
182 Return (Zero)
183 }
184
185 /* Check for sensor not present */
186 If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNPR)) {
187 Return (Zero)
188 }
189
190 /* Check for sensor not powered */
191 If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TNOP)) {
192 Return (Zero)
193 }
194
195 /* Check for sensor bad reading */
196 If (LEqual (Local0, \_SB.PCI0.LPCB.EC0.TBAD)) {
197 Return (Zero)
198 }
199
200 /* Adjust by offset to get Kelvin */
201 Add (\_SB.PCI0.LPCB.EC0.TOFS, Local0, Local0)
202
203 /* Convert to 1/10 Kelvin */
204 Multiply (Local0, 10, Local0)
205
206 Return (Local0)
207 }
208
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800209 // Lid Closed Event
210 Method (_Q01, 0, NotSerialized)
211 {
212 Store ("EC: LID CLOSE", Debug)
213 Store (LIDS, \LIDS)
Aaron Durbin05201d72016-09-23 16:06:14 -0500214#ifdef EC_ENABLE_LID_SWITCH
215 Notify (LID0, 0x80)
Aaron Durbin05201d72016-09-23 16:06:14 -0500216#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800217 }
218
219 // Lid Open Event
220 Method (_Q02, 0, NotSerialized)
221 {
222 Store ("EC: LID OPEN", Debug)
223 Store (LIDS, \LIDS)
Furquan Shaikha3a84562017-11-28 14:32:17 -0800224 Notify (CREC, 0x2)
Aaron Durbin05201d72016-09-23 16:06:14 -0500225#ifdef EC_ENABLE_LID_SWITCH
226 Notify (LID0, 0x80)
Aaron Durbin05201d72016-09-23 16:06:14 -0500227#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800228 }
229
230 // Power Button
231 Method (_Q03, 0, NotSerialized)
232 {
233 Store ("EC: POWER BUTTON", Debug)
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800234 }
235
236 // AC Connected
237 Method (_Q04, 0, NotSerialized)
238 {
239 Store ("EC: AC CONNECTED", Debug)
240 Store (ACEX, \PWRS)
241 Notify (AC, 0x80)
Freddy Paule8cc52f2015-10-02 19:06:57 -0700242#ifdef DPTF_ENABLE_CHARGER
Duncan Laurie3f1500f2014-03-06 08:37:49 -0800243 If (CondRefOf (\_SB.DPTF.TCHG)) {
244 Notify (\_SB.DPTF.TCHG, 0x80)
245 }
Freddy Paule8cc52f2015-10-02 19:06:57 -0700246#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800247 \PNOT ()
248 }
249
250 // AC Disconnected
251 Method (_Q05, 0, NotSerialized)
252 {
253 Store ("EC: AC DISCONNECTED", Debug)
254 Store (ACEX, \PWRS)
255 Notify (AC, 0x80)
Freddy Paule8cc52f2015-10-02 19:06:57 -0700256#ifdef DPTF_ENABLE_CHARGER
Duncan Laurie3f1500f2014-03-06 08:37:49 -0800257 If (CondRefOf (\_SB.DPTF.TCHG)) {
258 Notify (\_SB.DPTF.TCHG, 0x80)
259 }
Freddy Paule8cc52f2015-10-02 19:06:57 -0700260#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800261 \PNOT ()
262 }
263
264 // Battery Low Event
265 Method (_Q06, 0, NotSerialized)
266 {
267 Store ("EC: BATTERY LOW", Debug)
268 Notify (BAT0, 0x80)
269 }
270
271 // Battery Critical Event
272 Method (_Q07, 0, NotSerialized)
273 {
274 Store ("EC: BATTERY CRITICAL", Debug)
275 Notify (BAT0, 0x80)
276 }
277
278 // Battery Info Event
279 Method (_Q08, 0, NotSerialized)
280 {
281 Store ("EC: BATTERY INFO", Debug)
282 Notify (BAT0, 0x81)
Nicolas Boichat07fe6182018-01-26 14:37:16 +0800283#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE
284 If (CondRefOf (BAT1)) {
285 Notify (BAT1, 0x81)
286 }
287#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800288 }
289
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800290 // Thermal Overload Event
291 Method (_Q0A, 0, NotSerialized)
292 {
293 Store ("EC: THERMAL OVERLOAD", Debug)
294 Notify (\_TZ, 0x80)
295 }
296
297 // Thermal Event
298 Method (_Q0B, 0, NotSerialized)
299 {
300 Store ("EC: THERMAL", Debug)
301 Notify (\_TZ, 0x80)
302 }
303
304 // USB Charger
305 Method (_Q0C, 0, NotSerialized)
306 {
307 Store ("EC: USB CHARGER", Debug)
308 }
309
310 // Key Pressed
311 Method (_Q0D, 0, NotSerialized)
312 {
313 Store ("EC: KEY PRESSED", Debug)
Furquan Shaikha3a84562017-11-28 14:32:17 -0800314 Notify (CREC, 0x2)
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800315 }
316
Duncan Laurie18d9899b2013-08-28 09:54:04 -0700317 // Thermal Shutdown Imminent
318 Method (_Q10, 0, NotSerialized)
319 {
320 Store ("EC: THERMAL SHUTDOWN", Debug)
321 Notify (\_TZ, 0x80)
322 }
323
324 // Battery Shutdown Imminent
325 Method (_Q11, 0, NotSerialized)
326 {
327 Store ("EC: BATTERY SHUTDOWN", Debug)
328 Notify (BAT0, 0x80)
329 }
330
Duncan Lauried338b462013-07-31 15:30:41 -0700331 // Throttle Start
332 Method (_Q12, 0, NotSerialized)
333 {
Martin Roth6b1ceac2018-05-06 17:58:36 -0500334#ifdef EC_ENABLE_THROTTLING_HANDLER
Duncan Lauried338b462013-07-31 15:30:41 -0700335 Store ("EC: THROTTLE START", Debug)
Martin Roth6b1ceac2018-05-06 17:58:36 -0500336 \_TZ.THRT (1)
337#endif
Duncan Lauried338b462013-07-31 15:30:41 -0700338 }
339
340 // Throttle Stop
341 Method (_Q13, 0, NotSerialized)
342 {
Martin Roth6b1ceac2018-05-06 17:58:36 -0500343#ifdef EC_ENABLE_THROTTLING_HANDLER
Duncan Lauried338b462013-07-31 15:30:41 -0700344 Store ("EC: THROTTLE STOP", Debug)
Martin Roth6b1ceac2018-05-06 17:58:36 -0500345 \_TZ.THRT (0)
346#endif
Duncan Lauried338b462013-07-31 15:30:41 -0700347 }
348
Shawn Nematbakhsh98cc94c2014-08-28 11:33:41 -0700349#ifdef EC_ENABLE_PD_MCU_DEVICE
350 // PD event
351 Method (_Q16, 0, NotSerialized)
352 {
353 Store ("EC: GOT PD EVENT", Debug)
Prashant Malanidabc0ad2020-03-10 15:42:54 -0700354 Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80)
Shawn Nematbakhsh98cc94c2014-08-28 11:33:41 -0700355 }
356#endif
357
Duncan Lauried8401182014-09-29 08:32:19 -0700358 // Battery Status
359 Method (_Q17, 0, NotSerialized)
360 {
361 Store ("EC: BATTERY STATUS", Debug)
362 Notify (BAT0, 0x80)
Nicolas Boichat07fe6182018-01-26 14:37:16 +0800363#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE
364 If (CondRefOf (BAT1)) {
365 Notify (BAT1, 0x80)
366 }
367#endif
Duncan Lauried8401182014-09-29 08:32:19 -0700368 }
369
Gwendal Grignou95b7a6c2016-05-03 23:53:23 -0700370 // MKBP interrupt.
Gwendal Grignou880b4582016-06-20 08:49:25 -0700371 Method (_Q1B, 0, NotSerialized)
Gwendal Grignou95b7a6c2016-05-03 23:53:23 -0700372 {
373 Store ("EC: MKBP", Debug)
374 Notify (CREC, 0x80)
375 }
376
Brandon Breitensteinbc885c12020-04-01 13:30:37 -0700377#ifdef EC_ENABLE_PD_MCU_DEVICE
378 // USB MUX Interrupt
379 Method (_Q1C, 0, NotSerialized)
380 {
381 Store ("EC: USB MUX", Debug)
382 Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80)
383 }
384#endif
385
jiazi Yang51fc93f2016-07-28 05:15:01 -0400386 // TABLET mode switch Event
387 Method (_Q1D, 0, NotSerialized)
388 {
389 Store ("EC: TABLET mode switch Event", Debug)
Furquan Shaikha3a84562017-11-28 14:32:17 -0800390 Notify (CREC, 0x2)
Karthikeyan Ramasubramanian017b5c42018-11-14 08:53:01 -0700391#ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES
Martin Roth9c055982018-05-01 21:52:42 -0500392 \_SB.DPTF.TPET()
Furquan Shaikhc96ad862018-01-26 10:40:09 -0800393#endif
394#ifdef EC_ENABLE_TBMC_DEVICE
Gwendal Grignou87d5fb82017-01-19 18:30:21 -0800395 Notify (TBMC, 0x80)
Gwendal Grignou87d5fb82017-01-19 18:30:21 -0800396#endif
Chris Wange019bd92020-08-06 16:38:04 +0800397#ifdef EC_ENABLE_AMD_DPTC_SUPPORT
398 If (CondRefOf (\_SB.DPTC)) {
399 \_SB.DPTC()
400 }
401#endif
Furquan Shaikha3a84562017-11-28 14:32:17 -0800402 }
jiazi Yang51fc93f2016-07-28 05:15:01 -0400403
Duncan Lauriead8d9132013-12-10 07:41:33 -0800404 /*
405 * Dynamic Platform Thermal Framework support
406 */
407
Duncan Laurie93e24442014-01-06 12:30:52 -0800408 /* Mutex for EC PAT interface */
409 Mutex (PATM, 1)
410
Duncan Lauriead8d9132013-12-10 07:41:33 -0800411 /*
412 * Set Aux Trip Point 0
413 * Arg0 = Temp Sensor ID
414 * Arg1 = Value to set
415 */
416 Method (PAT0, 2, Serialized)
417 {
Duncan Laurie93e24442014-01-06 12:30:52 -0800418 If (Acquire (^PATM, 1000)) {
419 Return (0)
420 }
421
Duncan Laurie93e24442014-01-06 12:30:52 -0800422 /* Set sensor ID */
423 Store (ToInteger (Arg0), ^PATI)
424
Duncan Laurie8be67592014-01-09 10:01:05 -0800425 /* Temperature is passed in 1/10 Kelvin */
Duncan Laurie20373c02015-09-22 09:40:37 -0700426 Divide (ToInteger (Arg1), 10, , Local1)
Duncan Laurie8be67592014-01-09 10:01:05 -0800427
428 /* Adjust by EC temperature offset */
429 Subtract (Local1, ^TOFS, ^PATT)
Duncan Laurie93e24442014-01-06 12:30:52 -0800430
431 /* Set commit value with SELECT=0 and ENABLE=1 */
432 Store (0x02, ^PATC)
433
434 Release (^PATM)
435 Return (1)
Duncan Lauriead8d9132013-12-10 07:41:33 -0800436 }
437
438 /*
439 * Set Aux Trip Point 1
440 * Arg0 = Temp Sensor ID
441 * Arg1 = Value to set
442 */
443 Method (PAT1, 2, Serialized)
444 {
Duncan Laurie93e24442014-01-06 12:30:52 -0800445 If (Acquire (^PATM, 1000)) {
446 Return (0)
447 }
448
Duncan Laurie93e24442014-01-06 12:30:52 -0800449 /* Set sensor ID */
450 Store (ToInteger (Arg0), ^PATI)
451
Duncan Laurie8be67592014-01-09 10:01:05 -0800452 /* Temperature is passed in 1/10 Kelvin */
Duncan Laurie20373c02015-09-22 09:40:37 -0700453 Divide (ToInteger (Arg1), 10, , Local1)
Duncan Laurie8be67592014-01-09 10:01:05 -0800454
455 /* Adjust by EC temperature offset */
456 Subtract (Local1, ^TOFS, ^PATT)
Duncan Laurie93e24442014-01-06 12:30:52 -0800457
458 /* Set commit value with SELECT=1 and ENABLE=1 */
459 Store (0x03, ^PATC)
460
461 Release (^PATM)
462 Return (1)
463 }
464
Duncan Laurie8be67592014-01-09 10:01:05 -0800465 /* Disable Aux Trip Points
466 * Arg0 = Temp Sensor ID
467 */
468 Method (PATD, 1, Serialized)
Duncan Laurie93e24442014-01-06 12:30:52 -0800469 {
470 If (Acquire (^PATM, 1000)) {
471 Return (0)
472 }
473
Duncan Laurie8be67592014-01-09 10:01:05 -0800474 Store (ToInteger (Arg0), ^PATI)
Duncan Laurie93e24442014-01-06 12:30:52 -0800475 Store (0x00, ^PATT)
476
477 /* Disable PAT0 */
478 Store (0x00, ^PATC)
479
480 /* Disable PAT1 */
481 Store (0x01, ^PATC)
482
483 Release (^PATM)
484 Return (1)
Duncan Lauriead8d9132013-12-10 07:41:33 -0800485 }
486
487 /*
Duncan Laurie93e24442014-01-06 12:30:52 -0800488 * Thermal Threshold Event
Duncan Lauriee6b280e2014-02-10 16:21:05 -0800489 */
Duncan Laurie8be67592014-01-09 10:01:05 -0800490 Method (_Q09, 0, NotSerialized)
Duncan Lauriead8d9132013-12-10 07:41:33 -0800491 {
Marc Jonese17ec3e2018-08-15 22:53:34 -0600492 If (LNot(Acquire (^PATM, 1000))) {
493 /* Read sensor ID for event */
494 Store (^PATI, Local0)
Duncan Laurie93e24442014-01-06 12:30:52 -0800495
Marc Jonese17ec3e2018-08-15 22:53:34 -0600496 /* When sensor ID returns 0xFF then no more events */
497 While (LNotEqual (Local0, EC_TEMP_SENSOR_NOT_PRESENT))
498 {
Martin Roth15f232d2018-04-29 22:41:58 -0500499#ifdef HAVE_THERM_EVENT_HANDLER
Marc Jonese17ec3e2018-08-15 22:53:34 -0600500 \_SB.DPTF.TEVT (Local0)
Martin Roth15f232d2018-04-29 22:41:58 -0500501#endif
Aaron Durbinb3ce6582014-05-13 09:23:10 -0500502
Marc Jonese17ec3e2018-08-15 22:53:34 -0600503 /* Keep reaading sensor ID for event */
504 Store (^PATI, Local0)
505 }
Duncan Laurie93e24442014-01-06 12:30:52 -0800506
Marc Jonese17ec3e2018-08-15 22:53:34 -0600507 Release (^PATM)
508 }
Duncan Lauriead8d9132013-12-10 07:41:33 -0800509 }
510
Duncan Lauriee6b280e2014-02-10 16:21:05 -0800511 /*
512 * Set Charger Current Limit
513 * Arg0 = Current Limit in 64mA steps
514 */
515 Method (CHGS, 1, Serialized)
516 {
517 Store (ToInteger (Arg0), ^CHGL)
518 }
519
520 /*
521 * Disable Charger Current Limit
522 */
523 Method (CHGD, 0, Serialized)
524 {
525 Store (0xFF, ^CHGL)
526 }
527
jiazi Yang51fc93f2016-07-28 05:15:01 -0400528 /* Read current Tablet mode */
529 Method (RCTM, 0, NotSerialized)
530 {
531 Return (^TBMD)
532 }
533
Wim Vervoorn8629b492020-01-15 09:16:46 +0100534#ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES
Karthikeyan Ramasubramanian036ccd72018-10-23 22:16:36 -0600535 /* Read current Device DPTF Profile Number */
536 Method (RCDP, 0, NotSerialized)
537 {
538 /*
539 * DDPN = 0 is reserved for backwards compatibility.
540 * If DDPN == 0 use TBMD to load appropriate DPTF table.
541 */
542 If (LEqual (^DDPN, 0)) {
543 Return (^TBMD)
544 } Else {
545 Subtract (^DDPN, 1, Local0)
546 Return (Local0)
547 }
548 }
Wim Vervoorn8629b492020-01-15 09:16:46 +0100549#endif
Julius Wernercd49cce2019-03-05 16:53:33 -0800550#if CONFIG(EC_GOOGLE_CHROMEEC_ACPI_USB_PORT_POWER)
Emil Lundmark9d5f9f22018-05-22 19:31:37 +0200551 /*
552 * Enable USB Port Power
553 * Arg0 = USB port ID
554 */
555 Method (UPPS, 1, Serialized)
556 {
557 Or (USPP, ShiftLeft (1, Arg0), USPP)
558 }
559
560 /*
561 * Disable USB Port Power
562 * Arg0 = USB port ID
563 */
564 Method (UPPC, 1, Serialized)
565 {
566 And (USPP, Not (ShiftLeft (1, Arg0)), USPP)
567 }
568#endif
569
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800570 #include "ac.asl"
571 #include "battery.asl"
Gwendal Grignou866cc3d2016-05-03 23:24:53 -0700572 #include "cros_ec.asl"
Duncan Laurie612163eb2014-06-13 10:35:22 -0700573
574#ifdef EC_ENABLE_ALS_DEVICE
575 #include "als.asl"
576#endif
Shawn Nematbakhsh98cc94c2014-08-28 11:33:41 -0700577
Duncan Laurieef549a02015-09-01 09:47:55 -0700578#ifdef EC_ENABLE_KEYBOARD_BACKLIGHT
Elyes HAOUASb9331092016-09-05 19:55:34 +0200579 #include "keyboard_backlight.asl"
Duncan Laurieef549a02015-09-01 09:47:55 -0700580#endif
581
Furquan Shaikhc96ad862018-01-26 10:40:09 -0800582#ifdef EC_ENABLE_TBMC_DEVICE
Gwendal Grignou87d5fb82017-01-19 18:30:21 -0800583 #include "tbmc.asl"
584#endif
Stefan Reinauerd6682e82013-02-21 15:39:35 -0800585}