Re: [PATCH v14 37/38] phy: rockchip: usbdp: Re-init PHY on mux change

[email protected]
Newsgroups org.infradead.lists.linux-phy,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] rk_udphy_update_power_state() resets the PHY during Type-C mux changes without restoring active DP state, causing permanent loss of the DP link.
--

--- Patch [37]: [PATCH v14 37/38] phy: rockchip: usbdp: Re-init PHY on mux change ---
commit e0f454f6eb0c8216453e00dfe50cf7716c4aa60b
Author: Sebastian Reichel <[email protected]>

phy: rockchip: usbdp: Re-init PHY on mux change

This commit updates the driver to re-initialize the PHY when the mode
changes by replacing a return 0 with a call to rk_udphy_update_power_state().
This ensures the PHY is re-initialized when cable orientation changes or
when switching from DP-only to a mode with USB support.

> diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
> +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
> @@ -1392,7 +1392,7 @@ static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
>  
>  	rk_udphy_set_typec_state(udphy, state->mode);
>  
> -	return 0;
> +	return rk_udphy_update_power_state(udphy);

[Severity: High]
This is a pre-existing issue, but does forcing rk_udphy_update_power_state()
to run immediately on mux change cause an active DP link to drop permanently?

When the Type-C mux changes (such as plugging a USB device into a hub to
switch from DP-only to DP+USB), rk_udphy_update_power_state() triggers
rk_udphy_init() to reset the PHY.

rk_udphy_init() clears CMN_DP_LANE_EN_ALL, which physically disables the
active DP lanes. While the power state update restores the USB port status,
there appears to be no logic to re-enable the DP lanes via
rk_udphy_dp_lane_enable() or restore DP configurations.

Since subsequent link retraining via phy_configure() does not re-enable the
lanes, the DP link can permanently fail to train until a full DRM modeset
occurs, leaving the display black.

Additionally, does resetting the PHY mid-stream without a reset notification
sequence for DP (unlike the sequence used for USB) risk APB bus lockups
(SErrors) in the DP controller?

>  }
>  
>  static void rk_udphy_typec_mux_unregister(void *data)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=37

-- 
linux-phy mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/linux-phy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.