From 34c9267440ee9b5c3cae19d0ced85d28350d3ea9 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Tue, 30 Apr 2019 10:23:14 -0700 Subject: Flapjack: Add battery manufacturer names This patch implements get_battery_manufacturer_name to return a manufacturer name of the detected battery. Signed-off-by: Daisuke Nojiri BUG=b/129599895 BRANCH=none TEST=Verify battery command prints 'C19_ATL'. Change-Id: I0ce63c0c62129fbc3b176b75ce2075c9cc649531 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1590054 Reviewed-by: Daisuke Nojiri Commit-Queue: Daisuke Nojiri Tested-by: Daisuke Nojiri --- board/flapjack/battery.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/board/flapjack/battery.c b/board/flapjack/battery.c index f7d5afc1ef..0b6a6a0199 100644 --- a/board/flapjack/battery.c +++ b/board/flapjack/battery.c @@ -182,6 +182,18 @@ const struct max17055_alert_profile *max17055_get_alert_profile(void) return &alert_profile[batt_type]; } +int get_battery_manufacturer_name(char *dest, int size) +{ + static const char * const name[] = { + [BATTERY_UNKNOWN] = "UNKNOWN", + [BATTERY_C18_ATL] = "C18_ATL", + [BATTERY_C19_ATL] = "C19_ATL", + }; + ASSERT(dest); + strzcpy(dest, name[batt_type], size); + return EC_SUCCESS; +} + int board_cut_off_battery(void) { /* The cut-off procedure is recommended by Richtek. b/116682788 */ -- cgit v1.2.1