mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
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>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
edd7786380
commit
a9099ee3fc
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user