From: John Keeping <jkeeping@inmusicbrands.com>
To: linux-rockchip@lists.infradead.org
Cc: John Keeping <jkeeping@inmusicbrands.com>,
Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
linux-usb@vger.kernel.org, linux-phy@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode
Date: Thu, 10 Jul 2025 16:22:50 +0100 [thread overview]
Message-ID: <20250710152252.2532020-3-jkeeping@inmusicbrands.com> (raw)
In-Reply-To: <20250710152252.2532020-1-jkeeping@inmusicbrands.com>
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@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
next prev parent reply other threads:[~2025-07-10 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 15:22 [RFC/PATCH 0/2] dwc3/rockchip orientation fixes John Keeping
2025-07-10 15:22 ` [RFC/PATCH 1/2] usb: dwc3: disable for USB_ROLE_NONE John Keeping
2025-07-12 0:11 ` Thinh Nguyen
2025-07-14 15:15 ` John Keeping
2025-07-29 22:10 ` Thinh Nguyen
2025-08-06 17:10 ` John Keeping
2025-08-07 0:58 ` Thinh Nguyen
2025-07-10 15:22 ` John Keeping [this message]
2025-07-15 10:35 ` [RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode Heiko Stuebner
2025-07-16 19:14 ` John Keeping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250710152252.2532020-3-jkeeping@inmusicbrands.com \
--to=jkeeping@inmusicbrands.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=nicolas.frattaroli@collabora.com \
--cc=sebastian.reichel@collabora.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox