summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/battery/smart.c6
-rwxr-xr-xinclude/config.h5
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.
*/