summaryrefslogtreecommitdiff
path: root/src/ec/starlabs/merlin/acpi
diff options
context:
space:
mode:
authorSean Rhodes <sean@starlabs.systems>2024-03-18 15:08:51 +0000
committerFelix Held <felix-coreboot@felixheld.de>2024-06-07 18:54:13 +0000
commitcb9591cef0772062561e1281448f5c6bd0910e24 (patch)
tree7a685f4765e9bd979b5dce511676ab84fbfe999d /src/ec/starlabs/merlin/acpi
parent7c4cc60a6c41dbe6b9991eb54e4a01d4594a9795 (diff)
ec/starlabs/merlin/battery: Calculate unknown values
If the EC doesn't know a value, it will report it as 0xffff. In these cases, calculate a value to used based on others. For example, if the EC doesn't know the last full charge capacity, report the design capacity to the OS. Change-Id: I310555ff913c2e492bbaec4d77281ac32c0de7a3 Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/81408 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/ec/starlabs/merlin/acpi')
-rw-r--r--src/ec/starlabs/merlin/acpi/battery.asl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ec/starlabs/merlin/acpi/battery.asl b/src/ec/starlabs/merlin/acpi/battery.asl
index 262969a338..63f46013a3 100644
--- a/src/ec/starlabs/merlin/acpi/battery.asl
+++ b/src/ec/starlabs/merlin/acpi/battery.asl
@@ -40,6 +40,8 @@ Device (BAT0)
SBIF [1] = B1DC
If (B1FC != 0xffff) {
SBIF [2] = B1FC
+ } Else {
+ SBIF [2] = B1DC
}
SBIF [4] = B1DV
SBIF [5] = B1DC / 5 // 20%
@@ -88,6 +90,8 @@ Device (BAT0)
XBIF [2] = B1DC
If (B1FC != 0xffff) {
XBIF [3] = B1FC
+ } Else {
+ XBIF [3] = B1DC
}
XBIF [5] = B1DV
XBIF [6] = B1DC / 5 // 20%
@@ -117,6 +121,8 @@ Device (BAT0)
PKG1[1] = B1PR
If (B1RC != 0xffff) {
PKG1[2] = B1RC
+ } Else {
+ PKG1[2] = B1RP * (B1DC / 100)
}
PKG1[3] = B1PV
Return (PKG1)