From bc34c98edd0e303617ce0dae7b283b18d290b0e7 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Mon, 10 Oct 2016 12:49:27 -0700 Subject: [PATCH] smart_battery: Remove smart charger unreachable code Smart battery code has I2C read/write code for smart chargers which is an unreachable code for few boards hence removed it. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I79933f61893c66447c686a81073c92f6a16e2d48 Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/396279 Commit-Ready: Vijay P Hiremath Tested-by: Vijay P Hiremath Reviewed-by: Shawn N --- driver/battery/smart.c | 10 ---------- driver/charger/bq24707a.c | 11 +++++++++++ driver/charger/bq24715.c | 11 +++++++++++ driver/charger/bq24735.c | 11 +++++++++++ include/battery_smart.h | 6 ------ 5 files changed, 33 insertions(+), 16 deletions(-) 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);