Angel Pons | 210a008 | 2020-04-02 23:48:24 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [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 | |
| 9 | Device (EC0) |
| 10 | { |
| 11 | Name (_HID, EISAID ("PNP0C09")) |
| 12 | Name (_UID, 1) |
| 13 | Name (_GPE, EC_GPE) // GPE for Runtime SCI |
| 14 | |
| 15 | OperationRegion (ERAM, EmbeddedControl, 0x00, 0xff) |
| 16 | Field (ERAM, ByteAcc, Lock, Preserve) |
| 17 | { |
| 18 | Offset (0x80), |
| 19 | BTEX, 1, // Battery Exists |
| 20 | , 1, |
| 21 | ACEX, 1, // AC Exists |
| 22 | , 5, |
| 23 | Offset (0x83), |
| 24 | LIDS, 1, // Lid Switch State |
| 25 | , 7, |
| 26 | BTST, 8, // Battery State |
| 27 | Offset (0xA2), |
| 28 | BTRA, 16, // Battery Remaining Capacity |
| 29 | BTPR, 16, // Battery Present Rate |
| 30 | BTVO, 16, // Battery Present Voltage |
| 31 | Offset (0xB0), |
| 32 | BTDA, 16, // Battery Design Capacity |
| 33 | BTDF, 16, // Battery Last Full Charge Capacity |
| 34 | BTDV, 16, // Battery Design Voltage |
| 35 | BTDL, 16, // Battery Design Low |
| 36 | Offset (0xC0), |
| 37 | CPUT, 8, // CPU Temperature |
| 38 | Offset (0xCA), |
| 39 | FSL0, 1, // Fan Speed Level 0 |
| 40 | FSL1, 1, // Fan Speed Level 1 |
| 41 | FSL2, 1, // Fan Speed Level 2 |
| 42 | FSL3, 1, // Fan Speed Level 3 |
| 43 | FSL4, 1, // Fan Speed Level 4 |
| 44 | , 2, |
| 45 | FCOS, 1, // Fan Speed OS Control |
| 46 | } |
| 47 | |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 48 | Method (_CRS, 0, Serialized) |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 49 | { |
| 50 | Name (ECMD, ResourceTemplate() |
| 51 | { |
| 52 | IO (Decode16, 0x62, 0x62, 0, 1) |
| 53 | IO (Decode16, 0x66, 0x66, 0, 1) |
| 54 | }) |
| 55 | Return (ECMD) |
| 56 | } |
| 57 | |
| 58 | Method (_REG, 2, NotSerialized) |
| 59 | { |
| 60 | // Initialize AC power state |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 61 | \PWRS = ACEX |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 62 | |
| 63 | // Initialize LID switch state |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 64 | \LIDS = LIDS |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 65 | |
| 66 | // Enable OS control of fan speed |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 67 | FCOS = 1 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 68 | |
| 69 | // Force a read of CPU temperature |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 70 | Local0 = CPUT |
Vladimir Serbinenko | b27c24f | 2016-02-08 00:10:44 +0100 | [diff] [blame] | 71 | /* So that we don't get a warning that Local0 is unused. */ |
Felix Singer | 0e790c6 | 2021-12-31 13:57:14 +0100 | [diff] [blame] | 72 | Local0++ |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | PowerResource (FNP0, 0, 0) |
| 76 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 77 | Method (_STA) { |
Felix Singer | cdba42c | 2022-01-02 03:54:23 +0100 | [diff] [blame] | 78 | If (\FLVL <= 0) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 79 | Return (1) |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 80 | } Else { |
| 81 | Return (Zero) |
| 82 | } |
| 83 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 84 | Method (_ON) { |
| 85 | If (FCOS) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 86 | FSL0 = 1 |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 87 | \FLVL = 0 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 88 | Notify (\_TZ.THRM, 0x81) |
| 89 | } |
| 90 | } |
| 91 | Method (_OFF) { |
| 92 | If (FCOS) { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 93 | FSL0 = Zero |
| 94 | \FLVL = 1 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 95 | Notify (\_TZ.THRM, 0x81) |
| 96 | } |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | PowerResource (FNP1, 0, 0) |
| 101 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 102 | Method (_STA) { |
Felix Singer | cdba42c | 2022-01-02 03:54:23 +0100 | [diff] [blame] | 103 | If (\FLVL <= 1) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 104 | Return (1) |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 105 | } Else { |
| 106 | Return (Zero) |
| 107 | } |
| 108 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 109 | Method (_ON) { |
| 110 | If (FCOS) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 111 | FSL1 = 1 |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 112 | \FLVL = 1 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 113 | Notify (\_TZ.THRM, 0x81) |
| 114 | } |
| 115 | } |
| 116 | Method (_OFF) { |
| 117 | If (FCOS) { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 118 | FSL1 = Zero |
| 119 | \FLVL = 2 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 120 | Notify (\_TZ.THRM, 0x81) |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | PowerResource (FNP2, 0, 0) |
| 126 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 127 | Method (_STA) { |
Felix Singer | cdba42c | 2022-01-02 03:54:23 +0100 | [diff] [blame] | 128 | If (\FLVL <= 2) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 129 | Return (1) |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 130 | } Else { |
| 131 | Return (Zero) |
| 132 | } |
| 133 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 134 | Method (_ON) { |
| 135 | If (FCOS) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 136 | FSL2 = 1 |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 137 | \FLVL = 2 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 138 | Notify (\_TZ.THRM, 0x81) |
| 139 | } |
| 140 | } |
| 141 | Method (_OFF) { |
| 142 | If (FCOS) { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 143 | FSL2 = Zero |
| 144 | \FLVL = 3 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 145 | Notify (\_TZ.THRM, 0x81) |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | PowerResource (FNP3, 0, 0) |
| 151 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 152 | Method (_STA) { |
Felix Singer | cdba42c | 2022-01-02 03:54:23 +0100 | [diff] [blame] | 153 | If (\FLVL <= 3) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 154 | Return (1) |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 155 | } Else { |
| 156 | Return (Zero) |
| 157 | } |
| 158 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 159 | Method (_ON) { |
| 160 | If (FCOS) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 161 | FSL3 = 1 |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 162 | \FLVL = 3 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 163 | Notify (\_TZ.THRM, 0x81) |
| 164 | } |
| 165 | } |
| 166 | Method (_OFF) { |
| 167 | If (FCOS) { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 168 | FSL3 = Zero |
| 169 | \FLVL = 4 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 170 | Notify (\_TZ.THRM, 0x81) |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | PowerResource (FNP4, 0, 0) |
| 176 | { |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 177 | Method (_STA) { |
Felix Singer | cdba42c | 2022-01-02 03:54:23 +0100 | [diff] [blame] | 178 | If (\FLVL <= 4) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 179 | Return (1) |
Matt DeVillier | aa95af6 | 2017-07-06 17:19:17 -0500 | [diff] [blame] | 180 | } Else { |
| 181 | Return (Zero) |
| 182 | } |
Elyes HAOUAS | 88607a4 | 2018-10-05 10:36:45 +0200 | [diff] [blame] | 183 | } |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 184 | Method (_ON) { |
| 185 | If (FCOS) { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 186 | FSL4 = 1 |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 187 | \FLVL = 4 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 188 | Notify (\_TZ.THRM, 0x81) |
| 189 | } |
| 190 | } |
| 191 | Method (_OFF) { |
| 192 | If (FCOS) { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 193 | FSL4 = Zero |
| 194 | \FLVL = 5 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 195 | Notify (\_TZ.THRM, 0x81) |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | Device (FAN0) |
| 201 | { |
| 202 | Name (_HID, EISAID ("PNP0C0B")) |
| 203 | Name (_UID, 0) |
| 204 | Name (_PR0, Package () { FNP0 }) |
| 205 | } |
| 206 | |
| 207 | Device (FAN1) |
| 208 | { |
| 209 | Name (_HID, EISAID ("PNP0C0B")) |
| 210 | Name (_UID, 1) |
| 211 | Name (_PR0, Package () { FNP1 }) |
| 212 | } |
| 213 | |
| 214 | Device (FAN2) |
| 215 | { |
| 216 | Name (_HID, EISAID ("PNP0C0B")) |
| 217 | Name (_UID, 2) |
| 218 | Name (_PR0, Package () { FNP2 }) |
| 219 | } |
| 220 | |
| 221 | Device (FAN3) |
| 222 | { |
| 223 | Name (_HID, EISAID ("PNP0C0B")) |
| 224 | Name (_UID, 3) |
| 225 | Name (_PR0, Package () { FNP3 }) |
| 226 | } |
| 227 | |
| 228 | Device (FAN4) |
| 229 | { |
| 230 | Name (_HID, EISAID ("PNP0C0B")) |
| 231 | Name (_UID, 4) |
| 232 | Name (_PR0, Package () { FNP4 }) |
| 233 | } |
| 234 | |
| 235 | // AC Power Connected |
| 236 | Method (_Q51, 0, NotSerialized) |
| 237 | { |
Felix Singer | ca4b587 | 2022-12-26 08:17:06 +0100 | [diff] [blame^] | 238 | \PWRS = 1 |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 239 | Notify (AC, 0x80) |
| 240 | \PNOT () |
| 241 | } |
| 242 | |
| 243 | // AC Power Removed |
| 244 | Method (_Q52, 0, NotSerialized) |
| 245 | { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 246 | \PWRS = Zero |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 247 | Notify (AC, 0x80) |
| 248 | \PNOT () |
| 249 | } |
| 250 | |
| 251 | // Battery State Change |
| 252 | Method (_Q53, 0, NotSerialized) |
| 253 | { |
| 254 | Notify (BAT0, 0x80) |
| 255 | Notify (BAT0, 0x81) |
| 256 | } |
| 257 | |
| 258 | // Battery State Change |
| 259 | Method (_Q54, 0, NotSerialized) |
| 260 | { |
| 261 | Notify (BAT0, 0x80) |
| 262 | Notify (BAT0, 0x81) |
| 263 | } |
| 264 | |
| 265 | // Power State Change |
| 266 | Method (_Q55, 0, NotSerialized) |
| 267 | { |
| 268 | \PNOT () |
| 269 | } |
| 270 | |
| 271 | // Lid Switch Event |
| 272 | Method (_Q5E, 0, NotSerialized) |
| 273 | { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 274 | \LIDS = LIDS |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 275 | Notify (\_SB.LID0, 0x80) |
| 276 | } |
| 277 | |
| 278 | // Lid Switch Event |
| 279 | Method (_Q5F, 0, NotSerialized) |
| 280 | { |
Felix Singer | 4da79a7 | 2022-12-12 04:57:27 +0100 | [diff] [blame] | 281 | \LIDS = LIDS |
Stefan Reinauer | 020b22a | 2012-03-30 17:06:43 -0700 | [diff] [blame] | 282 | Notify (\_SB.LID0, 0x80) |
| 283 | } |
| 284 | |
| 285 | #include "ac.asl" |
| 286 | #include "battery.asl" |
| 287 | } |