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 | } |
| 131 | #endif |
| 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 | |
| 180 | // Initialize LID switch state |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 181 | \LIDS = LIDS |
Kevin Chiu | 83f0c69 | 2020-09-22 00:48:36 +0800 | [diff] [blame] | 182 | |
Tim Van Patten | 2873fd2 | 2022-08-29 11:36:35 -0600 | [diff] [blame] | 183 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
Kevin Chiu | 83f0c69 | 2020-09-22 00:48:36 +0800 | [diff] [blame] | 184 | /* |
| 185 | * Per the device mode (clamshell or tablet) to initialize |
| 186 | * the thermal setting on OS startup. |
| 187 | */ |
| 188 | If (CondRefOf (\_SB.DPTC)) { |
| 189 | \_SB.DPTC() |
| 190 | } |
| 191 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 192 | } |
| 193 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 194 | /* Read requested temperature and check against EC error values */ |
| 195 | Method (TSRD, 1, Serialized) |
| 196 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 197 | Local0 = \_SB.PCI0.LPCB.EC0.TINS (Arg0) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 198 | |
| 199 | /* Check for sensor not calibrated */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 200 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNCA) { |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 201 | Return (Zero) |
| 202 | } |
| 203 | |
| 204 | /* Check for sensor not present */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 205 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNPR) { |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 206 | Return (Zero) |
| 207 | } |
| 208 | |
| 209 | /* Check for sensor not powered */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 210 | If (Local0 == \_SB.PCI0.LPCB.EC0.TNOP) { |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 211 | Return (Zero) |
| 212 | } |
| 213 | |
| 214 | /* Check for sensor bad reading */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 215 | If (Local0 == \_SB.PCI0.LPCB.EC0.TBAD) { |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 216 | Return (Zero) |
| 217 | } |
| 218 | |
| 219 | /* Adjust by offset to get Kelvin */ |
Felix Singer | 3a46206 | 2021-12-30 01:22:36 +0100 | [diff] [blame] | 220 | Local0 += \_SB.PCI0.LPCB.EC0.TOFS |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 221 | |
| 222 | /* Convert to 1/10 Kelvin */ |
Felix Singer | 89818d1 | 2022-01-01 23:36:28 +0100 | [diff] [blame] | 223 | Local0 *= 10 |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 224 | |
| 225 | Return (Local0) |
| 226 | } |
| 227 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 228 | // Lid Closed Event |
| 229 | Method (_Q01, 0, NotSerialized) |
| 230 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 231 | Printf ("EC: LID CLOSE") |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 232 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 233 | If (CondRefOf (\_SB.DPTC)) { |
| 234 | \_SB.DPTC() |
| 235 | } |
| 236 | #endif |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 237 | \LIDS = LIDS |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 238 | #ifdef EC_ENABLE_LID_SWITCH |
| 239 | Notify (LID0, 0x80) |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 240 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | // Lid Open Event |
| 244 | Method (_Q02, 0, NotSerialized) |
| 245 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 246 | Printf ("EC: LID OPEN") |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 247 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 248 | If (CondRefOf (\_SB.DPTC)) { |
| 249 | \_SB.DPTC() |
| 250 | } |
| 251 | #endif |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 252 | \LIDS = LIDS |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 253 | Notify (CREC, 0x2) |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 254 | #ifdef EC_ENABLE_LID_SWITCH |
| 255 | Notify (LID0, 0x80) |
Aaron Durbin | 05201d7 | 2016-09-23 16:06:14 -0500 | [diff] [blame] | 256 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | // Power Button |
| 260 | Method (_Q03, 0, NotSerialized) |
| 261 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 262 | Printf ("EC: POWER BUTTON") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 263 | } |
| 264 | |
| 265 | // AC Connected |
| 266 | Method (_Q04, 0, NotSerialized) |
| 267 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 268 | Printf ("EC: AC CONNECTED") |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 269 | \PWRS = ACEX |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 270 | Notify (AC, 0x80) |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 271 | #ifdef DPTF_ENABLE_CHARGER |
Duncan Laurie | 3f1500f | 2014-03-06 08:37:49 -0800 | [diff] [blame] | 272 | If (CondRefOf (\_SB.DPTF.TCHG)) { |
| 273 | Notify (\_SB.DPTF.TCHG, 0x80) |
| 274 | } |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 275 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 276 | /* |
| 277 | * Call PNOT (Platform Notify) to inform platform code |
| 278 | * about the current battery state. This handles all cases, |
| 279 | * the battery transitioning into and out of having critically |
| 280 | * low charge. |
| 281 | */ |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 282 | \PNOT () |
| 283 | } |
| 284 | |
| 285 | // AC Disconnected |
| 286 | Method (_Q05, 0, NotSerialized) |
| 287 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 288 | Printf ("EC: AC DISCONNECTED") |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 289 | \PWRS = ACEX |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 290 | Notify (AC, 0x80) |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 291 | #ifdef DPTF_ENABLE_CHARGER |
Duncan Laurie | 3f1500f | 2014-03-06 08:37:49 -0800 | [diff] [blame] | 292 | If (CondRefOf (\_SB.DPTF.TCHG)) { |
| 293 | Notify (\_SB.DPTF.TCHG, 0x80) |
| 294 | } |
Freddy Paul | e8cc52f | 2015-10-02 19:06:57 -0700 | [diff] [blame] | 295 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 296 | /* |
| 297 | * Call PNOT (Platform Notify) to inform platform code |
| 298 | * about the current battery state. This handles all cases, |
| 299 | * the battery transitioning into and out of having critically |
| 300 | * low charge. |
| 301 | */ |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 302 | \PNOT () |
| 303 | } |
| 304 | |
| 305 | // Battery Low Event |
| 306 | Method (_Q06, 0, NotSerialized) |
| 307 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 308 | Printf ("EC: BATTERY LOW") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 309 | Notify (BAT0, 0x80) |
| 310 | } |
| 311 | |
| 312 | // Battery Critical Event |
| 313 | Method (_Q07, 0, NotSerialized) |
| 314 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 315 | Printf ("EC: BATTERY CRITICAL") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 316 | Notify (BAT0, 0x80) |
| 317 | } |
| 318 | |
| 319 | // Battery Info Event |
| 320 | Method (_Q08, 0, NotSerialized) |
| 321 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 322 | Printf ("EC: BATTERY INFO") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 323 | Notify (BAT0, 0x81) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 324 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 325 | If (CondRefOf (BAT1)) { |
| 326 | Notify (BAT1, 0x81) |
| 327 | } |
| 328 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 329 | } |
| 330 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 331 | // Thermal Overload Event |
| 332 | Method (_Q0A, 0, NotSerialized) |
| 333 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 334 | Printf ("EC: THERMAL OVERLOAD") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 335 | Notify (\_TZ, 0x80) |
| 336 | } |
| 337 | |
| 338 | // Thermal Event |
| 339 | Method (_Q0B, 0, NotSerialized) |
| 340 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 341 | Printf ("EC: THERMAL") |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 342 | Notify (\_TZ, 0x80) |
| 343 | } |
| 344 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 345 | // Key Pressed |
| 346 | Method (_Q0D, 0, NotSerialized) |
| 347 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 348 | Printf ("EC: KEY PRESSED") |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 349 | Notify (CREC, 0x2) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 350 | } |
| 351 | |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 352 | // Thermal Shutdown Imminent |
| 353 | Method (_Q10, 0, NotSerialized) |
| 354 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 355 | Printf ("EC: THERMAL SHUTDOWN") |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 356 | Notify (\_TZ, 0x80) |
| 357 | } |
| 358 | |
| 359 | // Battery Shutdown Imminent |
| 360 | Method (_Q11, 0, NotSerialized) |
| 361 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 362 | Printf ("EC: BATTERY SHUTDOWN") |
Duncan Laurie | 18d9899b | 2013-08-28 09:54:04 -0700 | [diff] [blame] | 363 | Notify (BAT0, 0x80) |
| 364 | } |
| 365 | |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 366 | // Throttle Start |
| 367 | Method (_Q12, 0, NotSerialized) |
| 368 | { |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 369 | #ifdef EC_ENABLE_THROTTLING_HANDLER |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 370 | Printf ("EC: THROTTLE START") |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 371 | \_TZ.THRT (1) |
| 372 | #endif |
Tony Huang | a434f61 | 2022-08-09 11:32:55 +0800 | [diff] [blame] | 373 | |
| 374 | #ifdef DPTF_ENABLE_OEM_VARIABLES |
| 375 | Local0 = ToInteger(EOVD) & EC_OEM_VARIABLE_DATA_MASK |
| 376 | \_SB.DPTF.ODUP(0, Local0) |
| 377 | Local0 = \_SB.DPTF.ODGT(0) |
| 378 | \_SB.DPTF.ODVP() |
| 379 | Notify (\_SB.DPTF, INT3400_ODVP_CHANGED) |
| 380 | #endif |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 381 | } |
| 382 | |
| 383 | // Throttle Stop |
| 384 | Method (_Q13, 0, NotSerialized) |
| 385 | { |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 386 | #ifdef EC_ENABLE_THROTTLING_HANDLER |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 387 | Printf ("EC: THROTTLE STOP") |
Martin Roth | 6b1ceac | 2018-05-06 17:58:36 -0500 | [diff] [blame] | 388 | \_TZ.THRT (0) |
| 389 | #endif |
Duncan Laurie | d338b46 | 2013-07-31 15:30:41 -0700 | [diff] [blame] | 390 | } |
| 391 | |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 392 | #ifdef EC_ENABLE_PD_MCU_DEVICE |
| 393 | // PD event |
| 394 | Method (_Q16, 0, NotSerialized) |
| 395 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 396 | Printf ("EC: GOT PD EVENT") |
Prashant Malani | dabc0ad | 2020-03-10 15:42:54 -0700 | [diff] [blame] | 397 | Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) |
Varshit B Pandya | a872b9a | 2022-03-20 22:20:11 +0530 | [diff] [blame] | 398 | If (CondRefOf (\_SB.DPTF.TPWR)) { |
| 399 | Notify (\_SB.DPTF.TPWR, POWER_STATE_CHANGE_NOTIFICATION) |
| 400 | } |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 401 | } |
| 402 | #endif |
| 403 | |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 404 | // Battery Status |
| 405 | Method (_Q17, 0, NotSerialized) |
| 406 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 407 | Printf ("EC: BATTERY STATUS") |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 408 | Notify (BAT0, 0x80) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 409 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 410 | If (CondRefOf (BAT1)) { |
| 411 | Notify (BAT1, 0x80) |
| 412 | } |
| 413 | #endif |
Tim Van Patten | 14fa11f | 2022-08-22 14:06:11 -0600 | [diff] [blame] | 414 | |
| 415 | /* |
| 416 | * Call PNOT (Platform Notify) to inform platform code |
| 417 | * about the current battery state. This handles all cases, |
| 418 | * the battery transitioning into and out of having critically |
| 419 | * low charge. |
| 420 | */ |
| 421 | \PNOT () |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 422 | } |
| 423 | |
Rob Barnes | a3148ca | 2022-11-08 07:47:14 -0700 | [diff] [blame] | 424 | // EC Panic |
| 425 | Method (_Q18, 0, NotSerialized) |
| 426 | { |
| 427 | Printf ("EC: PANIC") |
| 428 | Notify (CREC, ACPI_NOTIFY_CROS_EC_PANIC) |
| 429 | } |
| 430 | |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 431 | // MKBP interrupt. |
Gwendal Grignou | 880b458 | 2016-06-20 08:49:25 -0700 | [diff] [blame] | 432 | Method (_Q1B, 0, NotSerialized) |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 433 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 434 | Printf ("EC: MKBP") |
Gwendal Grignou | 95b7a6c | 2016-05-03 23:53:23 -0700 | [diff] [blame] | 435 | Notify (CREC, 0x80) |
| 436 | } |
| 437 | |
Brandon Breitenstein | bc885c1 | 2020-04-01 13:30:37 -0700 | [diff] [blame] | 438 | #ifdef EC_ENABLE_PD_MCU_DEVICE |
| 439 | // USB MUX Interrupt |
| 440 | Method (_Q1C, 0, NotSerialized) |
| 441 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 442 | Printf ("EC: USB MUX") |
Brandon Breitenstein | bc885c1 | 2020-04-01 13:30:37 -0700 | [diff] [blame] | 443 | Notify (\_SB.PCI0.LPCB.EC0.CREC.ECPD, 0x80) |
| 444 | } |
| 445 | #endif |
| 446 | |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 447 | // TABLET mode switch Event |
| 448 | Method (_Q1D, 0, NotSerialized) |
| 449 | { |
Felix Singer | 3462a1b | 2021-12-26 15:05:45 +0100 | [diff] [blame] | 450 | Printf ("EC: TABLET mode switch Event") |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 451 | Notify (CREC, 0x2) |
Karthikeyan Ramasubramanian | 017b5c4 | 2018-11-14 08:53:01 -0700 | [diff] [blame] | 452 | #ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES |
Martin Roth | 9c05598 | 2018-05-01 21:52:42 -0500 | [diff] [blame] | 453 | \_SB.DPTF.TPET() |
Furquan Shaikh | c96ad86 | 2018-01-26 10:40:09 -0800 | [diff] [blame] | 454 | #endif |
| 455 | #ifdef EC_ENABLE_TBMC_DEVICE |
Gwendal Grignou | 87d5fb8 | 2017-01-19 18:30:21 -0800 | [diff] [blame] | 456 | Notify (TBMC, 0x80) |
Gwendal Grignou | 87d5fb8 | 2017-01-19 18:30:21 -0800 | [diff] [blame] | 457 | #endif |
Tim Van Patten | 2873fd2 | 2022-08-29 11:36:35 -0600 | [diff] [blame] | 458 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
Chris Wang | e019bd9 | 2020-08-06 16:38:04 +0800 | [diff] [blame] | 459 | If (CondRefOf (\_SB.DPTC)) { |
| 460 | \_SB.DPTC() |
| 461 | } |
| 462 | #endif |
Furquan Shaikh | a3a8456 | 2017-11-28 14:32:17 -0800 | [diff] [blame] | 463 | } |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 464 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 465 | /* |
| 466 | * Dynamic Platform Thermal Framework support |
| 467 | */ |
| 468 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 469 | /* Mutex for EC PAT interface */ |
| 470 | Mutex (PATM, 1) |
| 471 | |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 472 | /* |
| 473 | * Set Aux Trip Point 0 |
| 474 | * Arg0 = Temp Sensor ID |
| 475 | * Arg1 = Value to set |
| 476 | */ |
| 477 | Method (PAT0, 2, Serialized) |
| 478 | { |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 479 | If (Acquire (^PATM, 1000)) { |
| 480 | Return (0) |
| 481 | } |
| 482 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 483 | /* Set sensor ID */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 484 | ^PATI = ToInteger (Arg0) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 485 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 486 | /* Temperature is passed in 1/10 Kelvin */ |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 487 | Local1 = ToInteger (Arg1) / 10 |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 488 | |
| 489 | /* Adjust by EC temperature offset */ |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 490 | ^PATT = Local1 - ^TOFS |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 491 | |
| 492 | /* Set commit value with SELECT=0 and ENABLE=1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 493 | ^PATC = 0x02 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 494 | |
| 495 | Release (^PATM) |
| 496 | Return (1) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 497 | } |
| 498 | |
| 499 | /* |
| 500 | * Set Aux Trip Point 1 |
| 501 | * Arg0 = Temp Sensor ID |
| 502 | * Arg1 = Value to set |
| 503 | */ |
| 504 | Method (PAT1, 2, Serialized) |
| 505 | { |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 506 | If (Acquire (^PATM, 1000)) { |
| 507 | Return (0) |
| 508 | } |
| 509 | |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 510 | /* Set sensor ID */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 511 | ^PATI = ToInteger (Arg0) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 512 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 513 | /* Temperature is passed in 1/10 Kelvin */ |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 514 | Local1 = ToInteger (Arg1) / 10 |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 515 | |
| 516 | /* Adjust by EC temperature offset */ |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 517 | ^PATT = Local1 - ^TOFS |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 518 | |
| 519 | /* Set commit value with SELECT=1 and ENABLE=1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 520 | ^PATC = 0x03 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 521 | |
| 522 | Release (^PATM) |
| 523 | Return (1) |
| 524 | } |
| 525 | |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 526 | /* Disable Aux Trip Points |
| 527 | * Arg0 = Temp Sensor ID |
| 528 | */ |
| 529 | Method (PATD, 1, Serialized) |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 530 | { |
| 531 | If (Acquire (^PATM, 1000)) { |
| 532 | Return (0) |
| 533 | } |
| 534 | |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 535 | ^PATI = ToInteger (Arg0) |
| 536 | ^PATT = 0x00 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 537 | |
| 538 | /* Disable PAT0 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 539 | ^PATC = 0x00 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 540 | |
| 541 | /* Disable PAT1 */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 542 | ^PATC = 0x01 |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 543 | |
| 544 | Release (^PATM) |
| 545 | Return (1) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | /* |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 549 | * Thermal Threshold Event |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 550 | */ |
Duncan Laurie | 8be6759 | 2014-01-09 10:01:05 -0800 | [diff] [blame] | 551 | Method (_Q09, 0, NotSerialized) |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 552 | { |
EricKY Cheng | 366b205 | 2022-09-23 17:04:01 +0800 | [diff] [blame] | 553 | |
| 554 | #if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC) |
| 555 | If (CondRefOf (\_SB.DPTC)) { |
| 556 | \_SB.DPTC() |
| 557 | } |
| 558 | #endif |
Felix Singer | 98be4d6 | 2021-12-31 14:32:03 +0100 | [diff] [blame] | 559 | If (!Acquire (^PATM, 1000)) { |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 560 | /* Read sensor ID for event */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 561 | Local0 = ^PATI |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 562 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 563 | /* When sensor ID returns 0xFF then no more events */ |
Felix Singer | 8ab0975 | 2022-01-02 02:48:53 +0100 | [diff] [blame] | 564 | While (Local0 != EC_TEMP_SENSOR_NOT_PRESENT) |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 565 | { |
Martin Roth | 15f232d | 2018-04-29 22:41:58 -0500 | [diff] [blame] | 566 | #ifdef HAVE_THERM_EVENT_HANDLER |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 567 | \_SB.DPTF.TEVT (Local0) |
Martin Roth | 15f232d | 2018-04-29 22:41:58 -0500 | [diff] [blame] | 568 | #endif |
Aaron Durbin | b3ce658 | 2014-05-13 09:23:10 -0500 | [diff] [blame] | 569 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 570 | /* Keep reaading sensor ID for event */ |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 571 | Local0 = ^PATI |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 572 | } |
Duncan Laurie | 93e2444 | 2014-01-06 12:30:52 -0800 | [diff] [blame] | 573 | |
Marc Jones | e17ec3e | 2018-08-15 22:53:34 -0600 | [diff] [blame] | 574 | Release (^PATM) |
| 575 | } |
Duncan Laurie | ad8d913 | 2013-12-10 07:41:33 -0800 | [diff] [blame] | 576 | } |
| 577 | |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 578 | /* |
| 579 | * Set Charger Current Limit |
| 580 | * Arg0 = Current Limit in 64mA steps |
| 581 | */ |
| 582 | Method (CHGS, 1, Serialized) |
| 583 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 584 | ^CHGL = ToInteger (Arg0) |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 585 | } |
| 586 | |
| 587 | /* |
| 588 | * Disable Charger Current Limit |
| 589 | */ |
| 590 | Method (CHGD, 0, Serialized) |
| 591 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 592 | ^CHGL = 0xFF |
Duncan Laurie | e6b280e | 2014-02-10 16:21:05 -0800 | [diff] [blame] | 593 | } |
| 594 | |
jiazi Yang | 51fc93f | 2016-07-28 05:15:01 -0400 | [diff] [blame] | 595 | /* Read current Tablet mode */ |
| 596 | Method (RCTM, 0, NotSerialized) |
| 597 | { |
| 598 | Return (^TBMD) |
| 599 | } |
| 600 | |
Wim Vervoorn | 8629b49 | 2020-01-15 09:16:46 +0100 | [diff] [blame] | 601 | #ifdef EC_ENABLE_MULTIPLE_DPTF_PROFILES |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 602 | /* Read current Device DPTF Profile Number */ |
| 603 | Method (RCDP, 0, NotSerialized) |
| 604 | { |
| 605 | /* |
| 606 | * DDPN = 0 is reserved for backwards compatibility. |
| 607 | * If DDPN == 0 use TBMD to load appropriate DPTF table. |
| 608 | */ |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 609 | If (^DDPN == 0) { |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 610 | Return (^TBMD) |
| 611 | } Else { |
Felix Singer | 73078ed | 2021-12-29 23:39:59 +0100 | [diff] [blame] | 612 | Local0 = ^DDPN - 1 |
Karthikeyan Ramasubramanian | 036ccd7 | 2018-10-23 22:16:36 -0600 | [diff] [blame] | 613 | Return (Local0) |
| 614 | } |
| 615 | } |
Wim Vervoorn | 8629b49 | 2020-01-15 09:16:46 +0100 | [diff] [blame] | 616 | #endif |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 617 | #if CONFIG(EC_GOOGLE_CHROMEEC_ACPI_USB_PORT_POWER) |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 618 | /* |
| 619 | * Enable USB Port Power |
| 620 | * Arg0 = USB port ID |
| 621 | */ |
| 622 | Method (UPPS, 1, Serialized) |
| 623 | { |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame] | 624 | USPP |= 1 << Arg0 |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | /* |
| 628 | * Disable USB Port Power |
| 629 | * Arg0 = USB port ID |
| 630 | */ |
| 631 | Method (UPPC, 1, Serialized) |
| 632 | { |
Felix Singer | c87c1ab | 2022-12-25 16:25:06 +0100 | [diff] [blame^] | 633 | USPP &= ~(1 << Arg0) |
Emil Lundmark | 9d5f9f2 | 2018-05-22 19:31:37 +0200 | [diff] [blame] | 634 | } |
| 635 | #endif |
| 636 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 637 | #include "ac.asl" |
| 638 | #include "battery.asl" |
Gwendal Grignou | 866cc3d | 2016-05-03 23:24:53 -0700 | [diff] [blame] | 639 | #include "cros_ec.asl" |
Duncan Laurie | 612163eb | 2014-06-13 10:35:22 -0700 | [diff] [blame] | 640 | |
| 641 | #ifdef EC_ENABLE_ALS_DEVICE |
| 642 | #include "als.asl" |
| 643 | #endif |
Shawn Nematbakhsh | 98cc94c | 2014-08-28 11:33:41 -0700 | [diff] [blame] | 644 | |
Duncan Laurie | ef549a0 | 2015-09-01 09:47:55 -0700 | [diff] [blame] | 645 | #ifdef EC_ENABLE_KEYBOARD_BACKLIGHT |
Elyes HAOUAS | b933109 | 2016-09-05 19:55:34 +0200 | [diff] [blame] | 646 | #include "keyboard_backlight.asl" |
Duncan Laurie | ef549a0 | 2015-09-01 09:47:55 -0700 | [diff] [blame] | 647 | #endif |
| 648 | |
Furquan Shaikh | c96ad86 | 2018-01-26 10:40:09 -0800 | [diff] [blame] | 649 | #ifdef EC_ENABLE_TBMC_DEVICE |
Gwendal Grignou | 87d5fb8 | 2017-01-19 18:30:21 -0800 | [diff] [blame] | 650 | #include "tbmc.asl" |
| 651 | #endif |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 652 | } |