Tobias Diedrich (ranma+coreboot@tdiedrich.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18348
-gerrit
commit b46d5115043b9cf5bcb7f53aa9273d9d62f2f355 Author: Tobias Diedrich ranma+openocd@tdiedrich.de Date: Sun Feb 12 13:16:18 2017 +0100
ec/lenovo/h8: Support an optional battery page flip delay
The Lenovo H8 battery interface uses a paged EC memory area.
Some Thinkpads use a different EC controller (ENE KB9012) with mostly compatible firmware, which requires an explicit delay between writing the page register and reading the page data.
Change-Id: Iaeb8c4829efa29139396b519de803f10dd93f03f Signed-off-by: Tobias Diedrich ranma+coreboot@tdiedrich.de --- src/ec/lenovo/h8/acpi/battery.asl | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/ec/lenovo/h8/acpi/battery.asl b/src/ec/lenovo/h8/acpi/battery.asl index 0ebc9ee..629397a 100644 --- a/src/ec/lenovo/h8/acpi/battery.asl +++ b/src/ec/lenovo/h8/acpi/battery.asl @@ -84,6 +84,14 @@ Field (ERAM, ByteAcc, NoLock, Preserve) BANA, 128 }
+Method(BPAG, 1, NotSerialized) +{ + Store(Arg0, PAGE) +#ifdef BATTERY_PAGE_DELAY + Sleep(BATTERY_PAGE_DELAY) +#endif +} + /* Arg0: Battery * Arg1: Battery Status Package * Arg2: charging @@ -93,9 +101,9 @@ Method(BSTA, 4, NotSerialized) { Acquire(ECLK, 0xffff) Store(0, Local0) - Or(1, Arg0, PAGE) + ^BPAG(Or(1, Arg0)) Store(BAMA, Local1) - Store(Arg0, PAGE) /* Battery dynamic information */ + ^BPAG(Arg0) /* Battery dynamic information */
Store(BAPR, Local2)
@@ -132,12 +140,12 @@ Method(BSTA, 4, NotSerialized) Method(BINF, 2, NotSerialized) { Acquire(ECLK, 0xffff) - Or(1, Arg1, PAGE) /* Battery 0 static information */ + ^BPAG(Or(1, Arg1)) /* Battery 0 static information */ Xor(BAMA, 1, Index(Arg0, 0)) Store(BAMA, Local0) - Store(Arg1, PAGE) + ^BPAG(Arg1) Store(BAFC, Local2) - Or(2, Arg1, PAGE) + ^BPAG(Or(2, Arg1)) Store(BADC, Local1)
if (Local0) @@ -162,13 +170,13 @@ Method(BINF, 2, NotSerialized) } Store (SERN, Index (Arg0, 10)) // Serial Number
- Or(4, Arg1, PAGE) + ^BPAG(Or(4, Arg1)) Name (TYPE, Buffer() { 0, 0, 0, 0, 0 }) Store(BATY, TYPE) Store(TYPE, Index (Arg0, 11)) // Battery type - Or(5, Arg1, PAGE) + ^BPAG(Or(5, Arg1)) Store(BAOE, Index (Arg0, 12)) // OEM information - Or(6, Arg1, PAGE) + ^BPAG(Or(6, Arg1)) Store(BANA, Index (Arg0, 9)) // Model number Release(ECLK) Return (Arg0)