diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2018-01-26 14:37:16 +0800 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2018-02-07 16:38:14 +0000 |
commit | 07fe6184bc1d834377a91bfbe7e796d8027f1f24 (patch) | |
tree | f9ae5ad77bdbeb7924a4c768b77fe8cbabd7ab28 /src/ec/google/chromeec/acpi/ec.asl | |
parent | 857a38752091ef8adc9926a58beba1f52baa181f (diff) | |
download | coreboot-07fe6184bc1d834377a91bfbe7e796d8027f1f24.tar.xz |
chromeec: Add support for reading second battery info
We share the same shared memory fields for both batteries. When
the host wants to switch battery to read out, it will:
- Set BTID (EC_ACPI_MEM_BATTERY_INDEX) to the required index
- Wait for BITX (EC_MEMMAP_BATT_INDEX) to have the required value
- Then fetch the data
BRANCH=none
BUG=b:65697620
TEST=Boot lux, both /sys/class/power_supply/BAT0 and BAT1 are
present, data is valid.
Change-Id: Ib06176e6ab4c45a899259f0917e6292121865ed6
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://review.coreboot.org/23598
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src/ec/google/chromeec/acpi/ec.asl')
-rw-r--r-- | src/ec/google/chromeec/acpi/ec.asl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/ec/google/chromeec/acpi/ec.asl b/src/ec/google/chromeec/acpi/ec.asl index 618b00a79e..62f9acda4c 100644 --- a/src/ec/google/chromeec/acpi/ec.asl +++ b/src/ec/google/chromeec/acpi/ec.asl @@ -90,7 +90,9 @@ Device (EC0) DEVE, 1, // EC supports device events // make sure we're within our space envelope Offset (0x0e), - } + Offset (0x12), + BTID, 8, // Battery index that host wants to read +} #if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_ACPI_MEMMAP) OperationRegion (EMEM, EmbeddedControl, @@ -272,6 +274,11 @@ Device (EC0) { Store ("EC: BATTERY INFO", Debug) Notify (BAT0, 0x81) +#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE + If (CondRefOf (BAT1)) { + Notify (BAT1, 0x81) + } +#endif } // Thermal Overload Event @@ -347,6 +354,11 @@ Device (EC0) { Store ("EC: BATTERY STATUS", Debug) Notify (BAT0, 0x80) +#ifdef EC_ENABLE_SECOND_BATTERY_DEVICE + If (CondRefOf (BAT1)) { + Notify (BAT1, 0x80) + } +#endif } // MKBP interrupt. |