1 /* SPDX-License-Identifier: GPL-2.0-only */
7 Name (_HID, EISAID ("PNP0C0A"))
9 Name (_PCL, Package () { \_SB })
12 // Indicator of BATX attach/detach
13 // Battery X Information
19 // Default Static Battery Information
24 0xFFFFFFFF, // 1: Design Capacity
25 0xFFFFFFFF, // 2: Last Full Charge Capacity
26 1, // 3: Battery Technology(Rechargeable)
27 10800, // 4: Design Voltage 10.8V
28 0, // 5: Design capacity of warning
29 0, // 6: Design capacity of low
30 1, // 7: Battery capacity granularity 1
31 1, // 8: Battery capacity granularity 2
32 "", // 9: Model Number
33 "", // 10: Serial Number
34 "", // 11: Battery Type
35 "" // 12: OEM Infomration
38 Name (PBST, Package ()
40 0x00000000, // Battery State
41 0xFFFFFFFF, // Battery Present Rate
42 0xFFFFFFFF, // Battery Remaining Capacity
43 0xFFFFFFFF, // Battery Present Voltage
46 // Workaround for full battery status, enabled by default
49 // Method to enable full battery workaround
55 // Method to disable full battery workaround
61 // Method to wait for EC to be ready after changing the Battery Info ID
65 Local0 = 20 // Timeout 100 msec
78 // Battery Slot Status
79 Method (_STA, 0, Serialized)
93 Method (_BIF, 0, Serialized)
95 // Update fields from EC
105 // SMART battery : 1 - 10mWh : 0 - mAh
106 // ACPI spec : 0 - mWh : 1 - mAh
112 // Information ID 0 -
118 // Last Full Charge Capacity
130 // Information ID 2 -
149 // Design capacity of High (5%)
150 // Design capacity of Low (1%)
152 PBIF[5] = Local0 / 20
153 PBIF[6] = Local0 / 100
163 PBIF[10] = ToHexString (SBSN)
166 // Information ID 4 -
172 // Battery Type - Device Chemistry
174 PBIF[11] = ToString (Concatenate(SBCH, 0x00))
177 // Information ID 5 -
183 // OEM Information - Manufacturer Name
185 PBIF[12] = ToString (Concatenate(SBMN, 0x00))
188 // Information ID 6 -
194 // Model Number - Device Name
196 PBIF[9] = ToString (Concatenate(SBDN, 0x00))
201 Method (_BST, 0, Serialized)
203 // Update Battery First Used Date, if requested
206 // TODO: Handle First Used Date Request
213 // bit 0 = discharging
215 // bit 2 = critical level
218 // Get battery state from EC
235 // Set critical flag if battery is empty
236 If (HB0S & 0x0F == 0)
243 // Check if AC is present
246 // Set only charging/discharging bits
251 // Always discharging when on battery power
255 // Flag if the battery level is critical
261 // 1: BATTERY PRESENT RATE/CURRENT
264 If (Local1 >= 0x8000)
268 Local1 = 0x10000 - Local1
280 // Battery is not charging
285 Local6 = DerefOf (PBIF[0]) ^ 1
295 // 2: BATTERY REMAINING CAPACITY
297 // Get Power unit from the battery static information
298 // SMART battery : 1 - 10mWh : 0 - mAh
299 // ACPI spec : 0 - mWh : 1 - mAh
309 If (BFWK && ACPW && !Local0)
311 // On AC power and battery is neither charging
312 // nor discharging. Linux expects a full battery
313 // to report same capacity as last full charge.
314 // https://bugzilla.kernel.org/show_bug.cgi?id=12632
315 // TODO: Is SBRS the "battery gas gauge"?
318 // See if within ~3% of full
320 If (Local1 > Local2 - Local3 && Local1 < Local2 + Local3)
328 // 3: BATTERY PRESENT VOLTAGE