diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 9e7e9f3ec6..15dd72ff29 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -22,16 +22,6 @@ static int fake_state_of_charge = -1; -test_mockable int sbc_read(int cmd, int *param) -{ - return i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); -} - -test_mockable int sbc_write(int cmd, int param) -{ - return i2c_write16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); -} - test_mockable int sb_read(int cmd, int *param) { #ifdef CONFIG_BATTERY_CUT_OFF diff --git a/driver/charger/bq24707a.c b/driver/charger/bq24707a.c index 67467610df..ce49478d67 100644 --- a/driver/charger/bq24707a.c +++ b/driver/charger/bq24707a.c @@ -10,6 +10,7 @@ #include "charger.h" #include "console.h" #include "common.h" +#include "i2c.h" #include "util.h" /* Sense resistor configurations and macros */ @@ -39,6 +40,16 @@ static const struct charger_info bq24707a_charger_info = { /* bq24707a specific interfaces */ +static inline int sbc_read(int cmd, int *param) +{ + return i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + +static inline int sbc_write(int cmd, int param) +{ + return i2c_write16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + int charger_set_input_current(int input_current) { return sbc_write(BQ24707_INPUT_CURRENT, diff --git a/driver/charger/bq24715.c b/driver/charger/bq24715.c index 4386c3a17d..507c44e7da 100644 --- a/driver/charger/bq24715.c +++ b/driver/charger/bq24715.c @@ -10,6 +10,7 @@ #include "charger.h" #include "console.h" #include "common.h" +#include "i2c.h" #include "util.h" /* Sense resistor configurations and macros */ @@ -34,6 +35,16 @@ static const struct charger_info bq24725_charger_info = { .input_current_step = REG_TO_CURRENT(INPUT_I_STEP, R_AC), }; +static inline int sbc_read(int cmd, int *param) +{ + return i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + +static inline int sbc_write(int cmd, int param) +{ + return i2c_write16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + int charger_set_input_current(int input_current) { return sbc_write(BQ24715_INPUT_CURRENT, diff --git a/driver/charger/bq24735.c b/driver/charger/bq24735.c index 3c40d674f2..24a71c1deb 100644 --- a/driver/charger/bq24735.c +++ b/driver/charger/bq24735.c @@ -10,6 +10,7 @@ #include "charger.h" #include "console.h" #include "common.h" +#include "i2c.h" #include "util.h" /* Sense resistor configurations and macros */ @@ -39,6 +40,16 @@ static const struct charger_info bq24735_charger_info = { /* bq24735 specific interfaces */ +static inline int sbc_read(int cmd, int *param) +{ + return i2c_read16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + +static inline int sbc_write(int cmd, int param) +{ + return i2c_write16(I2C_PORT_CHARGER, CHARGER_ADDR, cmd, param); +} + int charger_set_input_current(int input_current) { return sbc_write(BQ24735_INPUT_CURRENT, diff --git a/include/battery_smart.h b/include/battery_smart.h index c5fd1d6eec..72b4cf6544 100644 --- a/include/battery_smart.h +++ b/include/battery_smart.h @@ -137,12 +137,6 @@ #define BATTERY_DISCHARGING_DISABLED 0x20 #define BATTERY_CHARGING_DISABLED 0x40 -/* Read from charger */ -int sbc_read(int cmd, int *param); - -/* Write to charger */ -int sbc_write(int cmd, int param); - /* Read from battery */ int sb_read(int cmd, int *param);