mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-01 21:02:27 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
ca55e1a6bb
commit
ac78a35cf1
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -204,6 +204,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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user