summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2014-12-24 23:05:47 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-01 01:08:21 +0000
commita9099ee3fcd922e3e8ee5f1e417403c9bfee970d (patch)
tree8894ae14a5320e3648128f10bcd998f733efa4b2
parentedd77863800f47ebf642859cebfd32c48b0ff5ca (diff)
downloadchrome-ec-a9099ee3fcd922e3e8ee5f1e417403c9bfee970d.tar.gz
plankton: treat USB mode as DP detached
When a DP cable is attached, if we toggle the USB/DP mux to USB mode, the DP data link is broken. In this case, we should send a HPD event to notify the host. Similarily, when we switch back to DP mode when a cable is attached, we should send a HPD attachment event and then a HPD IRQ to notify the host that the DP link is ready. BRANCH=None BUG=chrome-os-partner:34296 TEST=Connect Plankton to Samus. Perform the following tests: 1. Attach a cable, and switch between USB and DP mode. 2. Attach a cable in DP mode, switch to USB mode, unplug the cable, and then switch back to DP mode. 3. Similar to 2 but start without the cable. Change-Id: I5db0c036ce45850b2f4ca142957f4a235673df6f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237604 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/plankton/board.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c
index bd6fe3637a..e5afef21ad 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -57,11 +57,13 @@ static int sn75dp130_dpcd_init(void);
void hpd_lvl_deferred(void)
{
int level = gpio_get_level(GPIO_DPSRC_HPD);
+ int dp_mode = !gpio_get_level(GPIO_USBC_SS_USB_MODE);
if (level != hpd_prev_level) {
/* Stable level changed. Send HPD event */
hpd_prev_level = level;
- pd_send_hpd(0, level ? hpd_high : hpd_low);
+ if (dp_mode)
+ pd_send_hpd(0, level ? hpd_high : hpd_low);
/* Configure redriver's back side */
if (level)
sn75dp130_dpcd_init();
@@ -69,7 +71,7 @@ void hpd_lvl_deferred(void)
}
/* Send queued IRQ if the cable is attached */
- if (hpd_possible_irq && level)
+ if (hpd_possible_irq && level && dp_mode)
pd_send_hpd(0, hpd_irq);
hpd_possible_irq = 0;
@@ -147,6 +149,18 @@ static void set_usbc_action(enum usbc_action act)
was_usb_mode = gpio_get_level(GPIO_USBC_SS_USB_MODE);
gpio_set_level(GPIO_USBC_SS_USB_MODE, !was_usb_mode);
gpio_set_level(GPIO_CASE_CLOSE_EN, !was_usb_mode);
+ if (!gpio_get_level(GPIO_DPSRC_HPD))
+ break;
+ /*
+ * DP cable is connected. Send HPD event according to USB/DP
+ * mux state.
+ */
+ if (!was_usb_mode) {
+ pd_send_hpd(0, hpd_low);
+ } else {
+ pd_send_hpd(0, hpd_high);
+ pd_send_hpd(0, hpd_irq);
+ }
break;
case USBC_ACT_USB_EN:
gpio_set_level(GPIO_USBC_SS_USB_MODE, 1);