1 /* SPDX-License-Identifier: GPL-2.0-only */
4 * The mainboard must define strings in the root scope to
5 * report device-specific battery information to the OS.
16 Name (_HID, EISAID ("PNP0C0A"))
18 Name (_PCL, Package () { \_SB })
20 Name (PBIF, Package () {
21 0x00000001, // Power Unit: mAh
22 0xFFFFFFFF, // Design Capacity
23 0xFFFFFFFF, // Last Full Charge Capacity
24 0x00000001, // Battery Technology: Rechargeable
25 0xFFFFFFFF, // Design Voltage
26 0x00000003, // Design Capacity of Warning
27 0xFFFFFFFF, // Design Capacity of Low
28 0x00000001, // Capacity Granularity 1
29 0x00000001, // Capacity Granularity 2
32 "LION", // Battery Type
36 Name (PBST, Package () {
37 0x00000000, // Battery State
38 0xFFFFFFFF, // Battery Present Rate
39 0xFFFFFFFF, // Battery Remaining Capacity
40 0xFFFFFFFF, // Battery Present Voltage
44 // Workaround for full battery status, enabled by default
47 // Method to enable full battery workaround
53 // Method to disable full battery workaround
59 // Swap bytes in a word
60 Method (SWAB, 1, NotSerialized)
66 If (Local0 == 0xFFFF) {
72 Method (_STA, 0, Serialized)
81 Method (_BIF, 0, Serialized)
83 // Update fields from EC
89 // Get battery info from mainboard
97 Method (_BST, 0, Serialized)
102 // bit 0 = discharging
104 // bit 2 = critical level
107 // Get battery state from EC
111 // Check if AC is present
113 // Set only charging/discharging bits
116 // Always discharging when on battery power
120 // Flag if the battery level is critical
125 // Notify if battery state has changed since last time
126 If (Local1 != BSTP) {
132 // 1: BATTERY PRESENT RATE
136 If (Local1 != 0xFFFFFFFF && Local1 >= 0x8000) {
143 // 2: BATTERY REMAINING CAPACITY
146 If (Local1 != 0xFFFFFFFF && Local1 >= 0x8000) {
151 If (BFWK && ACEX && !Local0) {
152 // On AC power and battery is neither charging
153 // nor discharging. Linux expects a full battery
154 // to report same capacity as last full charge.
155 // https://bugzilla.kernel.org/show_bug.cgi?id=12632
158 // See if within ~3% of full
160 If (Local1 > Local2 - Local3 && Local1 < Local2 + Local3)
168 // 3: BATTERY PRESENT VOLTAGE
170 PBST[3] = SWAB (BTVO)