summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-13 13:11:07 +0800
committerChromeBot <chrome-bot@google.com>2013-05-13 22:55:15 -0700
commit8ab12847b55b34e07e35eba11b74f1ef1ce25a78 (patch)
treefb47c8e4dc87c84fd462b2b19827a2c75858b8b1
parentcbebc28804cfcaed9687408f1673017a070320bb (diff)
downloadchrome-ec-8ab12847b55b34e07e35eba11b74f1ef1ce25a78.tar.gz
spring: Fix a bug that ID_MUX is never switched back
If the user unplug video dongle before it is detected and handled, we may be stuck with ID_MUX=1 and interrupt from TSU6721 disabled. This essentially breaks charging. BUG=chrome-os-partner:18997 TEST=Build and check charging port still works. BRANCH=spring Change-Id: I93e69287d07947fef743b4674857e52c26513835 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50969 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--common/extpower_usb.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/extpower_usb.c b/common/extpower_usb.c
index 56a85253ae..85f11f3101 100644
--- a/common/extpower_usb.c
+++ b/common/extpower_usb.c
@@ -265,6 +265,12 @@ static int hard_current_limit(int limit)
return limit;
}
+static int video_dev_type(int device_type)
+{
+ return (device_type & ~TSU6721_TYPE_USB_HOST) |
+ TSU6721_TYPE_JIG_UART_ON;
+}
+
static int probe_video(int device_type)
{
tsu6721_disable_interrupts();
@@ -279,8 +285,7 @@ static int probe_video(int device_type)
return device_type;
} else {
/* Not USB host but video */
- device_type = (device_type & ~TSU6721_TYPE_USB_HOST) |
- TSU6721_TYPE_JIG_UART_ON;
+ device_type = video_dev_type(device_type);
return device_type;
}
}
@@ -467,6 +472,8 @@ static int usb_manage_boost(int dev_type)
gpio_set_level(GPIO_BOOST_EN, need_boost);
msleep(DELAY_POWER_MS);
dev_type = tsu6721_get_device_type();
+ if (gpio_get_level(GPIO_ID_MUX))
+ dev_type = video_dev_type(dev_type);
}
} while (need_boost == !usb_need_boost(dev_type));