phy: rockchip: usbdp: fix repeat modify mode_change flag issue

When use Typc-C Interface, after detect CC connect, we assume
the usbdp phy can be use as multi-function(both usb and dp use)
and init the phy in multi-function mode. If the sink only
support only dp function, we need reinit the usbdp phy only dp
function.

When enter dp mode, config the pin assignment, get the attention
cmd from sink, tcpm will callback the mux set. But we only need
the info when hpd is true.

Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: I25aa718e4b41b9645aa456a2767addfbd624318c
This commit is contained in:
Zhang Yubing
2021-11-23 21:53:17 +08:00
committed by Tao Huang
parent e830cf86d5
commit d6fbed788e

View File

@@ -690,6 +690,8 @@ static int udphy_power_on(struct rockchip_udphy *udphy, u8 mode)
if (udphy->mode & UDPHY_MODE_USB)
udphy_u3_port_disable(udphy, false);
} else if (udphy->mode_change) {
udphy->mode_change = false;
udphy->status = UDPHY_MODE_NONE;
if (udphy->mode == UDPHY_MODE_DP)
udphy_u3_port_disable(udphy, true);
@@ -902,12 +904,6 @@ static int usbdp_typec_mux_set(struct typec_mux *mux,
break;
}
if (udphy->mode != mode) {
udphy->mode = mode;
udphy->mode_change = true;
} else
udphy->mode_change = false;
if (state->alt && state->alt->svid == USB_TYPEC_DP_SID) {
struct typec_displayport_data *data = state->data;
bool hpd = !!(data && (data->status & DP_STATUS_HPD_STATE));
@@ -922,6 +918,11 @@ static int usbdp_typec_mux_set(struct typec_mux *mux,
}
}
if (hpd && udphy->mode != mode) {
udphy->mode = mode;
udphy->mode_change = true;
}
if (cfg->hpd_event_trigger)
cfg->hpd_event_trigger(udphy, hpd);