Jeremy Soller | 9037f0a | 2021-04-09 10:51:31 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | Device (BAT0) |
| 4 | { |
| 5 | Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */) // _HID: Hardware ID |
| 6 | Name (_UID, Zero) // _UID: Unique ID |
| 7 | Name (_PCL, Package (0x01) // _PCL: Power Consumer List |
| 8 | { |
| 9 | _SB |
| 10 | }) |
| 11 | Name (BFCC, Zero) |
| 12 | Method (_STA, 0, NotSerialized) // _STA: Status |
| 13 | { |
| 14 | If (^^PCI0.LPCB.EC0.ECOK) |
| 15 | { |
| 16 | If (^^PCI0.LPCB.EC0.BAT0) |
| 17 | { |
| 18 | Return (0x1F) |
| 19 | } |
| 20 | Else |
| 21 | { |
| 22 | Return (0x0F) |
| 23 | } |
| 24 | } |
| 25 | Else |
| 26 | { |
| 27 | Return (0x0F) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | Name (PBIF, Package (0x0D) |
| 32 | { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 33 | 1, // 0 - Power Unit |
Jeremy Soller | 9037f0a | 2021-04-09 10:51:31 -0600 | [diff] [blame] | 34 | 0xFFFFFFFF, // 1 - Design Capacity |
| 35 | 0xFFFFFFFF, // 2 - Last Full Charge Capacity |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 36 | 1, // 3 - Battery Technology |
Jeremy Soller | 9037f0a | 2021-04-09 10:51:31 -0600 | [diff] [blame] | 37 | 0x39D0, // 4 - Design Voltage |
| 38 | Zero, // 5 - Design Capacity of Warning |
| 39 | Zero, // 6 - Design Capacity of Low |
| 40 | 0x40, // 7 - Battery Capacity Granularity 1 |
| 41 | 0x40, // 8 - Battery Capacity Granularity 2 |
| 42 | "BAT", // 9 - Model Number |
| 43 | "0001", // 10 - Serial Number |
| 44 | "LION", // 11 - Battery Type |
| 45 | "Notebook" // 12 - OEM Information |
| 46 | }) |
| 47 | Method (IVBI, 0, NotSerialized) |
| 48 | { |
| 49 | PBIF [1] = 0xFFFFFFFF |
| 50 | PBIF [2] = 0xFFFFFFFF |
| 51 | PBIF [4] = 0xFFFFFFFF |
| 52 | PBIF [9] = " " |
| 53 | PBIF [10] = " " |
| 54 | PBIF [11] = " " |
| 55 | PBIF [12] = " " |
| 56 | BFCC = Zero |
| 57 | } |
| 58 | |
| 59 | Method (UPBI, 0, NotSerialized) |
| 60 | { |
| 61 | If (^^PCI0.LPCB.EC0.BAT0) |
| 62 | { |
| 63 | Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF) |
| 64 | PBIF [1] = Local0 |
| 65 | Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF) |
| 66 | PBIF [2] = Local0 |
| 67 | BFCC = Local0 |
| 68 | Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF) |
| 69 | PBIF [4] = Local0 |
| 70 | Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF) |
| 71 | PBIF [5] = Local0 |
| 72 | Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF) |
| 73 | PBIF [6] = Local0 |
| 74 | PBIF [9] = "BAT" |
| 75 | PBIF [10] = "0001" |
| 76 | PBIF [11] = "LION" |
| 77 | PBIF [12] = "Notebook" |
| 78 | } |
| 79 | Else |
| 80 | { |
| 81 | IVBI () |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | Method (_BIF, 0, NotSerialized) // _BIF: Battery Information |
| 86 | { |
| 87 | If (^^PCI0.LPCB.EC0.ECOK) |
| 88 | { |
| 89 | UPBI () |
| 90 | } |
| 91 | Else |
| 92 | { |
| 93 | IVBI () |
| 94 | } |
| 95 | |
| 96 | Return (PBIF) /* \_SB_.BAT0.PBIF */ |
| 97 | } |
| 98 | |
| 99 | Name (PBST, Package (0x04) |
| 100 | { |
| 101 | Zero, // 0 - Battery state |
| 102 | 0xFFFFFFFF, // 1 - Battery present rate |
| 103 | 0xFFFFFFFF, // 2 - Battery remaining capacity |
| 104 | 0x3D90 // 3 - Battery present voltage |
| 105 | }) |
| 106 | Method (IVBS, 0, NotSerialized) |
| 107 | { |
| 108 | PBST [0] = Zero |
| 109 | PBST [1] = 0xFFFFFFFF |
| 110 | PBST [2] = 0xFFFFFFFF |
| 111 | PBST [3] = 0x2710 |
| 112 | } |
| 113 | |
| 114 | Method (UPBS, 0, NotSerialized) |
| 115 | { |
| 116 | If (^^PCI0.LPCB.EC0.BAT0) |
| 117 | { |
| 118 | Local0 = Zero |
| 119 | Local1 = Zero |
| 120 | If (^^AC.ACFG) |
| 121 | { |
| 122 | If (((^^PCI0.LPCB.EC0.BST0 & 0x02) == 0x02)) |
| 123 | { |
| 124 | Local0 |= 0x02 |
| 125 | Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) |
| 126 | } |
| 127 | } |
| 128 | Else |
| 129 | { |
Felix Singer | dfbb634 | 2022-12-26 08:39:35 +0100 | [diff] [blame^] | 130 | Local0 |= 1 |
Jeremy Soller | 9037f0a | 2021-04-09 10:51:31 -0600 | [diff] [blame] | 131 | Local1 = (^^PCI0.LPCB.EC0.BPR0 & 0xFFFF) |
| 132 | } |
| 133 | |
| 134 | Local7 = (Local1 & 0x8000) |
| 135 | If ((Local7 == 0x8000)) |
| 136 | { |
| 137 | Local1 ^= 0xFFFF |
| 138 | } |
| 139 | |
| 140 | Local2 = (^^PCI0.LPCB.EC0.BRC0 & 0xFFFF) |
| 141 | Local3 = (^^PCI0.LPCB.EC0.BPV0 & 0xFFFF) |
| 142 | PBST [0] = Local0 |
| 143 | PBST [1] = Local1 |
| 144 | PBST [2] = Local2 |
| 145 | PBST [3] = Local3 |
| 146 | If ((BFCC != ^^PCI0.LPCB.EC0.BFC0)) |
| 147 | { |
| 148 | Notify (BAT0, 0x81) // Information Change |
| 149 | } |
| 150 | } |
| 151 | Else |
| 152 | { |
| 153 | IVBS () |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | Method (_BST, 0, NotSerialized) // _BST: Battery Status |
| 158 | { |
| 159 | If (^^PCI0.LPCB.EC0.ECOK) |
| 160 | { |
| 161 | UPBS () |
| 162 | } |
| 163 | Else |
| 164 | { |
| 165 | IVBS () |
| 166 | } |
| 167 | |
| 168 | Return (PBST) /* \_SB_.BAT0.PBST */ |
| 169 | } |
| 170 | } |