diff options
author | Hsu Henry <Henry.Hsu@quantatw.com> | 2015-03-30 09:26:05 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-03-31 08:45:30 +0000 |
commit | 00c04527514aeec91dc7f97f956144194b4b69b4 (patch) | |
tree | c2d81420d099693032825fe449b3e2f3def0ebec | |
parent | e4fbf6f654bd00f26c94f1445ab04edf0cce10c7 (diff) | |
download | chrome-ec-00c04527514aeec91dc7f97f956144194b4b69b4.tar.gz |
Smart battery: Add delay time for battery read/write
Some battery pack can't response ec command.
Adding some dealy will improve it.
BUG=chrome-os-partner:37842
BRANCH=banjo
TEST=test with banjo, 100us. With the particular battery, no error occurs.
Change-Id: Ia40dc7d5286525d54641893d900dfe3a345a2156
Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/262853
Reviewed-by: Sheng-liang Song <ssl@google.com>
-rw-r--r-- | driver/battery/smart.c | 6 | ||||
-rwxr-xr-x | include/config.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c index 2d314e5e6f..2a0278cee5 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -24,11 +24,17 @@ test_mockable int sbc_write(int cmd, int param) int sb_read(int cmd, int *param) { +#ifdef CONFIG_BATTERY_I2C_ACCESS_DELAY_TIME + usleep(CONFIG_BATTERY_I2C_ACCESS_DELAY_TIME); +#endif return i2c_read16(I2C_PORT_BATTERY, BATTERY_ADDR, cmd, param); } int sb_write(int cmd, int param) { +#ifdef CONFIG_BATTERY_I2C_ACCESS_DELAY_TIME + usleep(CONFIG_BATTERY_I2C_ACCESS_DELAY_TIME); +#endif return i2c_write16(I2C_PORT_BATTERY, BATTERY_ADDR, cmd, param); } diff --git a/include/config.h b/include/config.h index 4048733ac1..cb59fdfcab 100755 --- a/include/config.h +++ b/include/config.h @@ -99,6 +99,11 @@ #undef CONFIG_BATTERY_CUT_OFF /* + * Delay time for smart battery command. + */ +#undef CONFIG_BATTERY_I2C_ACCESS_DELAY_TIME + +/* * Battery percent thresholds to notify the host or shut down the system. * If not specified, default values are set in include/battery.h. */ |