summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-05-08 15:04:26 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-14 20:53:03 +0000
commitac78a35cf198e69cec291d1d645b89997da10ea5 (patch)
treea59167f336e4b03b0e4335f5e6e6c7c7b0124af4 /driver
parentca55e1a6bbb5ffefe0f717a770b4b0f9512c6fd9 (diff)
downloadchrome-ec-ac78a35cf198e69cec291d1d645b89997da10ea5.tar.gz
fruitpie: disable battery charging chip ILIM pin
Typically bq24xxx charging chip limits input current to minimum of register value and ILIM pin. For fruitpie, the current limit will be decided solely in software, and the hardware pin will be ignored. BUG=chrome-os-partner:28611,chrome-os-partner:28311 BRANCH=none TEST=Tested on fruitpie. Verified that current limit can be set above the ILIM pin value of 500mA. Change-Id: Ia687446f95f9d18fde9d2b4ebb0e1c093aebf885 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/198940 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/bq24773.c19
-rw-r--r--driver/charger/bq24773.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/driver/charger/bq24773.c b/driver/charger/bq24773.c
index 854bb6dfb0..7443f5d0f3 100644
--- a/driver/charger/bq24773.c
+++ b/driver/charger/bq24773.c
@@ -170,9 +170,28 @@ int charger_set_voltage(int voltage)
int charger_post_init(void)
{
int rv;
+#ifdef CONFIG_CHARGER_ILIM_PIN_DISABLED
+ int option2;
+#endif
/* Set charger input current limit */
rv = charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
+
+#ifdef CONFIG_CHARGER_ILIM_PIN_DISABLED
+ if (rv)
+ return rv;
+
+ /* Disable the external ILIM pin. */
+ rv = i2c_read16(I2C_PORT_CHARGER, BQ24773_ADDR,
+ BQ24773_CHARGE_OPTION2, &option2);
+ if (rv)
+ return rv;
+
+ option2 &= ~OPTION2_EN_EXTILIM;
+ rv = i2c_write16(I2C_PORT_CHARGER, BQ24773_ADDR,
+ BQ24773_CHARGE_OPTION2, option2);
+#endif
+
return rv;
}
diff --git a/driver/charger/bq24773.h b/driver/charger/bq24773.h
index cce3e7e902..4b36fc7c74 100644
--- a/driver/charger/bq24773.h
+++ b/driver/charger/bq24773.h
@@ -28,4 +28,6 @@
#define OPTION0_CHARGE_INHIBIT (1 << 0)
#define OPTION0_LEARN_ENABLE (1 << 5)
+#define OPTION2_EN_EXTILIM (1 << 7)
+
#endif /* __CROS_EC_CHARGER_BQ24773_H */