summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-08-08 10:54:08 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-12 05:11:39 +0000
commit283fe98939fa56c61280529e2f933bedb122a52a (patch)
tree9f23119e61da776c19363b572204071549ae2b0b /driver
parentadbd5a0c9a6749468b7c085029cf5e5a41595dbf (diff)
downloadchrome-ec-283fe98939fa56c61280529e2f933bedb122a52a.tar.gz
samus: ryu: fix charge state machine init of input currentstabilize-6146.B
Currently charge state machine resets input current limit to default every time AC is connected. Problem is by the time charge state machine gets around to setting input current, it could have already been set by successful PD negotiation, and this ends up overriding that value. This fix has the state machine store desired input current limit, as determined from PD negotation or any other place, and send last desired input current limit on AC connect. BUG=chrome-os-partner:24461 BRANCH=none TEST=load on samus, test toggling between "pd 0 dev 5" and "pd 0 dev 20", and test plugging and unplugging zinger numerous times, and verify charger command always gives the expected input current limit based on PD negotiation. Change-Id: I18d8acc9e2085739e783c9c70c682d46bcce7fdb Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211639 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/bq24773.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/driver/charger/bq24773.c b/driver/charger/bq24773.c
index da2bc93909..5ea62d7e4b 100644
--- a/driver/charger/bq24773.c
+++ b/driver/charger/bq24773.c
@@ -169,18 +169,12 @@ int charger_set_voltage(int voltage)
/* Charging power state initialization */
int charger_post_init(void)
{
- int rv;
#ifdef CONFIG_CHARGER_ILIM_PIN_DISABLED
+ int rv;
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;
-
/* Read the external ILIM pin enabled flag. */
rv = i2c_read16(I2C_PORT_CHARGER, BQ24773_ADDR,
BQ24773_CHARGE_OPTION2, &option2);
@@ -193,9 +187,10 @@ int charger_post_init(void)
rv = i2c_write16(I2C_PORT_CHARGER, BQ24773_ADDR,
BQ24773_CHARGE_OPTION2, option2);
}
-#endif
-
return rv;
+#else
+ return EC_SUCCESS;
+#endif
}
int charger_discharge_on_ac(int enable)