summaryrefslogtreecommitdiff
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
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>
-rw-r--r--board/fruitpie/board.h1
-rw-r--r--driver/charger/bq24773.c19
-rw-r--r--driver/charger/bq24773.h2
-rw-r--r--include/config.h7
4 files changed, 29 insertions, 0 deletions
diff --git a/board/fruitpie/board.h b/board/fruitpie/board.h
index 021e95a1df..8ab7345c56 100644
--- a/board/fruitpie/board.h
+++ b/board/fruitpie/board.h
@@ -42,6 +42,7 @@
#define CONFIG_CHARGER_SENSE_RESISTOR 5 /* milliOhms */
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 /* milliOhms */
#define CONFIG_CHARGER_INPUT_CURRENT 512 /* mA */
+#define CONFIG_CHARGER_ILIM_PIN_DISABLED /* external ILIM pin disabled */
/*
* Allow dangerous commands all the time, since we don't have a write protect
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 */
diff --git a/include/config.h b/include/config.h
index ae51b24c26..a31e8bd5d4 100644
--- a/include/config.h
+++ b/include/config.h
@@ -205,6 +205,13 @@
#undef CONFIG_CHARGER_DISCHARGE_ON_AC
/*
+ * Board specific flag used to disable external ILIM pin used to determine input
+ * current limit. When defined, the input current limit is decided only by
+ * the software register value.
+ */
+#undef CONFIG_CHARGER_ILIM_PIN_DISABLED
+
+/*
* Maximum amount of input current the charger can receive, in mA.
*
* This value should depend on external power adapter, designed charging