[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3981131.iZASKD2KPV@phil>
Date: Tue, 15 Jul 2025 12:35:47 +0200
From: Heiko Stuebner <heiko@...ech.de>
To: linux-rockchip@...ts.infradead.org,
John Keeping <jkeeping@...usicbrands.com>
Cc: John Keeping <jkeeping@...usicbrands.com>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
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: Re: [RFC/PATCH 2/2] phy: rockchip: usbdp: implement .set_mode
Hi John,
Am Donnerstag, 10. Juli 2025, 17:22:50 Mitteleuropäische Sommerzeit schrieb John Keeping:
> 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>
with the comments from Ondrej in [0] the whole thing seems to be
slightly more complex
[0] https://patchwork.kernel.org/project/linux-arm-kernel/patch/20250225184519.3586926-3-heiko@sntech.de/
> ---
> 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,
> };
>
>
Powered by blists - more mailing lists