mb/starlabs/starbook/{adl_n,mtl}: Don't configure GPE routes
[coreboot.git] / src / ec / starlabs / merlin / acpi / battery.asl
blob5f00c8839953b741d1f9086711d68342f3d2e447
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #if CONFIG(EC_STARLABS_MERLIN)
4 Method (_Q0B, 0, NotSerialized)                 // Event: Battery Information Update
6         Notify (BAT0, 0x80)
8 #endif
10 Device (BAT0)
12         Name (_HID, EisaId("PNP0C0A"))
13         Name (_UID, 0)
14         Method (_STA, 0, NotSerialized)
15         {
16                 // Battery Status
17                 // 0x80 BIT1 0x01 = Present
18                 // 0x80 BIT1 0x00 = Not Present
19                 If (ECRD (RefOf(ECPS)) & 0x02)
20                 {
21                         Return (0x1F)
22                 }
23                 Return (0x0F)
24         }
26         Name (SBIF, Package (13)
27         {
28                 1,                                      //  0: Power Unit                       0:      mWh
29                                                         //                                      1:      mA
30                 0xffffffff,                             //  1: Design Capacity
31                 0xffffffff,                             //  2: Last Full Charge Capacity
32                 1,                                      //  3: Battery Technology               0:      Primary (non-rechargeable)
33                                                         //                                      1:      Secondary (rechargeable)
34                 0xffffffff,                             //  4: Design Voltage
35                 0,                                      //  5: Design capacity of Warning
36                 0,                                      //  6: Design capacity of Low
37                 0xffffffff,                             //  7: Battery capacity Decrement Granularity
38                 0xffffffff,                             //  8: Battery capacity Increment Granularity
39                 CONFIG_EC_STARLABS_BATTERY_MODEL,       //  9: Model Number
40                 "Unknown",                              // 10: Serial Number
41                 CONFIG_EC_STARLABS_BATTERY_TYPE,        // 11: Battery Type
42                 CONFIG_EC_STARLABS_BATTERY_OEM          // 12: OEM Information
43         })
45         Method (_BIF, 0, NotSerialized)
46         {
47                 Local0 = ECRD(RefOf(B1DC))
48                 If (Local0) {
49                         SBIF  [1] = Local0
50                         If (B1FC != 0xffff) {
51                                 SBIF  [2] = ECRD(RefOf(B1FC))
52                         } Else {
53                                 SBIF  [2] = Local0
54                         }
55                         SBIF  [4] = ECRD(RefOf(B1DV))
56                         SBIF  [5] = Local0 / 5          // 20%
57                         SBIF  [6] = Local0 / 20         // 5%
58                         SBIF  [7] = Local0 / 500        // 0.2%
59                         SBIF  [8] = Local0 / 500        // 0.2%
60                 }
61                 Return (SBIF)
62         }
64         Name (XBIF, Package (21)
65         {
66                 1,                                      //  0: Revision                         0:      3.0
67                                                         //                                      1:      4.0
68                 1,                                      //  1: Power Unit                       0:      mWh
69                                                         //                                      1:      mA
70                 0xffffffff,                             //  2: Design Capacity
71                 0xffffffff,                             //  3: Last Full Charge Capacity
72                 1,                                      //  4: Battery Technology               0:      Primary (non-rechargeable)
73                                                         //                                      1:      Secondary (rechargeable)
74                 0xffffffff,                             //  5: Design Voltage
75                 0xffffffff,                             //  6: Design Capacity of Warning
76                 0xffffffff,                             //  7: Design Capacity of Low
77                 0xffffffff,                             //  8: Cycle Count
78                 2,                                      //  9: Measurement Accuracy
79                 5000,                                   // 10: Max Sampling Time (ms)
80                 1000,                                   // 11: Min Sampling Time (ms)
81                 5000,                                   // 12: Max Averaging Interval
82                 1000,                                   // 13: Min Averaging Interval
83                 0xffffffff,                             // 14: Battery Capacity Decrement Granularity
84                 0xffffffff,                             // 15: Battery Capacity Increment Granularity
85                 CONFIG_EC_STARLABS_BATTERY_MODEL,       // 16: Model Number
86                 "Unknown",                              // 17: Serial Number
87                 CONFIG_EC_STARLABS_BATTERY_TYPE,        // 18: Battery Type
88                 CONFIG_EC_STARLABS_BATTERY_OEM,         // 19: OEM Information
89                 1,                                      // 20: Swapping Capability              0:      Non swappable
90                                                         //                                      1:      Cold swappable
91                                                         //                                      16:     Hot swappable
92         })
93         Method (_BIX, 0, NotSerialized)
94         {
95                 Local0 = ECRD(RefOf(B1DC))
96                 If (Local0) {
97                         XBIF  [2] = Local0
98                         If (B1FC != 0xffff) {
99                                 XBIF  [3] = ECRD(RefOf(B1FC))
100                         } Else {
101                                 XBIF  [3] = Local0
102                         }
103                         XBIF  [5] = ECRD(RefOf(B1DV))
104                         XBIF  [6] = Local0 / 5  // 20%
105                         XBIF  [7] = Local0 / 20 // 5%
106                         If (B1CC != 0xffff) {
107                                 XBIF  [8] = ECRD(RefOf(B1CC))
108                         }
109                         XBIF [14] = Local0 / 500        // 0.2%
110                         XBIF [15] = Local0 / 500        // 0.2%
111                 }
112                 Return (XBIF)
113         }
115         Name (PKG1, Package (4)
116         {
117                 0xffffffff,     //  0: Battery State
118                 0xffffffff,     //  1: Battery Present Rate
119                 0xffffffff,     //  2: Battery Remaining Capacity
120                 0xffffffff,     //  3: Battery Present Voltage
121         })
122         Method (_BST, 0, NotSerialized)
123         {
124                 PKG1[0] = (ECRD(RefOf(B1ST)) & 0x07)
125                 PKG1[1] = ECRD(RefOf(B1PR))
127                 Local0 = ECRD(RefOf(B1RC))
128                 If (Local0 != 0xffff) {
129                         PKG1[2] = Local0
130                 } Else {
131                         PKG1[2] = (ECRD(RefOf(B1RP)) * ECRD(RefOf(B1DC))) / 100
132                 }
133                 PKG1[3] = ECRD(RefOf(B1PV))
134                 Return (PKG1)
135         }
136         Method (_PCL, 0, NotSerialized)
137         {
138                 Return (
139                         Package() { _SB }
140                 )
141         }