phy: rockchip: usbdp: add PD-to-HPD IRQ support

When DP output in Tyep-C interface, HPD and HPD IRQ info are
send by PD message, and transfer to phy by mux set callback
function. The usbdp phy need tell the DP controller not only
the HPD info, but also HPD IRQ info.

According to DP Standard 1.4a 3.3 section, the HPD IRQ pulse
width should be in the range from 0.5 ms to 1 ms, setting
the low level time between 750 us nad 800 us to satisfied
the specification.

Signed-off-by: Zhang Yubing <yubing.zhang@rock-chips.com>
Change-Id: Ie6d6d0537e6633e6e5f12119ceafc4109e32e74e
This commit is contained in:
Zhang Yubing
2021-12-10 19:47:42 +08:00
committed by Tao Huang
parent 3092561a61
commit 0bb9818fe4

View File

@@ -1089,15 +1089,27 @@ static int usbdp_typec_mux_set(struct typec_mux *mux,
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));
if (hpd && udphy->mode != mode) {
udphy->mode = mode;
udphy->mode_change = true;
if (!data) {
if (cfg->hpd_event_trigger)
cfg->hpd_event_trigger(udphy, false);
} else if (data->status & DP_STATUS_IRQ_HPD) {
if (cfg->hpd_event_trigger) {
cfg->hpd_event_trigger(udphy, false);
usleep_range(750, 800);
cfg->hpd_event_trigger(udphy, true);
}
} else if (data->status & DP_STATUS_HPD_STATE) {
if (udphy->mode != mode) {
udphy->mode = mode;
udphy->mode_change = true;
}
if (cfg->hpd_event_trigger)
cfg->hpd_event_trigger(udphy, true);
} else {
if (cfg->hpd_event_trigger)
cfg->hpd_event_trigger(udphy, false);
}
if (cfg->hpd_event_trigger)
cfg->hpd_event_trigger(udphy, hpd);
}
mutex_unlock(&udphy->mutex);