summaryrefslogtreecommitdiff
path: root/board/lazor/usbc_config.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-22 16:32:07 +1300
committerCommit Bot <commit-bot@chromium.org>2021-03-24 19:54:12 +0000
commitd66f859021c2d5d98df9641473a502a744940fa7 (patch)
tree5e4e5f558d592a26b3b2b23d057245ddeb787482 /board/lazor/usbc_config.c
parentc3c18b964cb1a8e4c0149c5f53931be061b41246 (diff)
downloadchrome-ec-d66f859021c2d5d98df9641473a502a744940fa7.tar.gz
lazor: Move battery-type detection into the usbc_config
Move the implementation of board_get_default_battery_type() into the common file so it can be used from zephyr. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Change-Id: I9f9c128386855863d7cc28a9cded23a320e90836 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777645 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'board/lazor/usbc_config.c')
-rw-r--r--board/lazor/usbc_config.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/board/lazor/usbc_config.c b/board/lazor/usbc_config.c
index 9d5b13b4a5..0cd61e613a 100644
--- a/board/lazor/usbc_config.c
+++ b/board/lazor/usbc_config.c
@@ -5,11 +5,13 @@
/* Lazor board-specific USB-C configuration */
+#include "battery_fuel_gauge.h"
#include "bc12/pi3usb9201_public.h"
#include "charge_manager.h"
#include "charge_state.h"
#include "common.h"
#include "config.h"
+#include "driver/ln9310.h"
#include "gpio.h"
#include "hooks.h"
#include "ppc/sn5s330_public.h"
@@ -168,6 +170,20 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
},
};
+__override int board_get_default_battery_type(void)
+{
+ /*
+ * A 2S battery is set as default. If the board is configured to use
+ * a 3S battery, according to its SKU_ID, return a 3S battery as
+ * default. It helps to configure the charger to output a correct
+ * voltage in case the battery is not attached.
+ */
+ if (board_get_battery_cell_type() == BATTERY_CELL_TYPE_3S)
+ return BATTERY_LGC_AP18C8K;
+
+ return DEFAULT_BATTERY_TYPE;
+}
+
void board_tcpc_init(void)
{
/* Only reset TCPC if not sysjump */