Re: [PATCH 2/2] phy: rockchip: usbdp: re-init the phy on orientation-change
From: Heiko Stübner <heiko@sntech.de>
Date: 2025-02-25 22:07:49
Also in:
linux-phy, linux-rockchip, lkml
From: Heiko Stübner <heiko@sntech.de>
Date: 2025-02-25 22:07:49
Also in:
linux-phy, linux-rockchip, lkml
Am Dienstag, 25. Februar 2025, 19:45:19 MEZ schrieb Heiko Stuebner:
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index 7b17c82ebcfc..b63259a90d85 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c@@ -1277,6 +1277,7 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw, enum typec_orientation orien) { struct rk_udphy *udphy = typec_switch_get_drvdata(sw); + int ret = 0; mutex_lock(&udphy->mutex);@@ -1292,6 +1293,12 @@ static int rk_udphy_orien_sw_set(struct typec_switch_dev *sw, rk_udphy_set_typec_default_mapping(udphy); rk_udphy_usb_bvalid_enable(udphy, true); + /* re-init the phy if already on */ + if (udphy->status != UDPHY_MODE_NONE) { + rk_udphy_disable(udphy); + ret = rk_udphy_setup(udphy); + } +
just realized that if (udphy->status != UDPHY_MODE_NONE) ret = rk_udphy_init(udphy); does the same, and we really don't need to disable and re-enable the phy's clocks that are the added via rk_udphy_disable and _setup. So will give it a day and send a v2 then. Heiko