diff options
-rw-r--r-- | board/shotzo/battery.c | 349 | ||||
-rw-r--r-- | board/shotzo/board.c | 3 | ||||
-rw-r--r-- | board/shotzo/board.h | 24 | ||||
-rw-r--r-- | board/shotzo/build.mk | 1 | ||||
-rw-r--r-- | board/shotzo/ec.tasklist | 1 | ||||
-rw-r--r-- | board/shotzo/gpio.inc | 2 |
6 files changed, 10 insertions, 370 deletions
diff --git a/board/shotzo/battery.c b/board/shotzo/battery.c deleted file mode 100644 index f71533accf..0000000000 --- a/board/shotzo/battery.c +++ /dev/null @@ -1,349 +0,0 @@ -/* Copyright 2022 The ChromiumOS Authors. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Battery pack vendor provided charging profile - */ - -#include "battery_fuel_gauge.h" -#include "charge_state.h" -#include "common.h" - -/* - * Battery info for all shotzo battery types. Note that the fields - * start_charging_min/max and charging_min/max are not used for the charger. - * The effective temperature limits are given by discharging_min/max_c. - * - * Fuel Gauge (FG) parameters which are used for determining if the battery - * is connected, the appropriate ship mode (battery cutoff) command, and the - * charge/discharge FETs status. - * - * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery - * register. For some batteries, the charge/discharge FET bits are set when - * charging/discharging is active, in other types, these bits set mean that - * charging/discharging is disabled. Therefore, in addition to the mask for - * these bits, a disconnect value must be specified. Note that for TI fuel - * gauge, the charge/discharge FET status is found in Operation Status (0x54), - * but a read of Manufacturer Access (0x00) will return the lower 16 bits of - * Operation status which contains the FET status bits. - * - * The assumption for battery types supported is that the charge/discharge FET - * status can be read with a sb_read() command and therefore, only the register - * address, mask, and disconnect value need to be provided. - */ -const struct board_batt_params board_battery_info[] = { - /* DynaPack CosMX Battery Information */ - [BATTERY_DYNAPACK_COS] = { - .fuel_gauge = { - .manuf_name = "333-2C-DA-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* DynaPack ATL Battery Information */ - [BATTERY_DYNAPACK_ATL] = { - .fuel_gauge = { - .manuf_name = "333-27-DA-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* DynaPack HIGHPOWER Battery Information */ - [BATTERY_DYNAPACK_HIGHPOWER] = { - .fuel_gauge = { - .manuf_name = "333-2D-0D-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* DynaPack BYD Battery Information */ - [BATTERY_DYNAPACK_BYD] = { - .fuel_gauge = { - .manuf_name = "333-2E-0D-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* Samsung SDI Battery Information */ - [BATTERY_SAMSUNG_SDI] = { - .fuel_gauge = { - .manuf_name = "333-54-DA-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* Simplo CosMX Battery Information */ - [BATTERY_SIMPLO_COS] = { - .fuel_gauge = { - .manuf_name = "333-1C-DA-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* Simplo HIGHPOWER Battery Information */ - [BATTERY_SIMPLO_HIGHPOWER] = { - .fuel_gauge = { - .manuf_name = "333-1D-DA-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* CosMX Battery Information */ - [BATTERY_COS] = { - .fuel_gauge = { - .manuf_name = "333-AC-0D-A", - .ship_mode = { - .reg_addr = 0x00, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, - .voltage_min = 6000, - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* CosMX B00C4473A9D0002 Battery Information */ - [BATTERY_COS_2] = { - .fuel_gauge = { - .manuf_name = "333-AC-DA-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 1, - .reg_addr = 0x0, - .reg_mask = 0x0006, - .disconnect_val = 0x0, - .cfet_mask = 0x0004, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, /* mV */ - .voltage_min = 6000, /* mV */ - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, - - /* ATL GB-S20-4473A9-01H&020H Battery Information - * Gauge IC : RAJ240045 - */ - [BATTERY_ATL] = { - .fuel_gauge = { - .manuf_name = "313-B7-0D-A", - .ship_mode = { - .reg_addr = 0x0, - .reg_data = { 0x0010, 0x0010 }, - }, - .fet = { - .mfgacc_support = 0, - .reg_addr = 0x43, - .reg_mask = 0x0003, - .disconnect_val = 0x0, - .cfet_mask = 0x0002, - .cfet_off_val = 0x0, - }, - }, - .batt_info = { - .voltage_max = 8800, /* mV */ - .voltage_normal = 7700, /* mV */ - .voltage_min = 6000, /* mV */ - .precharge_current = 256, /* mA */ - .start_charging_min_c = 0, - .start_charging_max_c = 45, - .charging_min_c = 0, - .charging_max_c = 45, - .discharging_min_c = -10, - .discharging_max_c = 60, - }, - }, -}; -BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT); - -const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_DYNAPACK_COS; diff --git a/board/shotzo/board.c b/board/shotzo/board.c index 9078c0043c..eec7a17e9d 100644 --- a/board/shotzo/board.c +++ b/board/shotzo/board.c @@ -353,6 +353,9 @@ uint16_t tcpc_get_alert_status(void) void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { + if (port == CHARGER_SOLO) { + charger_set_input_current_limit(CHARGER_SOLO, max_ma); + } } __override int extpower_is_present(void) diff --git a/board/shotzo/board.h b/board/shotzo/board.h index 0484f288d9..9046bc036d 100644 --- a/board/shotzo/board.h +++ b/board/shotzo/board.h @@ -12,10 +12,8 @@ #define VARIANT_DEDEDE_EC_IT8320 #include "baseboard.h" -/* Battery */ -#define CONFIG_BATTERY_FUEL_GAUGE - /* Charger */ +#define CONFIG_CHARGER #define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */ #define PD_MAX_VOLTAGE_MV 15000 #define CONFIG_USB_PD_VBUS_DETECT_CHARGER @@ -61,6 +59,11 @@ /* Unused Features */ #undef CONFIG_BACKLIGHT_LID +#undef CONFIG_BATTERY_CUT_OFF +#undef CONFIG_BATTERY_PRESENT_GPIO +#undef CONFIG_BATTERY_SMART +#undef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD +#undef CONFIG_BATTERY_REVIVE_DISCONNECT #undef CONFIG_CMD_KEYBOARD #undef CONFIG_HIBERNATE #undef CONFIG_KEYBOARD_BOOT_KEYS @@ -102,21 +105,6 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; -/* List of possible batteries */ -enum battery_type { - BATTERY_DYNAPACK_COS, - BATTERY_DYNAPACK_ATL, - BATTERY_DYNAPACK_HIGHPOWER, - BATTERY_DYNAPACK_BYD, - BATTERY_SAMSUNG_SDI, - BATTERY_SIMPLO_COS, - BATTERY_SIMPLO_HIGHPOWER, - BATTERY_COS, - BATTERY_COS_2, - BATTERY_ATL, - BATTERY_TYPE_COUNT, -}; - enum charge_port { CHARGE_PORT_TYPEC0, CHARGE_PORT_BARRELJACK, diff --git a/board/shotzo/build.mk b/board/shotzo/build.mk index 0a5b0a7bb2..2e1b7dca8e 100644 --- a/board/shotzo/build.mk +++ b/board/shotzo/build.mk @@ -12,4 +12,3 @@ CHIP_VARIANT:=it8320dx BASEBOARD:=dedede board-y=board.o led.o usb_pd_policy.o -board-$(CONFIG_BATTERY_SMART)+=battery.o diff --git a/board/shotzo/ec.tasklist b/board/shotzo/ec.tasklist index 9a15d66849..1350cdf734 100644 --- a/board/shotzo/ec.tasklist +++ b/board/shotzo/ec.tasklist @@ -9,7 +9,6 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \ - TASK_ALWAYS(CHARGER, charger_task, NULL, TRENTA_TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, VENTI_TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ diff --git a/board/shotzo/gpio.inc b/board/shotzo/gpio.inc index e640d9b65f..5befcf8d2c 100644 --- a/board/shotzo/gpio.inc +++ b/board/shotzo/gpio.inc @@ -91,7 +91,6 @@ GPIO(EC_AP_MKBP_INT_L, PIN(L, 5), GPIO_ODR_HIGH) GPIO(EC_ENTERING_RW, PIN(G, 0), GPIO_OUT_LOW) GPIO(EC_ENTERING_RW2, PIN(C, 7), GPIO_OUT_LOW) GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_ODR_HIGH) -GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT) GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW) GPIO(EN_PPVAR_BJ_ADP_L, PIN(J, 0), GPIO_OUT_LOW) GPIO(EN_VBUS_PWR, PIN(F, 3), GPIO_OUT_HIGH) @@ -115,6 +114,7 @@ GPIO(GPIOG4_NC, PIN(G, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG5_NC, PIN(G, 5), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG6_NC, PIN(G, 6), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOG7_NC, PIN(G, 7), GPIO_INPUT | GPIO_PULL_DOWN) +GPIO(GPIOI4_NC, PIN(I, 4), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOI6_NC, PIN(I, 6), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOI7_NC, PIN(I, 7), GPIO_INPUT | GPIO_PULL_DOWN) GPIO(GPIOK7_NC, PIN(K, 7), GPIO_INPUT | GPIO_PULL_DOWN) |