Thread (58 messages) 58 messages, 4 authors, 3d ago

Re: [PATCH v13 34/35] phy: rockchip: usbdp: Re-init PHY on mux change

From: sashiko-bot@kernel.org
Date: 2026-07-14 20:39:29
Also in: linux-phy

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Forcing a PHY re-initialization during a dynamic mode switch permanently disables the DP lanes and leaves stale lane routing, breaking the DP link.
--
--- Patch [34]: [PATCH v13 34/35] phy: rockchip: usbdp: Re-init PHY on mux change ---
commit 81cf1b50e4dbd6c92b948c08ec8401f3568e9429
Author: Sebastian Reichel [off-list ref]

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

Ensure that the right part of the PHY are powered up when the mode changes.
This ensures the PHY is re-initialized during cable orientation changes or
switching from DP-only into a mode with USB support.
quoted hunk ↗ jump to hunk
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index e597cdfe8d790..87d6df6821760 100644
--- 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]
When a dynamic mode switch happens (such as connecting a USB 3 device to an
active Type-C DP dock), rk_udphy_update_power_state() will call
rk_udphy_init():

drivers/phy/rockchip/phy-rockchip-usbdp.c:rk_udphy_update_power_state() {
	...
	} else {
		/* Mode change => re-init */
		ret = rk_udphy_init(udphy);
	...
}

rk_udphy_init() then explicitly clears CMN_DP_LANE_EN_ALL, physically disabling
the DP lanes:

drivers/phy/rockchip/phy-rockchip-usbdp.c:rk_udphy_init() {
	...
	regmap_update_bits(udphy->pma_regmap, CMN_LANE_MUX_AND_EN_OFFSET,
			   CMN_DP_LANE_MUX_ALL | CMN_DP_LANE_EN_ALL,
			   ...
			   FIELD_PREP(CMN_DP_LANE_EN_ALL, 0));
	...
}

Since rk_udphy_update_power_state() does not restore the lane configuration and
the DRM driver does not call phy_power_on() again (it only retrains the link
via phy_configure()), does this permanently disable the DP lanes and break the
DP link during a mode switch?
 }
 
 static void rk_udphy_typec_mux_unregister(void *data)
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260714-rockchip-usbdp-cleanup-v13-0-6cb3e769d4c5@collabora.com?part=34
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help