1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/* SPDX-License-Identifier: GPL-2.0-only */
Name(\CBA1, 0x60)
Name(\CBA2, 0x60)
/* ACPI doesn't care if capacity is given in mWh or mAh,
but it has to be consistent */
Device (BAT1)
{
Name(_HID, EisaId("PNP0C0A"))
Name(_UID, 1)
Name(_PCL, Package(){ _SB })
Name(PSTA, 0x1f)
/* battery information */
Name(PBIF, Package() {
0x01, // power unit
0x01, // design capacity (mWh/mAh), updated by UPBI
0x01, // last full charge capacity (mWh/mAh), updated by UPBI
0x01, // battery technology: "rechargeable"
0x01, // design voltage (mV), updated by UPBI
0x0294, // design capacity of warning (mWh/mAh)
0x014a, // design capacity of low (mWh/mAh)
0x42, // battery capacity granularity between low and warning
0x42, // battery capacity granularity between warning and full
"BAT1", // Name
"001 ", // Number
"LION", // Type
"JSE" // Vendor
})
/* battery status */
/* dummy values, filled in by UPBS */
Name(PBST, Package() {
0x00, // battery state
// bit0: discharging
// bit1: charging
// bit2: critical energy state
0x01, // battery present rate (mW/mA)
0x01, // remaining capacity (mW/mA)
0x01 // battery present voltage (mV)
})
/* Status */
Method(_STA, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
If(\_SB.PCI0.LPCB.EC0.B1PR) {
If(\_SB.PCI0.LPCB.EC0.B1CH) {
Return(0x1f)
}
}
}
Return(0x0f)
}
/* Battery Info */
Method(_BIF, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
Store (\_SB.PCI0.LPCB.EC0.B1DW, Index(PBIF, 1))
Store (\_SB.PCI0.LPCB.EC0.B1FW, Index(PBIF, 2))
Store (\_SB.PCI0.LPCB.EC0.B1DV, Index(PBIF, 4))
}
Return(PBIF)
}
/* Battery Status */
Method(_BST, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
Store (\_SB.PCI0.LPCB.EC0.B1PW, Local0)
If (LGreaterEqual (Local0, 0x8000)) {
Subtract (0x10000, Local0, Local0)
}
Store (Local0, Index(PBST, 1))
Store (\_SB.PCI0.LPCB.EC0.B1PV, Index(PBST, 3))
Store (\_SB.PCI0.LPCB.EC0.B1RW, Index(PBST, 2))
If (\_SB.PCI0.LPCB.EC0.ACCH) {
If (\_SB.PCI0.LPCB.EC0.B1CH) {
If (\_SB.PCI0.LPCB.EC0.B1CG) {
Store (2, Index(PBST, 0))
}
}
} Else {
If (\_SB.PCI0.LPCB.EC0.B1LO) {
Store (5, Index(PBST, 0))
} Else {
Store (1, Index(PBST, 0))
}
}
}
Return(PBST)
}
}
Device (BAT2)
{
Name(_HID, EisaId("PNP0C0A"))
Name(_UID, 2)
Name(_PCL, Package(){ _SB })
Name(PSTA, 0x1f)
/* battery information */
Name(PBIF, Package() {
0x01, // power unit
0x01, // design capacity (mWh/mAh), updated by UPBI
0x01, // last full charge capacity (mWh/mAh), updated by UPBI
0x01, // battery technology: "rechargeable"
0x01, // design voltage (mV), updated by UPBI
0x0294, // design capacity of warning (mWh/mAh)
0x014a, // design capacity of low (mWh/mAh)
0x42, // battery capacity granularity between low and warning
0x42, // battery capacity granularity between warning and full
"BAT1", // Name
"002 ", // Number
"LION", // Type
"JSE" // Vendor
})
/* battery status */
/* dummy values, filled in by UPBS */
Name(PBST, Package() {
0x00, // battery state
// bit0: discharging
// bit1: charging
// bit2: critical energy state
0x01, // battery present rate (mW/mA)
0x01, // remaining capacity (mW/mA)
0x01 // battery present voltage (mV)
})
/* Status */
Method(_STA, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
If(\_SB.PCI0.LPCB.EC0.B2PR) {
If(\_SB.PCI0.LPCB.EC0.B2CH) {
Return(0x1f)
}
}
}
Return(0x0f)
}
/* Battery Info */
Method(_BIF, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
Store (\_SB.PCI0.LPCB.EC0.B2DW, Index(PBIF, 1))
Store (\_SB.PCI0.LPCB.EC0.B2FW, Index(PBIF, 2))
Store (\_SB.PCI0.LPCB.EC0.B2DV, Index(PBIF, 4))
}
Return(PBIF)
}
/* Battery Status */
Method(_BST, 0)
{
If(\_SB.PCI0.LPCB.EC0.ECON) {
Store (\_SB.PCI0.LPCB.EC0.B2PW, Local0)
If (LGreaterEqual (Local0, 0x8000)) {
Subtract (0x10000, Local0, Local0)
}
Store (Local0, Index(PBST, 1))
Store (\_SB.PCI0.LPCB.EC0.B2PV, Index(PBST, 3))
Store (\_SB.PCI0.LPCB.EC0.B2RW, Index(PBST, 2))
If (\_SB.PCI0.LPCB.EC0.ACCH) {
If (\_SB.PCI0.LPCB.EC0.B2CH) {
If (\_SB.PCI0.LPCB.EC0.B2CG) {
Store (2, Index(PBST, 0))
}
}
} Else {
If (\_SB.PCI0.LPCB.EC0.B2LO) {
Store (5, Index(PBST, 0))
} Else {
Store (1, Index(PBST, 0))
}
}
}
Return(PBST)
}
}
Device (ADP1)
{
Name (_HID, "ACPI0003")
Method (_PSR, 0)
{
Store (\_SB.PCI0.LPCB.EC0.ACCH, PWRS)
Stall (0x02)
Return (PWRS)
}
Method (_PCL, 0)
{
Return (_SB)
}
}
|