2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 The Chromium OS Authors. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
21 Name (_HID, EISAID ("PNP0C0A"))
23 Name (_PCL, Package () { \_SB })
25 Name (PBIF, Package () {
26 0x00000001, // 0x00: Power Unit: mAh
27 0xFFFFFFFF, // 0x01: Design Capacity
28 0xFFFFFFFF, // 0x02: Last Full Charge Capacity
29 0x00000001, // 0x03: Battery Technology: Rechargeable
30 0xFFFFFFFF, // 0x04: Design Voltage
31 0x00000003, // 0x05: Design Capacity of Warning
32 0xFFFFFFFF, // 0x06: Design Capacity of Low
33 0x00000001, // 0x07: Capacity Granularity 1
34 0x00000001, // 0x08: Capacity Granularity 2
35 "", // 0x09: Model Number
36 "", // 0x0a: Serial Number
37 "LION", // 0x0b: Battery Type
38 "" // 0x0c: OEM Information
41 Name (PBIX, Package () {
42 0x00000000, // 0x00: Revision
43 0x00000001, // 0x01: Power Unit: mAh
44 0xFFFFFFFF, // 0x02: Design Capacity
45 0xFFFFFFFF, // 0x03: Last Full Charge Capacity
46 0x00000001, // 0x04: Battery Technology: Rechargeable
47 0xFFFFFFFF, // 0x05: Design Voltage
48 0x00000003, // 0x06: Design Capacity of Warning
49 0xFFFFFFFF, // 0x07: Design Capacity of Low
50 0x00000000, // 0x08: Cycle Count
51 0x00018000, // 0x09: Measurement Accuracy (98.3%?)
52 0x000001F4, // 0x0a: Max Sampling Time (500ms)
53 0x0000000a, // 0x0b: Min Sampling Time (10ms)
54 0xFFFFFFFF, // 0x0c: Max Averaging Interval
55 0xFFFFFFFF, // 0x0d: Min Averaging Interval
56 0x00000001, // 0x0e: Capacity Granularity 1
57 0x00000001, // 0x0f: Capacity Granularity 2
58 "", // 0x10 Model Number
59 "", // 0x11: Serial Number
60 "LION", // 0x12: Battery Type
61 "" // 0x13: OEM Information
64 Name (PBST, Package () {
65 0x00000000, // 0x00: Battery State
66 0xFFFFFFFF, // 0x01: Battery Present Rate
67 0xFFFFFFFF, // 0x02: Battery Remaining Capacity
68 0xFFFFFFFF, // 0x03: Battery Present Voltage
72 // Workaround for full battery status, enabled by default
75 // Method to enable full battery workaround
81 // Method to disable full battery workaround
87 Method (_STA, 0, Serialized)
96 Method (_BIF, 0, Serialized)
98 // Last Full Charge Capacity
99 Store (BTDF, Index (PBIF, 2))
102 Store (BTDV, Index (PBIF, 4))
106 Store (Local0, Index (PBIF, 1))
108 // Design Capacity of Warning
109 Divide (Multiply (Local0, DWRN), 100, , Local2)
110 Store (Local2, Index (PBIF, 5))
112 // Design Capacity of Low
113 Divide (Multiply (Local0, DLOW), 100, , Local2)
114 Store (Local2, Index (PBIF, 6))
116 // Get battery info from mainboard
117 Store (ToString(BMOD), Index (PBIF, 9))
118 Store (ToString(BSER), Index (PBIF, 10))
119 Store (ToString(BMFG), Index (PBIF, 12))
124 Method (_BIX, 0, Serialized)
126 // Last Full Charge Capacity
127 Store (BTDF, Index (PBIX, 3))
130 Store (BTDV, Index (PBIX, 5))
134 Store (Local0, Index (PBIX, 2))
136 // Design Capacity of Warning
137 Divide (Multiply (Local0, DWRN), 100, , Local2)
138 Store (Local2, Index (PBIX, 6))
140 // Design Capacity of Low
141 Divide (Multiply (Local0, DLOW), 100, , Local2)
142 Store (Local2, Index (PBIX, 7))
145 Store (BTCC, Index (PBIX, 8))
147 // Get battery info from mainboard
148 Store (ToString(BMOD), Index (PBIX, 16))
149 Store (ToString(BSER), Index (PBIX, 17))
150 Store (ToString(BMFG), Index (PBIX, 19))
155 Method (_BST, 0, Serialized)
160 // bit 0 = discharging
162 // bit 2 = critical level
166 // Check if AC is present
174 // Always discharging when on battery power
178 // Check for critical battery level
180 Or (Local1, 0x04, Local1)
182 Store (Local1, Index (PBST, 0))
184 // Notify if battery state has changed since last time
185 If (LNotEqual (Local1, BSTP)) {
191 // 1: BATTERY PRESENT RATE
193 Store (BTPR, Index (PBST, 1))
196 // 2: BATTERY REMAINING CAPACITY
199 If (LAnd (BFWK, LAnd (ACEX, LNot (LAnd (BFDC, BFCG))))) {
200 // On AC power and battery is neither charging
201 // nor discharging. Linux expects a full battery
202 // to report same capacity as last full charge.
203 // https://bugzilla.kernel.org/show_bug.cgi?id=12632
206 // See if within ~6% of full
207 ShiftRight (Local2, 4, Local3)
208 If (LAnd (LGreater (Local1, Subtract (Local2, Local3)),
209 LLess (Local1, Add (Local2, Local3))))
211 Store (Local2, Local1)
214 Store (Local1, Index (PBST, 2))
217 // 3: BATTERY PRESENT VOLTAGE
219 Store (BTVO, Index (PBST, 3))