summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-06-21 15:17:54 +0800
committerChromeBot <chrome-bot@google.com>2013-06-22 22:30:06 -0700
commit326354f58be87e66581fa8f65dd38d3b8c6f3d8e (patch)
treec86cc6b406b397fc699f0f0f2b31075c1147d0fe
parent843587252350330e33c143a7485cfbc184654921 (diff)
downloadchrome-ec-326354f58be87e66581fa8f65dd38d3b8c6f3d8e.tar.gz
spring: Check USB device type periodically
The device type reported by TSU6721 changed rapidly in some cases, and we miss the change after the first one. We need to check device type change periodically. BUG=chrome-os-partner:20336 TEST=Plug and unplug DCP charger in suspend. Check device type is detected correctly. BRANCH=Spring Original-Change-Id: Iaab4168f99637b736b8ba42f4313e248b84bdd44 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59535 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 69b18e5fb9890f3a638c1587968b110dc1110ba1) Change-Id: I3cb86b0bfeb7bb02d750197405ffe385b06808e9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59666 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/extpower_usb.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/extpower_usb.c b/common/extpower_usb.c
index f14a1f86a6..927b831123 100644
--- a/common/extpower_usb.c
+++ b/common/extpower_usb.c
@@ -673,6 +673,17 @@ void extpower_charge_update(int force_update)
pending_dev_type_update = 0;
}
+ /*
+ * Check device type except when:
+ * 1. Current device type is non-standard charger or undetermined
+ * charger type. This is handled by charger re-detection.
+ * 2. ID_MUX=1. This is handled by ADC watchdog.
+ */
+ if (current_dev_type != TSU6721_TYPE_VBUS_DEBOUNCED &&
+ !(current_dev_type & TSU6721_TYPE_NON_STD_CHG) &&
+ gpio_get_level(GPIO_ID_MUX) == 0)
+ force_update |= (tsu6721_get_device_type() != current_dev_type);
+
if (!force_update)
int_val = tsu6721_get_interrupts();