From cb9591cef0772062561e1281448f5c6bd0910e24 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Mon, 18 Mar 2024 15:08:51 +0000 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/81408 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/ec/starlabs/merlin/acpi/battery.asl | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- cgit v1.2.3