Debian Codegraph @

src/mainboard/razer/blade_stealth_kbl/acpi/battery.asl

raw
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 Device (BAT)
4 {
5 Name (_HID, EisaId ("PNP0C0A"))
6 Name (_UID, 1)
7 Name (_PCL, Package () { \_SB })
8
9 Name (BSTP, 0)
10
11 Name (PBIF, Package () {
12 0x00000001, /* 0x00: Power Unit: mAh */
13 0xFFFFFFFF, /* 0x01: Design Capacity */
14 0xFFFFFFFF, /* 0x02: Last Full Charge Capacity */
15 0x00000001, /* 0x03: Battery Technology: Rechargeable */
16 0xFFFFFFFF, /* 0x04: Design Voltage */
17 0x00000003, /* 0x05: Design Capacity of Warning */
18 0xFFFFFFFF, /* 0x06: Design Capacity of Low */
19 0x00000001, /* 0x07: Capacity Granularity 1 */
20 0x00000001, /* 0x08: Capacity Granularity 2 */
21 "Razer Blade Stealth",
22 "SERIAL",
23 "LiIon",
24 "Razer"
25 })
26
27
28 Name (PBST, Package () {
29 0x00000000, /* 0x00: Battery State */
30 0xFFFFFFFF, /* 0x01: Battery Present Rate */
31 0xFFFFFFFF, /* 0x02: Battery Remaining Capacity */
32 0xFFFFFFFF, /* 0x03: Battery Present Voltage */
33 })
34
35 Method (_STA, 0, Serialized)
36 {
37 Return (0x1F)
38 }
39
40 Method (_BIF, 0, Serialized)
41 {
42 /* Last Full Charge Capacity */
43 PBIF [2] = BFCP
44
45 /* Design Voltage */
46 PBIF [4] = BDVT
47
48 /* Design Capacity */
49 PBIF [1] = BDCP
50
51 /* Design Capacity of Warning */
52 PBIF [5] = BDCP / 50
53
54 /* Design Capacity of Low */
55 PBIF [6] = BDCP / 100
56
57 PBIF [10] = ToString (BSER, Ones)
58
59 Return (PBIF)
60 }
61
62 Method (_BST, 0, Serialized)
63 {
64 /*
65 * 0: BATTERY STATE
66 *
67 * bit 0 = discharging
68 * bit 1 = charging
69 * bit 2 = critical level
70 */
71
72 /* Check if AC is present */
73 If (ACEX) {
74 /* Read battery status from EC */
75 Local0 = BCST
76 } Else {
77 /* Always discharging when on battery power */
78 Local0 = 0x01
79 }
80
81 PBST [0] = Local0
82
83 /* Notify if battery state has changed since last time */
84 If (Local0 != BSTP) {
85 BSTP = Local0
86 Notify (BAT, 0x80)
87 }
88
89 /*
90 * 1: BATTERY PRESENT RATE
91 */
92 PBST [1] = BCRT
93
94 /*
95 * 2: BATTERY REMAINING CAPACITY
96 */
97 PBST [2] = BRCP
98
99 /*
100 * 3: BATTERY PRESENT VOLTAGE
101 */
102 PBST [3] = BCVT
103
104 Return (PBST)
105 }
106 }