[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250710152252.2532020-3-jkeeping@inmusicbrands.com>
Date: Thu, 10 Jul 2025 16:22:50 +0100
From: John Keeping <jkeeping@...usicbrands.com>
To: linux-rockchip@...ts.infradead.org
Cc: John Keeping <jkeeping@...usicbrands.com>,
Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Heiko Stuebner <heiko@...ech.de>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sebastian Reichel <sebastian.reichel@...labora.com>,
Nicolas Frattaroli <nicolas.frattaroli@...labora.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
linux-usb@...r.kernel.org,
linux-phy@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: [RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode
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@...usicbrands.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
Powered by blists - more mailing lists