diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index 4a073301067f..9ba571f7b9bf 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c @@ -1292,17 +1292,26 @@ static const struct phy_ops rk_udphy_usb3_phy_ops = { .owner = THIS_MODULE, }; +static bool rk_udphy_is_supported_mode(struct typec_mux_state *state) +{ + /* Handle Safe State and USB State */ + if (state->mode < TYPEC_STATE_MODAL) + return true; + + /* Handle DP AltMode */ + if (state->alt && state->alt->svid == USB_TYPEC_DP_SID) + return true; + + return false; +} + static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux, struct typec_mux_state *state) { struct rk_udphy *udphy = typec_mux_get_drvdata(mux); - /* - * Ignore mux events not involving DP AltMode, because - * the mode field is being reused, e.g. state->mode == 4 - * could be either TYPEC_MODE_USB4 or TYPEC_DP_STATE_C. - */ - if (!state->alt || state->alt->svid != USB_TYPEC_DP_SID) + /* Ignore mux events not involving USB or DP */ + if (!rk_udphy_is_supported_mode(state)) return 0; mutex_lock(&udphy->mutex);