Disable LEARN option during charger init

When charger is initialized disable the LEARN option i.e. reenable
charging on AC power

BUG=chrome-os-partner:32320
TEST=set DUT to discharge on AC and then reflash EC. Ensure that
charging begins again.
BRANCH=none

Change-Id: I3e83db27ab49548d5491548fa624899865c11bfb
Signed-off-by: Mohammed Habibulla <moch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/222644
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Mohammed Habibulla
2014-10-09 14:43:08 -07:00
committed by chrome-internal-fetch
parent fd7846fe09
commit f92f70d04c
5 changed files with 35 additions and 1 deletions

View File

@@ -182,6 +182,7 @@ int charger_post_init(void)
/* Always monitor adapter current (40X multiplier). */
option |= OPT_FIX_IOUT_ALWAYS;
option &= ~OPT_IOUT_MASK;
option &= ~OPT_LEARN_MASK;
/* Enable dynamic power management */
option |= OPT_IDPM_ENABLE;

View File

@@ -161,6 +161,17 @@ int charger_post_init(void)
* charging current = 0 mA
*/
int rv, option;
rv = charger_get_option(&option);
if (rv)
return rv;
option &= ~OPTION_LEARN_ENABLE;
rv = charger_set_option(option);
if (rv)
return rv;
/* Set charger input current limit */
return charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
}

View File

@@ -161,6 +161,17 @@ int charger_post_init(void)
* charging current = 0 mA
*/
int rv, option;
rv = charger_get_option(&option);
if (rv)
return rv;
option &= ~OPTION_LEARN_ENABLE;
rv = charger_set_option(option);
if (rv)
return rv;
/* Set charger input current limit */
return charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
}

View File

@@ -161,6 +161,7 @@ int charger_post_init(void)
if (rv)
return rv;
val &= ~OPTION_IFAULT_HI_ENABLE;
val &= ~OPTION_LEARN_ENABLE;
rv = charger_set_option(val);
if (rv)
return rv;

View File

@@ -169,11 +169,21 @@ int charger_set_voltage(int voltage)
/* Charging power state initialization */
int charger_post_init(void)
{
int rv, option;
#ifdef CONFIG_CHARGER_ILIM_PIN_DISABLED
int rv;
int option2;
#endif
rv = charger_get_option(&option);
if (rv)
return rv;
option &= ~OPTION0_LEARN_ENABLE;
rv = charger_set_option(option);
if (rv)
return rv;
#ifdef CONFIG_CHARGER_ILIM_PIN_DISABLED
/* Read the external ILIM pin enabled flag. */
rv = i2c_read16(I2C_PORT_CHARGER, BQ24773_ADDR,