summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-08-07 01:18:01 +0800
committerChromeBot <chrome-bot@google.com>2013-08-19 18:43:25 -0700
commitcd9f2480e648ee2c98375300e9dfed88879d12b3 (patch)
tree1541eae089e3d4abf8eedf45bf387bc2aafc45ff
parent50f351de0c2a9f6309c1a27a43e756c161591f19 (diff)
downloadchrome-ec-cd9f2480e648ee2c98375300e9dfed88879d12b3.tar.gz
spring: Workaround a bug that OTG dongle removal is not detected
TSU6721 doesn't report OTG dongle removal in S5. This prevents us from properly detecting subsequent charger type. Since we don't supply VBUS power in S5 for OTG dongle, if we see an OTG dongle with VBUS power in S5, we can conclude this is a charger plugged in after an OTG dongle is removed. By resetting TSU6721 to force a redetection in this case, we can work around this bug. This, however, consumes more power when a charger with ID=0 is plugged in, as the EC would keep resetting TSU6721. BUG=chrome-os-partner:21675 TEST=In S5, plug in OTG dongle and then unplug. Plug in a charger, and see yellow LED. TEST=In S5, plug in OTG dongle and then unplug. Boot the system and then plug in a charger. See yellow LED. BRANCH=Spring Change-Id: I6546b629c748efc67bf28ee8751513bb7ac9d206 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/64786 Reviewed-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/spring/usb_charging.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c
index e347ab9c91..787c128c08 100644
--- a/board/spring/usb_charging.c
+++ b/board/spring/usb_charging.c
@@ -557,6 +557,24 @@ static void usb_boost_pwr_off_hook(void) { usb_boost_power_hook(0); }
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, usb_boost_pwr_on_hook, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, usb_boost_pwr_off_hook, HOOK_PRIO_DEFAULT);
+static void usb_otg_workaround(void)
+{
+ /*
+ * TSU6721 doesn't sense the removal of an OTG dongle in S5. If a
+ * charger is plugged in after OTG dongle is removed, we reset
+ * TSU6721 to force a redetection. On the other hand, if the system
+ * boots before a charger is plugged in, TSU6721 would report OTG
+ * dongle removal, and thus we don't need to do anything in this case.
+ */
+ if ((current_dev_type & TSU6721_TYPE_OTG) &&
+ (current_dev_type & TSU6721_TYPE_VBUS_DEBOUNCED) &&
+ chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ pending_tsu6721_reset = 1;
+ task_wake(TASK_ID_PMU_TPS65090_CHARGER);
+ }
+}
+DECLARE_HOOK(HOOK_SECOND, usb_otg_workaround, HOOK_PRIO_DEFAULT);
+
static int usb_charger_removed(int dev_type)
{
if (!(current_dev_type & TSU6721_TYPE_VBUS_DEBOUNCED))