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-14 08:03:27 -0700
commitad9965c666bf705e38a1ab26f25fb8045624e86c (patch)
tree44055314518b674909a1d2f95ea0c6f2f1af5c4b
parente866084a5260e7866cf5bab74dd12a3a3721412c (diff)
downloadchrome-ec-ad9965c666bf705e38a1ab26f25fb8045624e86c.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 Original-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> (cherry picked from commit 8ab12847b55b34e07e35eba11b74f1ef1ce25a78) Change-Id: I7f15973af27439e6a603b6f0473ab43dcf40cc90 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51098 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/usb_charging.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c
index dba0447c8c..89232a6421 100644
--- a/board/spring/usb_charging.c
+++ b/board/spring/usb_charging.c
@@ -253,6 +253,12 @@ static int dcp_current_limit(void)
return I_LIMIT_1500MA;
}
+static int video_dev_type(int device_type)
+{
+ return (device_type & ~TSU6721_TYPE_USB_HOST) |
+ TSU6721_TYPE_JIG_UART_ON;
+}
+
static int board_probe_video(int device_type)
{
tsu6721_disable_interrupts();
@@ -267,8 +273,7 @@ static int board_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;
}
}
@@ -534,6 +539,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));