summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--baseboard/dragonegg/baseboard.c11
-rw-r--r--baseboard/grunt/baseboard.c13
-rw-r--r--baseboard/hatch/baseboard.c12
-rw-r--r--baseboard/kukui/baseboard.c26
-rw-r--r--baseboard/octopus/baseboard.c15
-rw-r--r--baseboard/volteer/baseboard.c14
-rw-r--r--baseboard/zork/baseboard.c10
-rw-r--r--board/atlas/board.c12
-rw-r--r--board/cheza/board.c11
-rw-r--r--board/coral/board.c9
-rw-r--r--board/elm/board.c10
-rw-r--r--board/eve/board.c9
-rw-r--r--board/flapjack/board.c11
-rw-r--r--board/glkrvp/board.c13
-rw-r--r--board/glkrvp_ite/board.c13
-rw-r--r--board/hammer/board.c14
-rw-r--r--board/jerry/board.c12
-rw-r--r--board/jslrvp_ite/board.c13
-rw-r--r--board/nami/board.c11
-rw-r--r--board/nautilus/board.c11
-rw-r--r--board/nocturne/board.c11
-rw-r--r--board/oak/board.c20
-rw-r--r--board/poppy/board.c12
-rw-r--r--board/rammus/board.c12
-rw-r--r--board/reef/board.c9
-rw-r--r--board/reef_it8320/board.c9
-rw-r--r--board/reef_mchp/board.c9
-rw-r--r--board/samus/board.c11
-rw-r--r--board/scarlet/board.c11
-rw-r--r--board/strago/board.c10
-rw-r--r--board/tglrvpu_ite/board.c13
-rw-r--r--board/trogdor/board.c12
-rw-r--r--board/waddledoo/board.c2
-rw-r--r--board/waddledoo/board.h1
-rw-r--r--common/charger.c57
-rw-r--r--include/charger.h1
36 files changed, 390 insertions, 60 deletions
diff --git a/baseboard/dragonegg/baseboard.c b/baseboard/dragonegg/baseboard.c
index 7414421c15..85c39296f6 100644
--- a/baseboard/dragonegg/baseboard.c
+++ b/baseboard/dragonegg/baseboard.c
@@ -9,6 +9,7 @@
#include "chipset.h"
#include "console.h"
#include "driver/bc12/max14637.h"
+#include "driver/charger/bq25710.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/ppc/sn5s330.h"
#include "driver/ppc/syv682x.h"
@@ -79,6 +80,16 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/******************************************************************************/
/* Chipset callbacks/hooks */
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 7c79c2abf5..80ac9f14a6 100644
--- a/baseboard/grunt/baseboard.c
+++ b/baseboard/grunt/baseboard.c
@@ -19,6 +19,7 @@
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/bc12/max14637.h"
+#include "driver/charger/isl923x.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx7447.h"
#include "driver/tcpm/anx74xx.h"
@@ -362,6 +363,18 @@ const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+
const int usb_port_enable[USB_PORT_COUNT] = {
GPIO_EN_USB_A0_5V,
GPIO_EN_USB_A1_5V,
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
index c1fb0e3939..8253f11239 100644
--- a/baseboard/hatch/baseboard.c
+++ b/baseboard/hatch/baseboard.c
@@ -11,6 +11,7 @@
#include "chipset.h"
#include "console.h"
#include "cros_board_info.h"
+#include "driver/charger/bq25710.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx7447.h"
#include "driver/tcpm/ps8xxx.h"
@@ -87,6 +88,17 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************/
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+/******************************************************************************/
/* Chipset callbacks/hooks */
__attribute__((weak)) bool board_has_kb_backlight(void)
diff --git a/baseboard/kukui/baseboard.c b/baseboard/kukui/baseboard.c
index adfa6ef8ce..0d88f21510 100644
--- a/baseboard/kukui/baseboard.c
+++ b/baseboard/kukui/baseboard.c
@@ -5,6 +5,7 @@
#include "adc.h"
#include "adc_chip.h"
+#include "charger.h"
#include "gpio.h"
#include "hooks.h"
#include "registers.h"
@@ -13,6 +14,31 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#ifndef CONFIG_CHARGER_RUNTIME_CONFIG
+#if defined(VARIANT_KUKUI_CHARGER_MT6370)
+#include "driver/charger/rt946x.h"
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = RT946X_ADDR_FLAGS,
+ .drv = &rt946x_drv,
+ },
+};
+#elif defined(VARIANT_KUKUI_CHARGER_ISL9238)
+#include "driver/charger/isl923x.h"
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+#endif /* VARIANT_KUKUI_CHARGER_* */
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+#endif /* CONFIG_CHARGER_RUNTIME_CONFIG */
+
void board_reset_pd_mcu(void)
{
}
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c
index f263f4a97e..cd9296cd19 100644
--- a/baseboard/octopus/baseboard.c
+++ b/baseboard/octopus/baseboard.c
@@ -11,6 +11,7 @@
#include "common.h"
#include "console.h"
#include "driver/bc12/max14637.h"
+#include "driver/charger/isl923x.h"
#include "driver/ppc/nx20p348x.h"
#include "gpio.h"
#include "hooks.h"
@@ -78,6 +79,20 @@ const struct max14637_config_t max14637_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/******************************************************************************/
+/* Charger Chip Configuration */
+#ifdef VARIANT_OCTOPUS_CHARGER_ISL9238
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+#endif
+
+/******************************************************************************/
/* Chipset callbacks/hooks */
/* Called by APL power state machine when transitioning from G3 to S5 */
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 5206ba9cc3..5205406660 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -10,6 +10,7 @@
#include "charge_state.h"
#include "cros_board_info.h"
#include "driver/bc12/pi3usb9201.h"
+#include "driver/charger/isl9241.h"
#include "driver/ppc/sn5s330.h"
#include "driver/ppc/syv682x.h"
#include "driver/tcpm/ps8xxx.h"
@@ -164,6 +165,19 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************/
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL9241_ADDR_FLAGS,
+ .drv = &isl9241_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+
+/******************************************************************************/
/* PWM configuration */
const struct pwm_t pwm_channels[] = {
[PWM_CH_LED1_BLUE] = {
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 8927b7a2a7..bd0af5fa43 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -19,6 +19,7 @@
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/bc12/pi3usb9201.h"
+#include "driver/charger/isl9241.h"
#include "driver/ppc/aoz1380.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/pi3dpx1207.h"
@@ -231,6 +232,15 @@ struct ppc_config_t ppc_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL9241_ADDR_FLAGS,
+ .drv = &isl9241_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 76fd2c1b22..f39ca52243 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -15,6 +15,7 @@
#include "console.h"
#include "driver/als_opt3001.h"
#include "driver/pmic_bd99992gw.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tcpm.h"
@@ -151,6 +152,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* TCPC mux configuration */
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
diff --git a/board/cheza/board.c b/board/cheza/board.c
index 1742b9d4a2..232f6cfc3d 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -14,6 +14,7 @@
#include "extpower.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
+#include "driver/charger/isl923x.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
@@ -276,6 +277,16 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/*
* Port-0 USB mux driver.
*
diff --git a/board/coral/board.c b/board/coral/board.c
index 426926fd7f..2c970cc1a7 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -240,6 +240,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BD9995X_ADDR_FLAGS,
+ .drv = &bd9995x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
uint16_t tcpc_get_alert_status(void)
{
uint16_t status = 0;
diff --git a/board/elm/board.c b/board/elm/board.c
index 1c54b71862..266dc92aa4 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -17,6 +17,7 @@
#include "console.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/anx7688.h"
#include "driver/tcpm/tcpci.h"
#include "driver/temp_sensor/tmp432.h"
@@ -168,6 +169,15 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/**
* Reset PD MCU
* ANX7688 needs a reset pulse of 50ms after power enable.
diff --git a/board/eve/board.c b/board/eve/board.c
index a3d6e47460..baca40c095 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -232,6 +232,15 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BD9995X_ADDR_FLAGS,
+ .drv = &bd9995x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/**
* Power on (or off) a single TCPC.
* minimum on/off delays are included.
diff --git a/board/flapjack/board.c b/board/flapjack/board.c
index cb191c3578..0035bc01dd 100644
--- a/board/flapjack/board.c
+++ b/board/flapjack/board.c
@@ -245,6 +245,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/******************************************************************************/
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = RT946X_ADDR_FLAGS,
+ .drv = &rt946x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
{GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
diff --git a/board/glkrvp/board.c b/board/glkrvp/board.c
index 8ab22336ce..fc54697fb4 100644
--- a/board/glkrvp/board.c
+++ b/board/glkrvp/board.c
@@ -6,8 +6,10 @@
/* Intel GLK-RVP board-specific configuration */
#include "button.h"
+#include "charger.h"
#include "chipset.h"
#include "console.h"
+#include "driver/charger/isl923x.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -53,6 +55,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* Wake-up pins for hibernate */
const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
diff --git a/board/glkrvp_ite/board.c b/board/glkrvp_ite/board.c
index 64f067527d..cb2da54a0d 100644
--- a/board/glkrvp_ite/board.c
+++ b/board/glkrvp_ite/board.c
@@ -7,7 +7,9 @@
#include "button.h"
#include "chipset.h"
+#include "charger.h"
#include "console.h"
+#include "driver/charger/isl923x.h"
#include "ec2i_chip.h"
#include "extpower.h"
#include "gpio.h"
@@ -42,6 +44,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* Wake-up pins for hibernate */
const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
diff --git a/board/hammer/board.c b/board/hammer/board.c
index 65588dda05..9b26322e49 100644
--- a/board/hammer/board.c
+++ b/board/hammer/board.c
@@ -4,8 +4,10 @@
*/
/* Hammer board configuration */
+#include "charger.h"
#include "clock.h"
#include "common.h"
+#include "driver/charger/isl923x.h"
#include "driver/led/lm3630a.h"
#include "ec_version.h"
#include "ec_ec_comm_slave.h"
@@ -98,6 +100,18 @@ const struct i2c_port_t i2c_ports[] = {
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
#endif
+#ifdef CONFIG_CHARGER_ISL9238
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+#endif
+
#ifdef HAS_BACKLIGHT
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
diff --git a/board/jerry/board.c b/board/jerry/board.c
index 130d46b4a8..c99c6ac8a3 100644
--- a/board/jerry/board.c
+++ b/board/jerry/board.c
@@ -5,8 +5,10 @@
/* Veyron board-specific configuration */
#include "battery.h"
+#include "battery_smart.h"
#include "chipset.h"
#include "common.h"
+#include "driver/charger/bq24715.h"
#include "extpower.h"
#include "gpio.h"
#include "i2c.h"
@@ -45,6 +47,16 @@ const struct pwm_t pwm_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+/* Charger chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = CHARGER_ADDR_FLAGS,
+ .drv = &bq24715_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
void board_config_pre_init(void)
{
/* enable SYSCFG clock */
diff --git a/board/jslrvp_ite/board.c b/board/jslrvp_ite/board.c
index 4e7ece9799..ccf4a5cd41 100644
--- a/board/jslrvp_ite/board.c
+++ b/board/jslrvp_ite/board.c
@@ -6,6 +6,8 @@
/* Intel Jasperlake RVP with ITE EC board specific configuration */
#include "button.h"
+#include "charger.h"
+#include "driver/charger/isl923x.h"
#include "extpower.h"
#include "i2c.h"
#include "intc.h"
@@ -88,6 +90,17 @@ const struct i2c_port_t i2c_ports[] = {
BUILD_ASSERT(ARRAY_SIZE(i2c_ports) == I2C_CHAN_COUNT);
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/*
* Returns board information (board id[7:0] and Fab id[15:8]) on success
* -1 on error.
diff --git a/board/nami/board.c b/board/nami/board.c
index c244a8f91b..150def9d21 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -23,6 +23,7 @@
#include "driver/accel_bma2x2.h"
#include "driver/accel_kionix.h"
#include "driver/baro_bmp280.h"
+#include "driver/charger/isl923x.h"
#include "driver/led/lm3509.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
@@ -282,6 +283,16 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
void board_reset_pd_mcu(void)
{
if (oem == PROJECT_AKALI && board_version < 0x0200) {
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 854d590202..774d92b6be 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -20,6 +20,7 @@
#include "driver/accelgyro_bmi160.h"
#include "driver/accel_bma2x2.h"
#include "driver/baro_bmp280.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tcpm.h"
@@ -193,6 +194,16 @@ const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
GPIO_USB1_ENABLE,
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
void board_reset_pd_mcu(void)
{
/* Assert reset */
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index dd19e7a293..afe0b3186d 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -16,6 +16,7 @@
#include "compile_time_macros.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
+#include "driver/charger/isl923x.h"
#include "driver/ppc/sn5s330.h"
#include "driver/sync.h"
#include "driver/tcpm/ps8xxx.h"
@@ -329,6 +330,16 @@ struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
void board_chipset_startup(void)
{
gpio_set_level(GPIO_EN_5V, 1);
diff --git a/board/oak/board.c b/board/oak/board.c
index da4c6cbb7a..f830aa646b 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -20,6 +20,7 @@
#include "driver/accel_kx022.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/tcpci.h"
#include "driver/temp_sensor/tmp432.h"
#include "driver/usb_mux/pi3usb3x532.h"
@@ -150,6 +151,25 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
+#if BOARD_REV == OAK_REV1
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = I2C_ADDR_CHARGER_FLAGS,
+ .drv = &bq2477x_drv,
+ },
+};
+#else
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+#endif /* OAK_REV1 */
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/*
* Temperature sensors data; must be in same order as enum temp_sensor_id.
* Sensor index and name must match those present in coreboot:
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 9faf9575b6..274af0ed0c 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -20,6 +20,7 @@
#include "driver/accelgyro_bmi160.h"
#include "driver/als_opt3001.h"
#include "driver/baro_bmp280.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
@@ -231,6 +232,17 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
+
/**
* Power on (or off) a single TCPC.
* minimum on/off delays are included.
diff --git a/board/rammus/board.c b/board/rammus/board.c
index 5782ab4943..9e7384e0fd 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -20,6 +20,7 @@
#include "cros_board_info.h"
#include "driver/accelgyro_bmi160.h"
#include "driver/accel_bma2x2.h"
+#include "driver/charger/isl923x.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
#include "driver/tcpm/tcpm.h"
@@ -145,6 +146,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* TCPC mux configuration */
struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
diff --git a/board/reef/board.c b/board/reef/board.c
index dd16d6e26c..0534680743 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -245,6 +245,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BD9995X_ADDR_FLAGS,
+ .drv = &bd9995x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
uint16_t tcpc_get_alert_status(void)
{
uint16_t status = 0;
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index a6ac274f93..513861b9d8 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -198,6 +198,15 @@ const struct temp_sensor_t temp_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BD9995X_ADDR_FLAGS,
+ .drv = &bd9995x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* Called by APL power state machine when transitioning from G3 to S5 */
void chipset_pre_init_callback(void)
{
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index d06e8f719c..270b310a8a 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -242,6 +242,15 @@ const uint32_t i2c_ctrl_slave_addrs[I2C_CONTROLLER_COUNT] = {
0, 0, 0, 0,
};
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BD9995X_ADDR_FLAGS,
+ .drv = &bd9995x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* Return the two slave addresses the specified
* controller will respond to when controller
* is acting as a slave.
diff --git a/board/samus/board.c b/board/samus/board.c
index cb77dee2f9..2ed4616c9f 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -18,6 +18,7 @@
#include "driver/accel_kxcj9.h"
#include "driver/accelgyro_lsm6ds0.h"
#include "driver/als_isl29035.h"
+#include "driver/charger/bq24773.h"
#include "driver/temp_sensor/tmp006.h"
#include "extpower.h"
#include "fan.h"
@@ -132,6 +133,16 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = I2C_ADDR_CHARGER_FLAGS,
+ .drv = &bq2477x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
#define TEMP_U40_REG_ADDR_FLAGS (0x40 | I2C_FLAG_BIG_ENDIAN)
#define TEMP_U41_REG_ADDR_FLAGS (0x44 | I2C_FLAG_BIG_ENDIAN)
#define TEMP_U42_REG_ADDR_FLAGS (0x41 | I2C_FLAG_BIG_ENDIAN)
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index aece3503ae..5f20812a23 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -81,6 +81,17 @@ const struct i2c_port_t i2c_ports[] = {
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/******************************************************************************/
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = RT946X_ADDR_FLAGS,
+ .drv = &rt946x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
{GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
diff --git a/board/strago/board.c b/board/strago/board.c
index a45f0b4774..26e8eafab1 100644
--- a/board/strago/board.c
+++ b/board/strago/board.c
@@ -15,6 +15,7 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kxcj9.h"
#include "driver/als_isl29035.h"
+#include "driver/charger/bq24773.h"
#include "driver/tcpm/tcpci.h"
#include "driver/temp_sensor/tmp432.h"
#include "driver/usb_mux/pi3usb3x532.h"
@@ -176,6 +177,15 @@ struct als_t als[] = {
};
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = I2C_ADDR_CHARGER_FLAGS,
+ .drv = &bq2477x_drv,
+ },
+};
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/**
* Reset PD MCU
*/
diff --git a/board/tglrvpu_ite/board.c b/board/tglrvpu_ite/board.c
index 93a7d18984..c46772aaaa 100644
--- a/board/tglrvpu_ite/board.c
+++ b/board/tglrvpu_ite/board.c
@@ -6,6 +6,8 @@
/* Intel TGL-U-RVP-ITE board-specific configuration */
#include "button.h"
+#include "charger.h"
+#include "driver/charger/isl9241.h"
#include "extpower.h"
#include "i2c.h"
#include "intc.h"
@@ -106,6 +108,17 @@ const struct i2c_port_t i2c_ports[] = {
BUILD_ASSERT(ARRAY_SIZE(i2c_ports) == I2C_CHAN_COUNT);
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* Charger Chips */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL9241_ADDR_FLAGS,
+ .drv = &isl9241_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/*
* Returns board information (board id[7:0] and Fab id[15:8]) on success
* -1 on error.
diff --git a/board/trogdor/board.c b/board/trogdor/board.c
index e5b7831950..120a840459 100644
--- a/board/trogdor/board.c
+++ b/board/trogdor/board.c
@@ -9,9 +9,11 @@
#include "button.h"
#include "charge_manager.h"
#include "charge_state.h"
+#include "charger.h"
#include "chipset.h"
#include "extpower.h"
#include "driver/accelgyro_bmi160.h"
+#include "driver/charger/isl923x.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
@@ -299,6 +301,16 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
+
/* Initialize board. */
static void board_init(void)
{
diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c
index eb9354cedf..59b3cc0552 100644
--- a/board/waddledoo/board.c
+++ b/board/waddledoo/board.c
@@ -275,7 +275,7 @@ int pd_snk_is_vbus_provided(int port)
return regval & TCPC_REG_POWER_STATUS_VBUS_PRES;
}
-struct charger_config_t chg_chips[] = {
+const struct charger_config_t chg_chips[] = {
{
.i2c_port = I2C_PORT_USB_C0,
.i2c_addr_flags = ISL923X_ADDR_FLAGS,
diff --git a/board/waddledoo/board.h b/board/waddledoo/board.h
index 05db45882e..5307d5687c 100644
--- a/board/waddledoo/board.h
+++ b/board/waddledoo/board.h
@@ -14,7 +14,6 @@
/* Charger */
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHARGER_RAA489000
-#define CONFIG_CHARGER_RUNTIME_CONFIG
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
diff --git a/common/charger.c b/common/charger.c
index 0f198b2635..7997b03371 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -209,63 +209,6 @@ DECLARE_CONSOLE_COMMAND(charger, command_charger,
/* Driver wrapper functions */
-/*
- * TODO(b/147672225): boards should define their own charger structures
- * Drivers cannot be included together, as they define some of the same items.
- * This will need to be addressed if we want to support different types of
- * charger chips on a board
- */
-#if defined(CONFIG_CHARGER_BD9995X)
-#include "driver/charger/bd9995x.h"
-#elif defined(CONFIG_CHARGER_BQ24715)
-#include "driver/charger/bq24715.h"
-#elif defined(CONFIG_CHARGER_BQ24770) || defined(CONFIG_CHARGER_BQ24773)
-#include "driver/charger/bq24773.h"
-#elif defined(CONFIG_CHARGER_BQ25710)
-#include "driver/charger/bq25710.h"
-#elif defined(CONFIG_CHARGER_ISL9237) || defined(CONFIG_CHARGER_ISL9238)
-#include "driver/charger/isl923x.h"
-#elif defined(CONFIG_CHARGER_ISL9241)
-#include "driver/charger/isl9241.h"
-#elif defined(CONFIG_CHARGER_MT6370) || defined(CONFIG_CHARGER_RT9466) \
- || defined(CONFIG_CHARGER_RT9467)
-#include "driver/charger/rt946x.h"
-#endif
-
-#if !defined(CONFIG_CHARGER_RUNTIME_CONFIG) && !defined(TEST_BUILD)
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
-#if defined(CONFIG_CHARGER_BD9995X)
- .i2c_addr_flags = BD9995X_ADDR_FLAGS,
- .drv = &bd9995x_drv,
-#elif defined(CONFIG_CHARGER_BQ24715)
- .i2c_addr_flags = CHARGER_ADDR_FLAGS,
- .drv = &bq24715_drv,
-#elif defined(CONFIG_CHARGER_BQ24770) || defined(CONFIG_CHARGER_BQ24773)
- .i2c_addr_flags = I2C_ADDR_CHARGER_FLAGS,
- .drv = &bq2477x_drv,
-#elif defined(CONFIG_CHARGER_BQ25710)
- .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
- .drv = &bq25710_drv,
-#elif defined(CONFIG_CHARGER_ISL9237) || defined(CONFIG_CHARGER_ISL9238)
- .i2c_addr_flags = ISL923X_ADDR_FLAGS,
- .drv = &isl923x_drv,
-#elif defined(CONFIG_CHARGER_ISL9241)
- .i2c_addr_flags = ISL9241_ADDR_FLAGS,
- .drv = &isl9241_drv,
-#elif defined(CONFIG_CHARGER_MT6370) || defined(CONFIG_CHARGER_RT9466) \
- || defined(CONFIG_CHARGER_RT9467)
- .i2c_addr_flags = RT946X_ADDR_FLAGS,
- .drv = &rt946x_drv,
-#endif
- },
-};
-
-const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
-#endif /* CONFIG_CHARGER_RUNTIME_CONFIG */
-
-
static void charger_chips_init(void)
{
int chip;
diff --git a/include/charger.h b/include/charger.h
index 2c7a7ce8a8..6c0c31845f 100644
--- a/include/charger.h
+++ b/include/charger.h
@@ -109,7 +109,6 @@ struct charger_config_t {
const struct charger_drv *drv;
};
-/* TODO(b/147672225): structure should be defined in board.c files */
#ifndef CONFIG_CHARGER_RUNTIME_CONFIG
extern const struct charger_config_t chg_chips[];
#else