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 | // Scope (EC0) |
| 4 | |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 5 | /* Mutex for EC battery index interface */ |
Matt DeVillier | 047b23f | 2018-02-11 16:07:12 -0600 | [diff] [blame] | 6 | Mutex (BATM, 0) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 7 | |
| 8 | // Wait for desired battery index to be presented in shared memory |
| 9 | // Arg0 = battery index |
| 10 | // Returns Zero on success, One on error. |
| 11 | Method (BTSW, 1) |
| 12 | { |
| 13 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 14 | If (BTIX == Arg0) { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 15 | Return (Zero) |
| 16 | } |
Felix Singer | 9b13bfc | 2022-01-02 02:19:48 +0100 | [diff] [blame] | 17 | If (Arg0 >= BTCN) { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 18 | Return (One) |
| 19 | } |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 20 | \_SB.PCI0.LPCB.EC0.BTID = Arg0 |
| 21 | Local0 = 5 // Timeout 5 msec |
Felix Singer | 8ab0975 | 2022-01-02 02:48:53 +0100 | [diff] [blame] | 22 | While (BTIX != Arg0) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 23 | { |
| 24 | Sleep (1) |
Felix Singer | fa36e65 | 2021-12-31 14:16:12 +0100 | [diff] [blame] | 25 | Local0-- |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 26 | If (Local0 == 0) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 27 | { |
| 28 | Return (One) |
| 29 | } |
| 30 | } |
Lijian Zhao | 2db6fbc | 2018-02-08 12:57:01 -0800 | [diff] [blame] | 31 | #else |
Felix Singer | 8ab0975 | 2022-01-02 02:48:53 +0100 | [diff] [blame] | 32 | If (Arg0 != 0) { |
Lijian Zhao | 2db6fbc | 2018-02-08 12:57:01 -0800 | [diff] [blame] | 33 | Return (One) |
| 34 | } |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 35 | #endif |
| 36 | Return (Zero) |
| 37 | } |
| 38 | |
| 39 | // _STA implementation. |
| 40 | // Arg0 = battery index |
| 41 | Method (BSTA, 1, Serialized) |
| 42 | { |
| 43 | If (Acquire (^BATM, 1000)) { |
| 44 | Return (Zero) |
| 45 | } |
| 46 | |
| 47 | If (And(Not(BTSW (Arg0)), BTEX)) { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 48 | Local0 = 0x1F |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 49 | } Else { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 50 | Local0 = 0x0F |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | Release (^BATM) |
| 54 | Return (Local0) |
| 55 | } |
| 56 | |
| 57 | // _BIF implementation. |
| 58 | // Arg0 = battery index |
| 59 | // Arg1 = PBIF |
| 60 | Method (BBIF, 2, Serialized) |
| 61 | { |
| 62 | If (Acquire (^BATM, 1000)) { |
| 63 | Return (Arg1) |
| 64 | } |
| 65 | |
| 66 | If (BTSW (Arg0)) { |
| 67 | Release (^BATM) |
| 68 | Return (Arg1) |
| 69 | } |
| 70 | // Last Full Charge Capacity |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 71 | Arg1[2] = BTDF |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 72 | |
| 73 | // Design Voltage |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 74 | Arg1[4] = BTDV |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 75 | |
| 76 | // Design Capacity |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 77 | Local0 = BTDA |
| 78 | Arg1[1] = Local0 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 79 | |
| 80 | // Design Capacity of Warning |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 81 | Local2 = Local0 * DWRN / 100 |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 82 | Arg1[5] = Local2 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 83 | |
| 84 | // Design Capacity of Low |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 85 | Local2 = Local0 * DLOW / 100 |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 86 | Arg1[6] = Local2 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 87 | |
| 88 | // Get battery info from mainboard |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 89 | Arg1[9] = ToString(Concatenate(BMOD, 0x00)) |
| 90 | Arg1[10] = ToString(Concatenate(BSER, 0x00)) |
| 91 | Arg1[12] = ToString(Concatenate(BMFG, 0x00)) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 92 | |
| 93 | Release (^BATM) |
| 94 | Return (Arg1) |
| 95 | } |
| 96 | |
| 97 | // _BIX implementation. |
| 98 | // Arg0 = battery index |
| 99 | // Arg1 = PBIX |
| 100 | Method (BBIX, 2, Serialized) |
| 101 | { |
| 102 | If (Acquire (^BATM, 1000)) { |
| 103 | Return (Arg1) |
| 104 | } |
| 105 | |
| 106 | If (BTSW (Arg0)) { |
| 107 | Release (^BATM) |
| 108 | Return (Arg1) |
| 109 | } |
| 110 | // Last Full Charge Capacity |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 111 | Arg1[3] = BTDF |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 112 | |
| 113 | // Design Voltage |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 114 | Arg1[5] = BTDV |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 115 | |
| 116 | // Design Capacity |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 117 | Local0 = BTDA |
| 118 | Arg1[2] = Local0 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 119 | |
| 120 | // Design Capacity of Warning |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 121 | Local2 = Local0 * DWRN / 100 |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 122 | Arg1[6] = Local2 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 123 | |
| 124 | // Design Capacity of Low |
Felix Singer | 81623fb | 2022-01-02 00:13:07 +0100 | [diff] [blame] | 125 | Local2 = Local0 * DLOW / 100 |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 126 | Arg1[7] = Local2 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 127 | |
| 128 | // Cycle Count |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 129 | Arg1[8] = BTCC |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 130 | |
| 131 | // Get battery info from mainboard |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 132 | Arg1[16] = ToString(Concatenate(BMOD, 0x00)) |
| 133 | Arg1[17] = ToString(Concatenate(BSER, 0x00)) |
| 134 | Arg1[19] = ToString(Concatenate(BMFG, 0x00)) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 135 | |
| 136 | Release (^BATM) |
| 137 | Return (Arg1) |
| 138 | } |
| 139 | |
| 140 | // _BST implementation. |
| 141 | // Arg0 = battery index |
| 142 | // Arg1 = PBST |
| 143 | // Arg2 = BSTP |
| 144 | // Arg3 = BFWK |
| 145 | Method (BBST, 4, Serialized) |
| 146 | { |
| 147 | If (Acquire (^BATM, 1000)) { |
| 148 | Return (Arg1) |
| 149 | } |
| 150 | |
| 151 | If (BTSW (Arg0)) { |
| 152 | Release (^BATM) |
| 153 | Return (Arg1) |
| 154 | } |
| 155 | // |
| 156 | // 0: BATTERY STATE |
| 157 | // |
| 158 | // bit 0 = discharging |
| 159 | // bit 1 = charging |
| 160 | // bit 2 = critical level |
| 161 | // |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 162 | Local1 = Zero |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 163 | |
| 164 | // Check if AC is present |
| 165 | If (ACEX) { |
| 166 | If (BFCG) { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 167 | Local1 = 0x02 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 168 | } ElseIf (BFDC) { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 169 | Local1 = 0x01 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 170 | } |
| 171 | } Else { |
| 172 | // Always discharging when on battery power |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 173 | Local1 = 0x01 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | // Check for critical battery level |
| 177 | If (BFCR) { |
Felix Singer | 86bc2e7 | 2022-12-16 04:40:39 +0100 | [diff] [blame^] | 178 | Local1 |= 4 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 179 | } |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 180 | Arg1[0] = Local1 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 181 | |
| 182 | // Notify if battery state has changed since last time |
Felix Singer | 8ab0975 | 2022-01-02 02:48:53 +0100 | [diff] [blame] | 183 | If (Local1 != DeRefOf (Arg2)) { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 184 | Arg2 = Local1 |
Felix Singer | 3c799fa | 2022-01-02 00:55:18 +0100 | [diff] [blame] | 185 | If (Arg0 == 0) { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 186 | Notify (BAT0, 0x80) |
| 187 | } |
| 188 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 189 | Else { |
| 190 | Notify (BAT1, 0x80) |
| 191 | } |
| 192 | #endif |
| 193 | } |
| 194 | |
| 195 | // |
| 196 | // 1: BATTERY PRESENT RATE |
| 197 | // |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 198 | Arg1[1] = BTPR |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 199 | |
| 200 | // |
| 201 | // 2: BATTERY REMAINING CAPACITY |
| 202 | // |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 203 | Local1 = BTRA |
Felix Singer | 98be4d6 | 2021-12-31 14:32:03 +0100 | [diff] [blame] | 204 | If (Arg3 && ACEX && !(BFDC && BFCG)) { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 205 | // On AC power and battery is neither charging |
| 206 | // nor discharging. Linux expects a full battery |
| 207 | // to report same capacity as last full charge. |
| 208 | // https://bugzilla.kernel.org/show_bug.cgi?id=12632 |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 209 | Local2 = BTDF |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 210 | |
| 211 | // See if within ~6% of full |
Felix Singer | 034920c | 2022-12-16 02:25:30 +0100 | [diff] [blame] | 212 | Local3 = Local2 >> 4 |
Felix Singer | 0e6f7a2 | 2022-01-02 01:55:32 +0100 | [diff] [blame] | 213 | If (Local1 > Local2 - Local3 && Local1 < Local2 + Local3) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 214 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 215 | Local1 = Local2 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 216 | } |
| 217 | } |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 218 | Arg1[2] = Local1 |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 219 | |
| 220 | // |
| 221 | // 3: BATTERY PRESENT VOLTAGE |
| 222 | // |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 223 | Arg1[3] = BTVO |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 224 | |
| 225 | Release (^BATM) |
| 226 | Return (Arg1) |
| 227 | } |
| 228 | |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 229 | Device (BAT0) |
| 230 | { |
| 231 | Name (_HID, EISAID ("PNP0C0A")) |
| 232 | Name (_UID, 1) |
| 233 | Name (_PCL, Package () { \_SB }) |
| 234 | |
| 235 | Name (PBIF, Package () { |
| 236 | 0x00000001, // 0x00: Power Unit: mAh |
| 237 | 0xFFFFFFFF, // 0x01: Design Capacity |
| 238 | 0xFFFFFFFF, // 0x02: Last Full Charge Capacity |
| 239 | 0x00000001, // 0x03: Battery Technology: Rechargeable |
| 240 | 0xFFFFFFFF, // 0x04: Design Voltage |
| 241 | 0x00000003, // 0x05: Design Capacity of Warning |
| 242 | 0xFFFFFFFF, // 0x06: Design Capacity of Low |
| 243 | 0x00000001, // 0x07: Capacity Granularity 1 |
| 244 | 0x00000001, // 0x08: Capacity Granularity 2 |
| 245 | "", // 0x09: Model Number |
| 246 | "", // 0x0a: Serial Number |
| 247 | "LION", // 0x0b: Battery Type |
| 248 | "" // 0x0c: OEM Information |
| 249 | }) |
| 250 | |
| 251 | Name (PBIX, Package () { |
| 252 | 0x00000000, // 0x00: Revision |
| 253 | 0x00000001, // 0x01: Power Unit: mAh |
| 254 | 0xFFFFFFFF, // 0x02: Design Capacity |
| 255 | 0xFFFFFFFF, // 0x03: Last Full Charge Capacity |
| 256 | 0x00000001, // 0x04: Battery Technology: Rechargeable |
| 257 | 0xFFFFFFFF, // 0x05: Design Voltage |
| 258 | 0x00000003, // 0x06: Design Capacity of Warning |
| 259 | 0xFFFFFFFF, // 0x07: Design Capacity of Low |
| 260 | 0x00000000, // 0x08: Cycle Count |
| 261 | 0x00018000, // 0x09: Measurement Accuracy (98.3%?) |
| 262 | 0x000001F4, // 0x0a: Max Sampling Time (500ms) |
| 263 | 0x0000000a, // 0x0b: Min Sampling Time (10ms) |
| 264 | 0xFFFFFFFF, // 0x0c: Max Averaging Interval |
| 265 | 0xFFFFFFFF, // 0x0d: Min Averaging Interval |
| 266 | 0x00000001, // 0x0e: Capacity Granularity 1 |
| 267 | 0x00000001, // 0x0f: Capacity Granularity 2 |
| 268 | "", // 0x10 Model Number |
| 269 | "", // 0x11: Serial Number |
| 270 | "LION", // 0x12: Battery Type |
| 271 | "" // 0x13: OEM Information |
| 272 | }) |
| 273 | |
| 274 | Name (PBST, Package () { |
| 275 | 0x00000000, // 0x00: Battery State |
| 276 | 0xFFFFFFFF, // 0x01: Battery Present Rate |
| 277 | 0xFFFFFFFF, // 0x02: Battery Remaining Capacity |
| 278 | 0xFFFFFFFF, // 0x03: Battery Present Voltage |
| 279 | }) |
| 280 | Name (BSTP, Zero) |
| 281 | |
Daisuke Nojiri | 55a9722 | 2018-10-30 15:05:18 -0700 | [diff] [blame] | 282 | // Workaround for full battery status, disabled by default |
| 283 | Name (BFWK, Zero) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 284 | |
| 285 | // Method to enable full battery workaround |
| 286 | Method (BFWE) |
| 287 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 288 | BFWK = One |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | // Method to disable full battery workaround |
| 292 | Method (BFWD) |
| 293 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 294 | BFWK = Zero |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | Method (_STA, 0, Serialized) |
| 298 | { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 299 | Return (BSTA (0)) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 300 | } |
| 301 | |
| 302 | Method (_BIF, 0, Serialized) |
| 303 | { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 304 | Return (BBIF (0, PBIF)) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 305 | } |
| 306 | |
Duncan Laurie | d840118 | 2014-09-29 08:32:19 -0700 | [diff] [blame] | 307 | Method (_BIX, 0, Serialized) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 308 | { |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 309 | Return (BBIX (0, PBIX)) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | Method (_BST, 0, Serialized) |
| 313 | { |
Duncan Laurie | cacecef | 2019-07-15 17:37:09 -0700 | [diff] [blame] | 314 | Return (BBST (0, PBST, RefOf (BSTP), BFWK)) |
Stefan Reinauer | d6682e8 | 2013-02-21 15:39:35 -0800 | [diff] [blame] | 315 | } |
| 316 | } |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 317 | |
| 318 | #ifdef EC_ENABLE_SECOND_BATTERY_DEVICE |
| 319 | Device (BAT1) |
| 320 | { |
| 321 | Name (_HID, EISAID ("PNP0C0A")) |
| 322 | Name (_UID, 1) |
| 323 | Name (_PCL, Package () { \_SB }) |
| 324 | |
| 325 | Name (PBIF, Package () { |
| 326 | 0x00000001, // 0x00: Power Unit: mAh |
| 327 | 0xFFFFFFFF, // 0x01: Design Capacity |
| 328 | 0xFFFFFFFF, // 0x02: Last Full Charge Capacity |
| 329 | 0x00000001, // 0x03: Battery Technology: Rechargeable |
| 330 | 0xFFFFFFFF, // 0x04: Design Voltage |
| 331 | 0x00000003, // 0x05: Design Capacity of Warning |
| 332 | 0xFFFFFFFF, // 0x06: Design Capacity of Low |
| 333 | 0x00000001, // 0x07: Capacity Granularity 1 |
| 334 | 0x00000001, // 0x08: Capacity Granularity 2 |
| 335 | "", // 0x09: Model Number |
| 336 | "", // 0x0a: Serial Number |
| 337 | "LION", // 0x0b: Battery Type |
| 338 | "" // 0x0c: OEM Information |
| 339 | }) |
| 340 | |
| 341 | Name (PBIX, Package () { |
| 342 | 0x00000000, // 0x00: Revision |
| 343 | 0x00000001, // 0x01: Power Unit: mAh |
| 344 | 0xFFFFFFFF, // 0x02: Design Capacity |
| 345 | 0xFFFFFFFF, // 0x03: Last Full Charge Capacity |
| 346 | 0x00000001, // 0x04: Battery Technology: Rechargeable |
| 347 | 0xFFFFFFFF, // 0x05: Design Voltage |
| 348 | 0x00000003, // 0x06: Design Capacity of Warning |
| 349 | 0xFFFFFFFF, // 0x07: Design Capacity of Low |
| 350 | 0x00000000, // 0x08: Cycle Count |
| 351 | 0x00018000, // 0x09: Measurement Accuracy (98.3%?) |
| 352 | 0x000001F4, // 0x0a: Max Sampling Time (500ms) |
| 353 | 0x0000000a, // 0x0b: Min Sampling Time (10ms) |
| 354 | 0xFFFFFFFF, // 0x0c: Max Averaging Interval |
| 355 | 0xFFFFFFFF, // 0x0d: Min Averaging Interval |
| 356 | 0x00000001, // 0x0e: Capacity Granularity 1 |
| 357 | 0x00000001, // 0x0f: Capacity Granularity 2 |
| 358 | "", // 0x10 Model Number |
| 359 | "", // 0x11: Serial Number |
| 360 | "LION", // 0x12: Battery Type |
| 361 | "" // 0x13: OEM Information |
| 362 | }) |
| 363 | |
| 364 | Name (PBST, Package () { |
| 365 | 0x00000000, // 0x00: Battery State |
| 366 | 0xFFFFFFFF, // 0x01: Battery Present Rate |
| 367 | 0xFFFFFFFF, // 0x02: Battery Remaining Capacity |
| 368 | 0xFFFFFFFF, // 0x03: Battery Present Voltage |
| 369 | }) |
| 370 | Name (BSTP, Zero) |
| 371 | |
Daisuke Nojiri | 55a9722 | 2018-10-30 15:05:18 -0700 | [diff] [blame] | 372 | // Workaround for full battery status, disabled by default |
| 373 | Name (BFWK, Zero) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 374 | |
| 375 | // Method to enable full battery workaround |
| 376 | Method (BFWE) |
| 377 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 378 | BFWK = One |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | // Method to disable full battery workaround |
| 382 | Method (BFWD) |
| 383 | { |
Felix Singer | ff6b3af | 2022-12-12 04:54:46 +0100 | [diff] [blame] | 384 | BFWK = Zero |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | Method (_STA, 0, Serialized) |
| 388 | { |
| 389 | Return (BSTA (1)) |
| 390 | } |
| 391 | |
| 392 | Method (_BIF, 0, Serialized) |
| 393 | { |
| 394 | Return (BBIF (1, PBIF)) |
| 395 | } |
| 396 | |
| 397 | Method (_BIX, 0, Serialized) |
| 398 | { |
| 399 | Return (BBIX (1, PBIX)) |
| 400 | } |
| 401 | |
| 402 | Method (_BST, 0, Serialized) |
| 403 | { |
Duncan Laurie | cacecef | 2019-07-15 17:37:09 -0700 | [diff] [blame] | 404 | Return (BBST (1, PBST, RefOf (BSTP), BFWK)) |
Nicolas Boichat | 07fe618 | 2018-01-26 14:37:16 +0800 | [diff] [blame] | 405 | } |
| 406 | } |
| 407 | #endif |