diff options
author | tongjian <tongjian@huaqin.corp-partner.google.com> | 2021-06-16 15:00:56 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-23 04:09:14 +0000 |
commit | 66ce39de648e93c6659c72ca96e73c7047462ab4 (patch) | |
tree | 431cb35b7e60210e0ae6c11439f1e05a30f62859 | |
parent | 26026cc84a42eae453c59d9b4432a665e0c73f87 (diff) | |
download | chrome-ec-66ce39de648e93c6659c72ca96e73c7047462ab4.tar.gz |
Homestar:LED:Use display SoC to control charge LED
Currently, Homestar uses the state of charge provided from the battery.
This isn't the same as the SoC shown on the screen because Powerd
compensates it based on the full factor and the low battery shutdown
threshold.
This change makes Homestar use the display SoC for the charge LED module
so that the charge LED and the display SoC synchronously work.
BUG=b:187539586
TEST=make -j BOARD=homestar
Verify build on EVT board
BRANCH=Trogdo
Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com>
Change-Id: I953aca48d18b32655d82fbd9a8c315534a8326bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2965815
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r-- | board/homestar/board.h | 3 | ||||
-rw-r--r-- | board/homestar/led.c | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/board/homestar/board.h b/board/homestar/board.h index 1c3a114a71..63cf7a3ad5 100644 --- a/board/homestar/board.h +++ b/board/homestar/board.h @@ -40,6 +40,9 @@ #define CONFIG_BATTERY_REVIVE_DISCONNECT #define CONFIG_BATTERY_FUEL_GAUGE #define CONFIG_BATTERY_VENDOR_PARAM +#define CONFIG_BATTERY_EXPORT_DISPLAY_SOC +#undef CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE +#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 2 /* Enable PD3.0 */ #define CONFIG_USB_PD_REV30 diff --git a/board/homestar/led.c b/board/homestar/led.c index 7d7d9b28e5..bf1bb51fa6 100644 --- a/board/homestar/led.c +++ b/board/homestar/led.c @@ -77,7 +77,7 @@ static void board_led_set_battery(void) static int battery_ticks; int color = LED_OFF; int period = 0; - int percent = charge_get_percent(); + int percent = DIV_ROUND_NEAREST(charge_get_display_charge(), 10); uint32_t chflags = charge_get_flags(); battery_ticks++; |