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