diff options
author | lu.zhang <lu.zhang@bitland.corp-partner.google.com> | 2019-01-09 17:00:14 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2019-02-11 08:35:11 +0000 |
commit | 9bbef08c79bf91690265ed3ecce06c6e4d16bce6 (patch) | |
tree | 7d9933f08583076379e5263131b6398f2d7ff58b | |
parent | e05c91c6dcc79ebca292a5925fcc0ff51abf2361 (diff) | |
download | chrome-ec-9bbef08c79bf91690265ed3ecce06c6e4d16bce6.tar.gz |
coral: setting input current limit after detecting ac_ok
Sometimes EC would execute PD hard reset afterall and it causes the
system brownout on some boards with low voltage battery. According
to Rohm's recommendation, IBUS_LIM_SET and ICC_LIM_SET need be rewritten
within 100ms once VCC&VBUS reset if doesn't enable charger's bit
BD9995X_CMD_VM_CTRL_SET_EXTIADPEN. Obviously EC has not met the timing.
BUG=b:121105415
BRANCH=coral
TEST=The failed DUT can boot up normally
Change-Id: Id9c636da18be534103db0ab006d344f993d5879b
Reviewed-on: https://chromium-review.googlesource.com/c/1402384
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
Tested-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
-rw-r--r-- | common/extpower_gpio.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/extpower_gpio.c b/common/extpower_gpio.c index c9e62b71e2..6d2d6cb918 100644 --- a/common/extpower_gpio.c +++ b/common/extpower_gpio.c @@ -11,6 +11,7 @@ #include "hooks.h" #include "host_command.h" #include "timer.h" +#include "charger.h" static int debounced_extpower_presence; @@ -40,11 +41,29 @@ static void extpower_deferred(void) } DECLARE_DEFERRED(extpower_deferred); +#ifdef CONFIG_CHARGER_BD9995X +static void extpower_deferred_set_input_current(void) +{ + if (gpio_get_level(GPIO_AC_PRESENT)) + charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT); + +} +DECLARE_DEFERRED(extpower_deferred_set_input_current); +#endif + void extpower_interrupt(enum gpio_signal signal) { /* Trigger deferred notification of external power change */ hook_call_deferred(&extpower_deferred_data, CONFIG_EXTPOWER_DEBOUNCE_MS * MSEC); + +#ifdef CONFIG_CHARGER_BD9995X + /* As Rohm's recommendation, EC should set input current limit within 100ms + * once VCC&VBUS reset if doesn't enable charger's hardware IADP. + */ + hook_call_deferred(&extpower_deferred_set_input_current_data, + 30 * MSEC); +#endif } static void extpower_init(void) |