[RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode
John Keeping
jkeeping at inmusicbrands.com
Thu Jul 10 08:22:50 PDT 2025
When the orientation of a type C cable changes, usbdp set the new
configuration in its internal state but does not write this to the
hardware.
Make use of phy_ops::set_mode to write this new state. This should be
called by the USB controller when it is notified of a role change
(assuming it is acting as the role switch) and will be called at a point
when the controller does not expect the phy to be operating normally.
Signed-off-by: John Keeping <jkeeping at inmusicbrands.com>
---
drivers/phy/rockchip/phy-rockchip-usbdp.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c
index c066cc0a7b4f1..00368fb09307a 100644
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
@@ -1335,9 +1335,23 @@ static int rk_udphy_usb3_phy_exit(struct phy *phy)
return 0;
}
+static int rk_udphy_usb3_phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ struct rk_udphy *udphy = phy_get_drvdata(phy);
+ int ret = 0;
+
+ mutex_lock(&udphy->mutex);
+ if (udphy->mode != UDPHY_MODE_NONE)
+ ret = rk_udphy_init(udphy);
+ mutex_unlock(&udphy->mutex);
+
+ return ret;
+}
+
static const struct phy_ops rk_udphy_usb3_phy_ops = {
.init = rk_udphy_usb3_phy_init,
.exit = rk_udphy_usb3_phy_exit,
+ .set_mode = rk_udphy_usb3_phy_set_mode,
.owner = THIS_MODULE,
};
--
2.50.0
More information about the linux-arm-kernel
mailing list