diff options
-rw-r--r-- | board/spring/usb_charging.c | 15 | ||||
-rw-r--r-- | common/gaia_power.c | 5 | ||||
-rw-r--r-- | include/chipset.h | 5 |
3 files changed, 21 insertions, 4 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c index c480e07e59..08f55708bb 100644 --- a/board/spring/usb_charging.c +++ b/board/spring/usb_charging.c @@ -731,11 +731,18 @@ static void notify_dev_type_change(int dev_type) /* * If the charger is surely removed (not coming back within * BATTERY_KEY_DELAY), pull down VAC. + * + * For older boards, doing this actually resets TPS65090. Fortunately, + * auto-hibernate is disabled on these boards by host command. + * Therefore, we can check auto-hibernate delay to determine if we can + * do this. */ - if (!(dev_type & TSU6721_TYPE_VBUS_DEBOUNCED)) - hook_call_deferred(usb_pull_vac, BATTERY_KEY_DELAY); - else - hook_call_deferred(usb_pull_vac, -1); + if (chipset_get_auto_hibernate_delay()) { + if (!(dev_type & TSU6721_TYPE_VBUS_DEBOUNCED)) + hook_call_deferred(usb_pull_vac, BATTERY_KEY_DELAY); + else + hook_call_deferred(usb_pull_vac, -1); + } } static int usb_want_redetect(int dev_type) diff --git a/common/gaia_power.c b/common/gaia_power.c index 878ea7331b..b18d52b367 100644 --- a/common/gaia_power.c +++ b/common/gaia_power.c @@ -158,6 +158,11 @@ static void check_hibernate_timer(void) system_hibernate(CONFIG_HIBERNATE_WAKE_PERIOD_SECS, 0); } } + +int chipset_get_auto_hibernate_delay(void) +{ + return hibernate_delay; +} #else static void hibernate_timer_arm(void) { diff --git a/include/chipset.h b/include/chipset.h index e652ec23d8..e5765a00a4 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -75,4 +75,9 @@ void chipset_force_shutdown(void); */ void chipset_reset(int cold_reset); +/** + * Return the auto-hibernate delay in seconds. + */ +int chipset_get_auto_hibernate_delay(void); + #endif /* __CROS_EC_CHIPSET_H */ |