1 /* SPDX-License-Identifier: GPL-2.0-only */
7 Name (_HID, EISAID ("PNP0C0A"))
9 Name (_PCL, Package () { \_SB })
11 Name (PBIF, Package () {
12 0x00000001, // Power Unit: mAh
13 0xFFFFFFFF, // Design Capacity
14 0xFFFFFFFF, // Last Full Charge Capacity
15 0x00000001, // Battery Technology: Rechargeable
16 0xFFFFFFFF, // Design Voltage
17 0x00000003, // Design Capacity of Warning
18 0xFFFFFFFF, // Design Capacity of Low
19 0x00000001, // Capacity Granularity 1
20 0x00000001, // Capacity Granularity 2
23 "LION", // Battery Type
27 Name (PBST, Package () {
28 0x00000000, // Battery State
29 0xFFFFFFFF, // Battery Present Rate
30 0xFFFFFFFF, // Battery Remaining Capacity
31 0xFFFFFFFF, // Battery Present Voltage
33 Name (BTNM, 0) // Battery number
35 // Workaround for full battery status, enabled by default
38 // Method to enable full battery workaround
44 // Method to disable full battery workaround
50 Method (_STA, 0, Serialized)
59 Method (_BIF, 0, Serialized)
61 // Update fields from EC
73 PBIF [9] = ToString (Concatenate (BATD, 0x00)) // model
74 PBIF [10] = ToHexString (BSN0) // serial
75 PBIF [12] = ToString (BMFN) // vendor
77 BTNM = BDN0 // Save the battery number
82 Method (_BST, 0, Serialized)
87 // bit 0 = discharging
89 // bit 2 = critical level
92 // Get battery state from EC and save it for the charging workaround
97 // 1: BATTERY PRESENT RATE/CURRENT
101 Local1 = 0xFFFF - Local1
105 // 2: BATTERY REMAINING CAPACITY
108 Local2 = Local1 % 100
111 If (BFWK && ADPT && !Local0) {
112 // On AC power and battery is neither charging
113 // nor discharging. Linux expects a full battery
114 // to report same capacity as last full charge.
115 // https://bugzilla.kernel.org/show_bug.cgi?id=12632
118 // See if within ~3% of full
120 If ((Local1 > (Local2 - Local3)) && (Local1 < (Local2 + Local3)))
128 // 3: BATTERY PRESENT VOLTAGE
132 // Check the Battery Number