Angel Pons | 210a008 | 2020-04-02 23:48:24 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 2 | |
| 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 | |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 9 | // DTT Power Participant Device Notification |
| 10 | #define POWER_STATE_CHANGE_NOTIFICATION 0x81 |
Tony Huang | a434f61 | 2022-08-09 11:32:55 +0800 | [diff] [blame] | 11 | // DTT OEM variables change notification |
| 12 | #define EC_OEM_VARIABLE_DATA_MASK 0x7 |
| 13 | #define INT3400_ODVP_CHANGED 0x88 |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 14 | |
Rob Barnes | a3148ca | 2022-11-08 07:47:14 -0700 | [diff] [blame] | 15 | #define ACPI_NOTIFY_CROS_EC_PANIC 0xB0 |
| 16 | |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 17 | // Mainboard specific throttle handler |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 18 | #ifdef DPTF_ENABLE_CHARGER |
Duncan Laurie | 3f1500f | 2014-03-06 08:37:49 -0800 | [diff] [blame] | 19 | External (\_SB.DPTF.TCHG, DeviceObj) |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 20 | #endif |
Chris Wang | e019bd9 | 2020-08-06 16:38:04 +0800 | [diff] [blame] | 21 | /* Enable DPTC interface with AMD ALIB */ |
Tim Van Patten | 2873fd2 | 2022-08-29 11:36:35 -0600 | [diff] [blame] | 22 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
Chris Wang | e019bd9 | 2020-08-06 16:38:04 +0800 | [diff] [blame] | 23 | External(\_SB.DPTC, MethodObj) |
| 24 | #endif |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 25 | |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 26 | External (\_SB.DPTF.TPWR, DeviceObj) |
| 27 | |
Tony Huang | a434f61 | 2022-08-09 11:32:55 +0800 | [diff] [blame] | 28 | #ifdef DPTF_ENABLE_OEM_VARIABLES |
| 29 | External (\_SB.DPTF.ODVP, MethodObj) |
| 30 | External (\_SB.DPTF.ODGT, MethodObj) |
| 31 | External (\_SB.DPTF.ODUP, MethodObj) |
| 32 | #endif |
| 33 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 34 | Device (EC0) |
| 35 | { |
| 36 | Name (_HID, EISAID ("PNP0C09")) |
| 37 | Name (_UID, 1) |
Duncan Laurie | 045222f | 2013-05-21 07:49:11 -0700 | [diff] [blame] | 38 | Name (_GPE, EC_SCI_GPI) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 39 | Name (TOFS, EC_TEMP_SENSOR_OFFSET) |
Duncan Laurie | 433432b | 2013-06-03 10:38:22 -0700 | [diff] [blame] | 40 | Name (TNCA, EC_TEMP_SENSOR_NOT_CALIBRATED) |
| 41 | Name (TNOP, EC_TEMP_SENSOR_NOT_POWERED) |
| 42 | Name (TBAD, EC_TEMP_SENSOR_ERROR) |
| 43 | Name (TNPR, EC_TEMP_SENSOR_NOT_PRESENT) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 44 | Name (DWRN, 15) // Battery capacity warning at 15% |
| 45 | Name (DLOW, 10) // Battery capacity low at 10% |
| 46 | |
Shawn Nematbakhsh | 37b7a66 | 2015-03-24 11:07:51 -0700 | [diff] [blame] | 47 | OperationRegion (ERAM, EmbeddedControl, 0x00, EC_ACPI_MEM_MAPPED_BEGIN) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 48 | Field (ERAM, ByteAcc, Lock, Preserve) |
| 49 | { |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 50 | RAMV, 8, // EC RAM Version |
| 51 | TSTB, 8, // Test Byte |
| 52 | TSTC, 8, // Complement of Test Byte |
Patrick Georgi | f9267f9 | 2017-08-24 23:12:55 +0200 | [diff] [blame] | 53 | KBLV, 8, // Keyboard Backlight value |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 54 | FAND, 8, // Set Fan Duty Cycle |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 55 | PATI, 8, // Programmable Auxiliary Trip Sensor ID |
| 56 | PATT, 8, // Programmable Auxiliary Trip Threshold |
| 57 | PATC, 8, // Programmable Auxiliary Trip Commit |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 58 | CHGL, 8, // Charger Current Limit |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 59 | TBMD, 1, // Tablet mode |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 60 | DDPN, 3, // Device DPTF Profile Number |
EricKY Cheng | 065c587 | 2022-10-03 16:24:04 +0800 | [diff] [blame] | 61 | STTB, 1, // Switch thermal table by body detection status |
Patrick Georgi | f9267f9 | 2017-08-24 23:12:55 +0200 | [diff] [blame] | 62 | // DFUD must be 0 for the other 31 values to be valid |
Patrick Georgi | 4bd68b8 | 2017-08-18 21:06:24 +0200 | [diff] [blame] | 63 | Offset (0x0a), |
Patrick Georgi | f9267f9 | 2017-08-24 23:12:55 +0200 | [diff] [blame] | 64 | DFUD, 1, // Device Features Undefined |
| 65 | FLSH, 1, // Flash commands present |
| 66 | PFAN, 1, // PWM Fan control present |
| 67 | KBLE, 1, // Keyboard Backlight present |
| 68 | LTBR, 1, // Lightbar present |
| 69 | LEDC, 1, // LED control |
| 70 | MTNS, 1, // Motion sensors present |
| 71 | KEYB, 1, // EC is keyboard controller |
| 72 | PSTR, 1, // Persistent storage |
| 73 | P80P, 1, // EC serves I/O Port 80h |
| 74 | THRM, 1, // EC supports thermal management |
| 75 | SBKL, 1, // Screen backlight switch present |
| 76 | WIFI, 1, // WIFI switch present |
| 77 | HOST, 1, // EC monitors host events (eg SCI, SMI) |
| 78 | GPIO, 1, // EC provides GPIO commands |
| 79 | I2CB, 1, // EC provides I2C controller access |
| 80 | CHRG, 1, // EC provides commands for charger control |
| 81 | BATT, 1, // Simply Battery support |
| 82 | SBAT, 1, // Smart Battery support |
| 83 | HANG, 1, // EC can detect host hang |
| 84 | PMUI, 1, // Power Information |
| 85 | DSEC, 1, // another EC exists downstream |
| 86 | UPDC, 1, // supports USB Power Delivery |
| 87 | UMUX, 1, // supports USB Mux |
| 88 | MSFF, 1, // Motion Sense has FIFO |
| 89 | TVST, 1, // supports temporary secure vstore |
| 90 | TCMV, 1, // USB Type C Muxing is virtual (host assisted) |
| 91 | RTCD, 1, // EC provides an RTC device |
| 92 | FPRD, 1, // EC provides a fingerprint reader device |
| 93 | TPAD, 1, // EC provides a touchpad device |
| 94 | RWSG, 1, // EC has RWSIG task enabled |
| 95 | DEVE, 1, // EC supports device events |
| 96 | // make sure we're within our space envelope |
| 97 | Offset (0x0e), |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 98 | Offset (0x12), |
| 99 | BTID, 8, // Battery index that host wants to read |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 100 | USPP, 8, // USB Port Power |
John Zhao | 408e5ab | 2021-01-01 12:25:56 -0800 | [diff] [blame] | 101 | RFWU, 8, // Retimer Firmware Update |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 102 | PBOK, 8, // Power source change count from dptf |
Subrata Banik | f5c3e29 | 2020-11-30 16:10:34 +0530 | [diff] [blame] | 103 | } |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 104 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 105 | #if CONFIG(EC_GOOGLE_CHROMEEC_ACPI_MEMMAP) |
Shawn Nematbakhsh | 37b7a66 | 2015-03-24 11:07:51 -0700 | [diff] [blame] | 106 | OperationRegion (EMEM, EmbeddedControl, |
| 107 | EC_ACPI_MEM_MAPPED_BEGIN, EC_ACPI_MEM_MAPPED_SIZE) |
| 108 | Field (EMEM, ByteAcc, Lock, Preserve) |
| 109 | #else |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 110 | OperationRegion (EMEM, SystemIO, EC_LPC_ADDR_MEMMAP, EC_MEMMAP_SIZE) |
| 111 | Field (EMEM, ByteAcc, NoLock, Preserve) |
Shawn Nematbakhsh | 37b7a66 | 2015-03-24 11:07:51 -0700 | [diff] [blame] | 112 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 113 | { |
Shawn Nematbakhsh | 37b7a66 | 2015-03-24 11:07:51 -0700 | [diff] [blame] | 114 | #include "emem.asl" |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 115 | } |
| 116 | |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 117 | #ifdef EC_ENABLE_LID_SWITCH |
| 118 | /* LID Switch */ |
| 119 | Device (LID0) |
| 120 | { |
| 121 | Name (_HID, EisaId ("PNP0C0D")) |
| 122 | Method (_LID, 0) |
| 123 | { |
| 124 | Return (^^LIDS) |
| 125 | } |
| 126 | |
| 127 | #ifdef EC_ENABLE_WAKE_PIN |
| 128 | Name (_PRW, Package () { EC_ENABLE_WAKE_PIN, 0x5 }) |
| 129 | #endif |
| 130 | } |
Felix Held | 831d686 | 2023-01-20 19:37:26 +0100 | [diff] [blame] | 131 | #endif /* EC_ENABLE_LID_SWITCH */ |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 132 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 133 | Method (TINS, 1, Serialized) |
| 134 | { |
| 135 | Switch (ToInteger (Arg0)) |
| 136 | { |
| 137 | Case (0) { Return (TIN0) } |
| 138 | Case (1) { Return (TIN1) } |
| 139 | Case (2) { Return (TIN2) } |
| 140 | Case (3) { Return (TIN3) } |
| 141 | Case (4) { Return (TIN4) } |
| 142 | Case (5) { Return (TIN5) } |
| 143 | Case (6) { Return (TIN6) } |
| 144 | Case (7) { Return (TIN7) } |
| 145 | Case (8) { Return (TIN8) } |
| 146 | Case (9) { Return (TIN9) } |
| 147 | Default { Return (TIN0) } |
| 148 | } |
| 149 | } |
| 150 | |
Duncan Laurie | 20373c0 | 2015-09-22 09:40:37 -0700 | [diff] [blame] | 151 | Method (_CRS, 0, Serialized) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 152 | { |
| 153 | Name (ECMD, ResourceTemplate() |
| 154 | { |
| 155 | IO (Decode16, |
| 156 | EC_LPC_ADDR_ACPI_DATA, |
| 157 | EC_LPC_ADDR_ACPI_DATA, |
| 158 | 0, 1) |
| 159 | IO (Decode16, |
| 160 | EC_LPC_ADDR_ACPI_CMD, |
| 161 | EC_LPC_ADDR_ACPI_CMD, |
| 162 | 0, 1) |
| 163 | }) |
| 164 | Return (ECMD) |
| 165 | } |
| 166 | |
| 167 | Method (_REG, 2, NotSerialized) |
| 168 | { |
| 169 | // Initialize AC power state |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 170 | \PWRS = ACEX |
Furquan Shaikh | 80c555d | 2020-06-12 10:01:20 -0700 | [diff] [blame] | 171 | /* |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 172 | * Call PNOT (Platform Notify) to inform platform code |
| 173 | * about the current AC/battery state. This handles all cases, |
| 174 | * the battery transitioning into and out of having critically |
| 175 | * low charge. |
Furquan Shaikh | 80c555d | 2020-06-12 10:01:20 -0700 | [diff] [blame] | 176 | * PWRS isn't valid before this point. |
| 177 | */ |
| 178 | \PNOT () |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 179 | |
Karthikeyan Ramasubramanian | 8fc20c4 | 2023-04-10 14:10:37 -0600 | [diff] [blame] | 180 | #ifndef EC_ENABLE_LID_SWITCH |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 181 | // Initialize LID switch state |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 182 | \LIDS = LIDS |
Karthikeyan Ramasubramanian | 8fc20c4 | 2023-04-10 14:10:37 -0600 | [diff] [blame] | 183 | #endif |
Kevin Chiu | 83f0c69 | 2020-09-22 00:48:36 +0800 | [diff] [blame] | 184 | |
Tim Van Patten | 2873fd2 | 2022-08-29 11:36:35 -0600 | [diff] [blame] | 185 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
Kevin Chiu | 83f0c69 | 2020-09-22 00:48:36 +0800 | [diff] [blame] | 186 | /* |
| 187 | * Per the device mode (clamshell or tablet) to initialize |
| 188 | * the thermal setting on OS startup. |
| 189 | */ |
| 190 | If (CondRefOf (\_SB.DPTC)) { |
| 191 | \_SB.DPTC() |
| 192 | } |
| 193 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 196 | /* Read requested temperature and check against EC error values */ |
| 197 | Method (TSRD, 1, Serialized) |
| 198 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 199 | Local0 = \_SB.PCI0.LPCB.EC0.TINS (Arg0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 200 | |
| 201 | /* Check for sensor not calibrated */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 202 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) { |
Felix Singer | 42efd7f | 2022-12-26 09:38:45 +0100 | [diff] [blame] | 203 | Return (0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | /* Check for sensor not present */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 207 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
Felix Singer | 42efd7f | 2022-12-26 09:38:45 +0100 | [diff] [blame] | 208 | Return (0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | /* Check for sensor not powered */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 212 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
Felix Singer | 42efd7f | 2022-12-26 09:38:45 +0100 | [diff] [blame] | 213 | Return (0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | /* Check for sensor bad reading */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 217 | If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
Felix Singer | 42efd7f | 2022-12-26 09:38:45 +0100 | [diff] [blame] | 218 | Return (0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | /* Adjust by offset to get Kelvin */ |
Felix Singer | 3a46206 | 2021-12-30 01:22:36 +0100 | [diff] [blame] | 222 | Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 223 | |
| 224 | /* Convert to 1/10 Kelvin */ |
Felix Singer | 89818d1 | 2022-01-01 23:36:28 +0100 | [diff] [blame] | 225 | Local0 *= 10 |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 226 | |
| 227 | Return (Local0) |
| 228 | } |
| 229 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 230 | // Lid Closed Event |
| 231 | Method (_Q01, 0, NotSerialized) |
| 232 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 233 | Printf ("EC: LID CLOSE") |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 234 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 235 | If (CondRefOf (\_SB.DPTC)) { |
| 236 | \_SB.DPTC() |
| 237 | } |
| 238 | #endif |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 239 | #ifdef EC_ENABLE_LID_SWITCH |
| 240 | Notify (LID0, 0x80) |
Karthikeyan Ramasubramanian | 8fc20c4 | 2023-04-10 14:10:37 -0600 | [diff] [blame] | 241 | #else |
| 242 | \LIDS = LIDS |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 243 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | // Lid Open Event |
| 247 | Method (_Q02, 0, NotSerialized) |
| 248 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 249 | Printf ("EC: LID OPEN") |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 250 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 251 | If (CondRefOf (\_SB.DPTC)) { |
| 252 | \_SB.DPTC() |
| 253 | } |
| 254 | #endif |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 255 | Notify (CREC, 0x2) |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 256 | #ifdef EC_ENABLE_LID_SWITCH |
| 257 | Notify (LID0, 0x80) |
Karthikeyan Ramasubramanian | 8fc20c4 | 2023-04-10 14:10:37 -0600 | [diff] [blame] | 258 | #else |
| 259 | \LIDS = LIDS |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 260 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | // Power Button |
| 264 | Method (_Q03, 0, NotSerialized) |
| 265 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 266 | Printf ("EC: POWER BUTTON") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | // AC Connected |
| 270 | Method (_Q04, 0, NotSerialized) |
| 271 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 272 | Printf ("EC: AC CONNECTED") |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 273 | \PWRS = ACEX |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 274 | Notify (AC, 0x80) |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 275 | #ifdef DPTF_ENABLE_CHARGER |
Duncan Laurie | 3f1500f | 2014-03-06 08:37:49 -0800 | [diff] [blame] | 276 | If (CondRefOf (\_SB.DPTF.TCHG)) { |
| 277 | Notify (\_SB.DPTF.TCHG, 0x80) |
| 278 | } |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 279 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 280 | /* |
| 281 | * Call PNOT (Platform Notify) to inform platform code |
| 282 | * about the current battery state. This handles all cases, |
| 283 | * the battery transitioning into and out of having critically |
| 284 | * low charge. |
| 285 | */ |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 286 | \PNOT () |
| 287 | } |
| 288 | |
| 289 | // AC Disconnected |
| 290 | Method (_Q05, 0, NotSerialized) |
| 291 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 292 | Printf ("EC: AC DISCONNECTED") |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 293 | \PWRS = ACEX |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 294 | Notify (AC, 0x80) |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 295 | #ifdef DPTF_ENABLE_CHARGER |
Duncan Laurie | 3f1500f | 2014-03-06 08:37:49 -0800 | [diff] [blame] | 296 | If (CondRefOf (\_SB.DPTF.TCHG)) { |
| 297 | Notify (\_SB.DPTF.TCHG, 0x80) |
| 298 | } |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 299 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 300 | /* |
| 301 | * Call PNOT (Platform Notify) to inform platform code |
| 302 | * about the current battery state. This handles all cases, |
| 303 | * the battery transitioning into and out of having critically |
| 304 | * low charge. |
| 305 | */ |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 306 | \PNOT () |
| 307 | } |
| 308 | |
| 309 | // Battery Low Event |
| 310 | Method (_Q06, 0, NotSerialized) |
| 311 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 312 | Printf ("EC: BATTERY LOW") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 313 | Notify (BAT0, 0x80) |
| 314 | } |
| 315 | |
| 316 | // Battery Critical Event |
| 317 | Method (_Q07, 0, NotSerialized) |
| 318 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 319 | Printf ("EC: BATTERY CRITICAL") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 320 | Notify (BAT0, 0x80) |
| 321 | } |
| 322 | |
| 323 | // Battery Info Event |
| 324 | Method (_Q08, 0, NotSerialized) |
| 325 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 326 | Printf ("EC: BATTERY INFO") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 327 | Notify (BAT0, 0x81) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 328 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 329 | If (CondRefOf (BAT1)) { |
| 330 | Notify (BAT1, 0x81) |
| 331 | } |
| 332 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 333 | } |
| 334 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 335 | // Thermal Overload Event |
| 336 | Method (_Q0A, 0, NotSerialized) |
| 337 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 338 | Printf ("EC: THERMAL OVERLOAD") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 339 | Notify (\_TZ, 0x80) |
| 340 | } |
| 341 | |
| 342 | // Thermal Event |
| 343 | Method (_Q0B, 0, NotSerialized) |
| 344 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 345 | Printf ("EC: THERMAL") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 346 | Notify (\_TZ, 0x80) |
| 347 | } |
| 348 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 349 | // Key Pressed |
| 350 | Method (_Q0D, 0, NotSerialized) |
| 351 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 352 | Printf ("EC: KEY PRESSED") |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 353 | Notify (CREC, 0x2) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 354 | } |
| 355 | |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 356 | // Thermal Shutdown Imminent |
| 357 | Method (_Q10, 0, NotSerialized) |
| 358 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 359 | Printf ("EC: THERMAL SHUTDOWN") |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 360 | Notify (\_TZ, 0x80) |
| 361 | } |
| 362 | |
| 363 | // Battery Shutdown Imminent |
| 364 | Method (_Q11, 0, NotSerialized) |
| 365 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 366 | Printf ("EC: BATTERY SHUTDOWN") |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 367 | Notify (BAT0, 0x80) |
| 368 | } |
| 369 | |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 370 | // Throttle Start |
| 371 | Method (_Q12, 0, NotSerialized) |
| 372 | { |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 373 | #ifdef EC_ENABLE_THROTTLING_HANDLER |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 374 | Printf ("EC: THROTTLE START") |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 375 | \_TZ.THRT (1) |
| 376 | #endif |
Tony Huang | a434f61 | 2022-08-09 11:32:55 +0800 | [diff] [blame] | 377 | |
| 378 | #ifdef DPTF_ENABLE_OEM_VARIABLES |
| 379 | Local0 = ToInteger(EOVD) & EC_OEM_VARIABLE_DATA_MASK |
| 380 | \_SB.DPTF.ODUP(0, Local0) |
| 381 | Local0 = \_SB.DPTF.ODGT(0) |
| 382 | \_SB.DPTF.ODVP() |
| 383 | Notify (\_SB.DPTF, INT3400_ODVP_CHANGED) |
| 384 | #endif |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | // Throttle Stop |
| 388 | Method (_Q13, 0, NotSerialized) |
| 389 | { |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 390 | #ifdef EC_ENABLE_THROTTLING_HANDLER |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 391 | Printf ("EC: THROTTLE STOP") |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 392 | \_TZ.THRT (0) |
| 393 | #endif |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 394 | } |
| 395 | |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 396 | #ifdef EC_ENABLE_PD_MCU_DEVICE |
| 397 | // PD event |
| 398 | Method (_Q16, 0, NotSerialized) |
| 399 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 400 | Printf ("EC: GOT PD EVENT") |
Prashant Malani | dabc0ad | 2020-03-10 15:42:54 -0700 | [diff] [blame] | 401 | Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 402 | If (CondRefOf (\_SB.DPTF.TPWR)) { |
| 403 | Notify (\_SB.DPTF.TPWR, POWER_STATE_CHANGE_NOTIFICATION) |
| 404 | } |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 405 | } |
| 406 | #endif |
| 407 | |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 408 | // Battery Status |
| 409 | Method (_Q17, 0, NotSerialized) |
| 410 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 411 | Printf ("EC: BATTERY STATUS") |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 412 | Notify (BAT0, 0x80) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 413 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 414 | If (CondRefOf (BAT1)) { |
| 415 | Notify (BAT1, 0x80) |
| 416 | } |
| 417 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 418 | |
| 419 | /* |
| 420 | * Call PNOT (Platform Notify) to inform platform code |
| 421 | * about the current battery state. This handles all cases, |
| 422 | * the battery transitioning into and out of having critically |
| 423 | * low charge. |
| 424 | */ |
| 425 | \PNOT () |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 426 | } |
| 427 | |
Rob Barnes | a3148ca | 2022-11-08 07:47:14 -0700 | [diff] [blame] | 428 | // EC Panic |
| 429 | Method (_Q18, 0, NotSerialized) |
| 430 | { |
| 431 | Printf ("EC: PANIC") |
| 432 | Notify (CREC, ACPI_NOTIFY_CROS_EC_PANIC) |
| 433 | } |
| 434 | |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 435 | // MKBP interrupt. |
Gwendal Grignou | 880b458 | 2016-06-20 08:49:25 -0700 | [diff] [blame] | 436 | Method (_Q1B, 0, NotSerialized) |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 437 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 438 | Printf ("EC: MKBP") |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 439 | Notify (CREC, 0x80) |
| 440 | } |
| 441 | |
Brandon Breitenstein | bc885c1 | 2020-04-01 13:30:37 -0700 | [diff] [blame] | 442 | #ifdef EC_ENABLE_PD_MCU_DEVICE |
| 443 | // USB MUX Interrupt |
| 444 | Method (_Q1C, 0, NotSerialized) |
| 445 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 446 | Printf ("EC: USB MUX") |
Brandon Breitenstein | bc885c1 | 2020-04-01 13:30:37 -0700 | [diff] [blame] | 447 | Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) |
| 448 | } |
| 449 | #endif |
| 450 | |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 451 | // TABLET mode switch Event |
| 452 | Method (_Q1D, 0, NotSerialized) |
| 453 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 454 | Printf ("EC: TABLET mode switch Event") |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 455 | Notify (CREC, 0x2) |
Karthikeyan Ramasubramanian | 017b5c4 | 2018-11-14 08:53:01 -0700 | [diff] [blame] | 456 | #ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES |
Martin Roth | 9c05598 | 2018-05-01 21:52:42 -0500 | [diff] [blame] | 457 | \_SB.DPTF.TPET() |
Furquan Shaikh | c96ad86 | 2018-01-26 10:40:09 -0800 | [diff] [blame] | 458 | #endif |
| 459 | #ifdef EC_ENABLE_TBMC_DEVICE |
Matt DeVillier | 3f0de3d | 2022-10-18 17:53:08 -0500 | [diff] [blame^] | 460 | Notify (^CREC.TBMC, 0x80) |
Gwendal Grignou | 87d5fb8 | 2017-01-19 18:30:21 -0800 | [diff] [blame] | 461 | #endif |
Tim Van Patten | 2873fd2 | 2022-08-29 11:36:35 -0600 | [diff] [blame] | 462 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
Chris Wang | e019bd9 | 2020-08-06 16:38:04 +0800 | [diff] [blame] | 463 | If (CondRefOf (\_SB.DPTC)) { |
| 464 | \_SB.DPTC() |
| 465 | } |
| 466 | #endif |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 467 | } |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 468 | |
Tim Van Patten | 64871ad | 2023-02-10 14:03:30 -0700 | [diff] [blame] | 469 | // Body Detect Change Event |
| 470 | Method (_Q21, 0, NotSerialized) |
| 471 | { |
| 472 | Printf ("EC: Body Detect Change Event") |
| 473 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 474 | If (CondRefOf (\_SB.DPTC)) { |
| 475 | \_SB.DPTC() |
| 476 | } |
| 477 | #endif |
| 478 | } |
| 479 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 480 | /* |
| 481 | * Dynamic Platform Thermal Framework support |
| 482 | */ |
| 483 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 484 | /* Mutex for EC PAT interface */ |
| 485 | Mutex (PATM, 1) |
| 486 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 487 | /* |
| 488 | * Set Aux Trip Point 0 |
| 489 | * Arg0 = Temp Sensor ID |
| 490 | * Arg1 = Value to set |
| 491 | */ |
| 492 | Method (PAT0, 2, Serialized) |
| 493 | { |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 494 | If (Acquire (^PATM, 1000)) { |
| 495 | Return (0) |
| 496 | } |
| 497 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 498 | /* Set sensor ID */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 499 | ^PATI = ToInteger (Arg0) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 500 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 501 | /* Temperature is passed in 1/10 Kelvin */ |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 502 | Local1 = ToInteger (Arg1) / 10 |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 503 | |
| 504 | /* Adjust by EC temperature offset */ |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 505 | ^PATT = Local1 - ^TOFS |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 506 | |
| 507 | /* Set commit value with SELECT=0 and ENABLE=1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 508 | ^PATC = 0x02 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 509 | |
| 510 | Release (^PATM) |
| 511 | Return (1) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | /* |
| 515 | * Set Aux Trip Point 1 |
| 516 | * Arg0 = Temp Sensor ID |
| 517 | * Arg1 = Value to set |
| 518 | */ |
| 519 | Method (PAT1, 2, Serialized) |
| 520 | { |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 521 | If (Acquire (^PATM, 1000)) { |
| 522 | Return (0) |
| 523 | } |
| 524 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 525 | /* Set sensor ID */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 526 | ^PATI = ToInteger (Arg0) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 527 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 528 | /* Temperature is passed in 1/10 Kelvin */ |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 529 | Local1 = ToInteger (Arg1) / 10 |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 530 | |
| 531 | /* Adjust by EC temperature offset */ |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 532 | ^PATT = Local1 - ^TOFS |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 533 | |
| 534 | /* Set commit value with SELECT=1 and ENABLE=1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 535 | ^PATC = 0x03 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 536 | |
| 537 | Release (^PATM) |
| 538 | Return (1) |
| 539 | } |
| 540 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 541 | /* Disable Aux Trip Points |
| 542 | * Arg0 = Temp Sensor ID |
| 543 | */ |
| 544 | Method (PATD, 1, Serialized) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 545 | { |
| 546 | If (Acquire (^PATM, 1000)) { |
| 547 | Return (0) |
| 548 | } |
| 549 | |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 550 | ^PATI = ToInteger (Arg0) |
| 551 | ^PATT = 0x00 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 552 | |
| 553 | /* Disable PAT0 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 554 | ^PATC = 0x00 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 555 | |
| 556 | /* Disable PAT1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 557 | ^PATC = 0x01 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 558 | |
| 559 | Release (^PATM) |
| 560 | Return (1) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 561 | } |
| 562 | |
| 563 | /* |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 564 | * Thermal Threshold Event |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 565 | */ |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 566 | Method (_Q09, 0, NotSerialized) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 567 | { |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 568 | |
| 569 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 570 | If (CondRefOf (\_SB.DPTC)) { |
| 571 | \_SB.DPTC() |
| 572 | } |
| 573 | #endif |
Felix Singer | 98be4d6 | 2021-12-31 14:32:03 +0100 | [diff] [blame] | 574 | If (!Acquire (^PATM, 1000)) { |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 575 | /* Read sensor ID for event */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 576 | Local0 = ^PATI |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 577 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 578 | /* When sensor ID returns 0xFF then no more events */ |
Felix Singer | 8ab0975 | 2022-01-02 02:48:53 +0100 | [diff] [blame] | 579 | While (Local0 != EC_TEMP_SENSOR_NOT_PRESENT) |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 580 | { |
Martin Roth | 15f232d | 2018-04-29 22:41:58 -0500 | [diff] [blame] | 581 | #ifdef HAVE_THERM_EVENT_HANDLER |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 582 | \_SB.DPTF.TEVT (Local0) |
Martin Roth | 15f232d | 2018-04-29 22:41:58 -0500 | [diff] [blame] | 583 | #endif |
Aaron Durbin | b3ce658 | 2014-05-13 09:23:10 -0500 | [diff] [blame] | 584 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 585 | /* Keep reaading sensor ID for event */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 586 | Local0 = ^PATI |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 587 | } |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 588 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 589 | Release (^PATM) |
| 590 | } |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 591 | } |
| 592 | |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 593 | /* |
| 594 | * Set Charger Current Limit |
| 595 | * Arg0 = Current Limit in 64mA steps |
| 596 | */ |
| 597 | Method (CHGS, 1, Serialized) |
| 598 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 599 | ^CHGL = ToInteger (Arg0) |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | /* |
| 603 | * Disable Charger Current Limit |
| 604 | */ |
| 605 | Method (CHGD, 0, Serialized) |
| 606 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 607 | ^CHGL = 0xFF |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 608 | } |
| 609 | |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 610 | /* Read current Tablet mode */ |
| 611 | Method (RCTM, 0, NotSerialized) |
| 612 | { |
| 613 | Return (^TBMD) |
| 614 | } |
| 615 | |
Wim Vervoorn | 8629b49 | 2020-01-15 09:16:46 +0100 | [diff] [blame] | 616 | #ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 617 | /* Read current Device DPTF Profile Number */ |
| 618 | Method (RCDP, 0, NotSerialized) |
| 619 | { |
| 620 | /* |
| 621 | * DDPN = 0 is reserved for backwards compatibility. |
| 622 | * If DDPN == 0 use TBMD to load appropriate DPTF table. |
| 623 | */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 624 | If (^DDPN == 0) { |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 625 | Return (^TBMD) |
| 626 | } Else { |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 627 | Local0 = ^DDPN - 1 |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 628 | Return (Local0) |
| 629 | } |
| 630 | } |
Wim Vervoorn | 8629b49 | 2020-01-15 09:16:46 +0100 | [diff] [blame] | 631 | #endif |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 632 | #if CONFIG(EC_GOOGLE_CHROMEEC_ACPI_USB_PORT_POWER) |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 633 | /* |
| 634 | * Enable USB Port Power |
| 635 | * Arg0 = USB port ID |
| 636 | */ |
| 637 | Method (UPPS, 1, Serialized) |
| 638 | { |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 639 | USPP |= 1 << Arg0 |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | /* |
| 643 | * Disable USB Port Power |
| 644 | * Arg0 = USB port ID |
| 645 | */ |
| 646 | Method (UPPC, 1, Serialized) |
| 647 | { |
Felix Singer | c87c1ab | 2022-12-25 16:25:06 +0100 | [diff] [blame] | 648 | USPP &= ~(1 << Arg0) |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 649 | } |
| 650 | #endif |
| 651 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 652 | #include "ac.asl" |
| 653 | #include "battery.asl" |
Gwendal Grignou | 866cc3d | 2016-05-03 23:24:53 -0700 | [diff] [blame] | 654 | #include "cros_ec.asl" |
Duncan Laurie | 612163eb | 2014-06-13 10:35:22 -0700 | [diff] [blame] | 655 | |
| 656 | #ifdef EC_ENABLE_ALS_DEVICE |
| 657 | #include "als.asl" |
| 658 | #endif |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 659 | |
Duncan Laurie | ef549a0 | 2015-09-01 09:47:55 -0700 | [diff] [blame] | 660 | #ifdef EC_ENABLE_KEYBOARD_BACKLIGHT |
Elyes HAOUAS | b933109 | 2016-09-05 19:55:34 +0200 | [diff] [blame] | 661 | #include "keyboard_backlight.asl" |
Duncan Laurie | ef549a0 | 2015-09-01 09:47:55 -0700 | [diff] [blame] | 662 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 663 | } |