ec/system76/ec: acpi: Implement _BIX method
Implement _BIX method to expose battery cycle count. Requires an EC version with support for cycle count. Change-Id: I5f7a1d275caff59960aaf9c39b9c707970350987 Signed-off-by: Ian Douglas Scott <idscott@system76.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57678 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jeremy Soller <jeremy@system76.com>
This commit is contained in:
parent
6260bf712a
commit
8031abfcc2
|
@ -96,6 +96,84 @@ Device (BAT0)
|
||||||
Return (PBIF) /* \_SB_.BAT0.PBIF */
|
Return (PBIF) /* \_SB_.BAT0.PBIF */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Name (PBIX, Package ()
|
||||||
|
{
|
||||||
|
0, // 0 - Revision
|
||||||
|
1, // 1 - Power Unit: mAh
|
||||||
|
0xFFFFFFFF, // 2 - Design Capacity
|
||||||
|
0xFFFFFFFF, // 3 - Last Full Charge Capacity
|
||||||
|
1, // 4 - Battery Technology: Rechargeable
|
||||||
|
0xFFFFFFFF, // 5 - Design Voltage
|
||||||
|
0, // 6 - Design Capacity of Warning
|
||||||
|
0, // 7 - Design Capacity of Low
|
||||||
|
0, // 8 - Cycle Count
|
||||||
|
98000, // 9 - Measurement Accuracy
|
||||||
|
0xFFFFFFFF, // 10 - Max Sampling Time
|
||||||
|
0xFFFFFFFF, // 11 - Min Sampling Time
|
||||||
|
0xFFFFFFFF, // 12 - Max Averaging Interval
|
||||||
|
0xFFFFFFFF, // 13 - Min Averaging Interval
|
||||||
|
0x40, // 14 - Battery Capacity Granularity 1
|
||||||
|
0x40, // 15 - Battery Capacity Granularity 2
|
||||||
|
" ", // 16 - Model Number
|
||||||
|
" ", // 17 - Serial Number
|
||||||
|
" ", // 18 - Battery Type
|
||||||
|
" " // 19 - OEM Information
|
||||||
|
})
|
||||||
|
|
||||||
|
Method (IVBX, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
PBIX [2] = 0xFFFFFFFF
|
||||||
|
PBIX [3] = 0xFFFFFFFF
|
||||||
|
PBIX [5] = 0xFFFFFFFF
|
||||||
|
PBIX [16] = " "
|
||||||
|
PBIX [17] = " "
|
||||||
|
PBIX [18] = " "
|
||||||
|
PBIX [19] = " "
|
||||||
|
BFCC = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Method (UPBX, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
If (^^PCI0.LPCB.EC0.BAT0)
|
||||||
|
{
|
||||||
|
Local0 = (^^PCI0.LPCB.EC0.BDC0 & 0xFFFF)
|
||||||
|
PBIX [2] = Local0
|
||||||
|
Local0 = (^^PCI0.LPCB.EC0.BFC0 & 0xFFFF)
|
||||||
|
PBIX [3] = Local0
|
||||||
|
BFCC = Local0
|
||||||
|
Local0 = (^^PCI0.LPCB.EC0.BDV0 & 0xFFFF)
|
||||||
|
PBIX [5] = Local0
|
||||||
|
Local0 = (^^PCI0.LPCB.EC0.BCW0 & 0xFFFF)
|
||||||
|
PBIX [6] = Local0
|
||||||
|
Local0 = (^^PCI0.LPCB.EC0.BCL0 & 0xFFFF)
|
||||||
|
PBIX [7] = Local0
|
||||||
|
LOCAL0 = ^^PCI0.LPCB.EC0.CYC0
|
||||||
|
PBIX [8] = LOCAL0
|
||||||
|
PBIX [16] = "BAT"
|
||||||
|
PBIX [17] = "0001"
|
||||||
|
PBIX [18] = "LION"
|
||||||
|
PBIX [19] = "Notebook"
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
IVBX ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// _BIX: Battery Information Extended
|
||||||
|
Method (_BIX, 0, NotSerialized)
|
||||||
|
{
|
||||||
|
If (^^PCI0.LPCB.EC0.ECOK)
|
||||||
|
{
|
||||||
|
UPBX ()
|
||||||
|
}
|
||||||
|
Else
|
||||||
|
{
|
||||||
|
IVBX ()
|
||||||
|
}
|
||||||
|
Return (PBIX) /* \_SB_.BAT0.PBIX */
|
||||||
|
}
|
||||||
|
|
||||||
Name (PBST, Package (0x04)
|
Name (PBST, Package (0x04)
|
||||||
{
|
{
|
||||||
Zero, // 0 - Battery state
|
Zero, // 0 - Battery state
|
||||||
|
|
|
@ -28,6 +28,7 @@ Field (ERAM, ByteAcc, Lock, Preserve)
|
||||||
Offset (0x3A),
|
Offset (0x3A),
|
||||||
BCW0, 32,
|
BCW0, 32,
|
||||||
BCL0, 32,
|
BCL0, 32,
|
||||||
|
CYC0, 16, // Battery cycle count
|
||||||
Offset (0x68),
|
Offset (0x68),
|
||||||
ECOS, 8, // Detected OS, 0 = no ACPI, 1 = ACPI but no driver, 2 = ACPI with driver
|
ECOS, 8, // Detected OS, 0 = no ACPI, 1 = ACPI but no driver, 2 = ACPI with driver
|
||||||
Offset (0xC8),
|
Offset (0xC8),
|
||||||
|
|
Loading…
Reference in New Issue