drivers/usb/intel_bluetooth: Add GBTR Method
[coreboot2.git] / src / mainboard / packardbell / ms2290 / acpi / battery.asl
blob1a775bb45e4f2c047dee84c1d6f095219af271ac
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* Arg0: Battery
4  * Arg1: Battery Status Package
5  * Arg2: charging
6  * Arg3: discharging
7  */
8 Method(BSTA, 4, NotSerialized)
10         Acquire(ECLK, 0xffff)
11         Local0 = 0
13         PAGE = 0
15         Local2 = BAPR
17         if (Arg2) // charging
18         {
19                 Local0 |= 2
21                 If (Local2 == 0x8000) {
22                         Local2 = 0
23                 }
24         }
26         if (Arg3) // discharging
27         {
28                 Local0 |= 1
29                 Local2 = 0x10000 - Local2
30         }
32         Arg1[0] = Local0
34         PAGE = 0
35         Arg1[2] = BARC
36         Arg1[1] = Local2
38         PAGE = 0
39         Arg1[3] = BAVO
40         Release(ECLK)
41         Return (Arg1)
44 Method(BINF, 2, Serialized)
46         Acquire(ECLK, 0xffff)
47         PAGE = 0
48         Local2 = BAFC
49         PAGE = 1
50         Local1 = BADC
52         Arg0[1] = Local1        // Design Capacity
53         Arg0[2] = Local2        // Last full charge capacity
54         PAGE = 1
55         Arg0[4] = BADV          // Design Voltage
56         Arg0[5] = Local2 / 20   // Warning capacity
58         PAGE = 1
59         Local0 = BASN
60         Name (SERN, Buffer (0x06) { "     " })
61         Local1 = 4
62         While (Local0)
63         {
64                 Local2 = Local0
65                 Local0 /= 0x0A
66                 Local2 -= (Local0 * 0x0A)
67                 SERN[Local1] = Local2 + 48
68                 Local1--
69         }
70         Arg0[10] = SERN // Serial Number
72         Name (TYPE, Buffer() { 0, 0, 0, 0, 0 })
73         PAGE = 4
74         TYPE = BATY
75         Arg0[11] = TYPE // Battery type
76         PAGE = 5
77         Arg0[12] = BAOE // OEM information
78         PAGE = 2
79         Arg0[9] = BANA  // Model number
80         Release(ECLK)
81         Return (Arg0)
84 Device (BAT0)
86         Name (_HID, EisaId ("PNP0C0A"))
87         Name (_UID, 0x00)
88         Name (_PCL, Package () { \_SB })
90         Name (BATS, Package ()
91         {
92                 0x00,                   // 0: PowerUnit: Report in mWh
93                 0xFFFFFFFF,             // 1: Design cap
94                 0xFFFFFFFF,             // 2: Last full charge cap
95                 0x01,                   // 3: Battery Technology
96                 10800,                  // 4: Design Voltage (mV)
97                 0x00,                   // 5: Warning design capacity
98                 200,                    // 6: Low design capacity
99                 1,                      // 7: granularity1
100                 1,                      // 8: granularity2
101                 "",                     // 9: Model number
102                 "",                     // A: Serial number
103                 "",                     // B: Battery Type
104                 ""                      // C: OEM information
105         })
107         Method (_BIF, 0, NotSerialized)
108         {
109                 Return (BINF(BATS, 0))
110         }
112         Name (BATI, Package ()
113         {
114                 0,                      // Battery State
115                                         // Bit 0 - discharge
116                                         // Bit 1 - charge
117                                         // Bit 2 - critical state
118                 0,                      // Battery present Rate
119                 0,                      // Battery remaining capacity
120                 0                       // Battery present voltage
121         })
123         Method (_BST, 0, NotSerialized)
124         {
125                 if (B0PR) {
126                         Return (BSTA(0, BATI, B0CH, B0DI))
127                 } else {
128                         Return (BATS)
129                 }
130         }
132         Method (_STA, 0, NotSerialized)
133         {
134                 if (B0PR) {
135                         Return (0x1f)
136                 } else {
137                         Return (0x0f)
138                 }
139         }
142 /* Battery attach/detach */
143 Method(_Q40, 0, NotSerialized)
145         Notify(BAT0, 0x81)
147 Method(_Q41, 0, NotSerialized)
149         Notify(BAT0, 0x81)
152 Method(_Q48, 0, NotSerialized)
154         Notify(BAT0, 0x80)
156 Method(_Q4C, 0, NotSerialized)
158         Notify(BAT0, 0x80)