57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
From git@z Thu Jan 1 00:00:00 1970
|
|
Subject: [PATCH v13 21/35] phy: rockchip: usbdp: Properly handle
|
|
TYPEC_STATE_SAFE and TYPEC_STATE_USB
|
|
From: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Date: Tue, 14 Jul 2026 21:26:22 +0200
|
|
Message-Id: <20260714-rockchip-usbdp-cleanup-v13-21-6cb3e769d4c5@collabora.com>
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Handle TYPEC_STATE_SAFE and TYPEC_STATE_USB Type-C state events,
|
|
so that the muxing is properly updated when exiting DP AltMode.
|
|
|
|
Fixes: 2f70bbddeb45 ("phy: rockchip: add usbdp combo phy driver")
|
|
Reported-by: Sashiko <sashiko-bot@kernel.org>
|
|
Closes: https://sashiko.dev/#/message/20260619155020.CC7361F000E9%40smtp.kernel.org
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
---
|
|
drivers/phy/rockchip/phy-rockchip-usbdp.c | 21 +++++++++++++++------
|
|
1 file changed, 15 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
@@ -1293,17 +1293,26 @@ static const struct phy_ops rk_udphy_usb
|
|
.owner = THIS_MODULE,
|
|
};
|
|
|
|
+static bool rk_udphy_is_supported_mode(struct typec_mux_state *state)
|
|
+{
|
|
+ /* Handle Safe State and USB State */
|
|
+ if (state->mode < TYPEC_STATE_MODAL)
|
|
+ return true;
|
|
+
|
|
+ /* Handle DP AltMode */
|
|
+ if (state->alt && state->alt->svid == USB_TYPEC_DP_SID)
|
|
+ return true;
|
|
+
|
|
+ return false;
|
|
+}
|
|
+
|
|
static int rk_udphy_typec_mux_set(struct typec_mux_dev *mux,
|
|
struct typec_mux_state *state)
|
|
{
|
|
struct rk_udphy *udphy = typec_mux_get_drvdata(mux);
|
|
|
|
- /*
|
|
- * Ignore mux events not involving DP AltMode, because
|
|
- * the mode field is being reused, e.g. state->mode == 4
|
|
- * could be either TYPEC_MODE_USB4 or TYPEC_DP_STATE_C.
|
|
- */
|
|
- if (!state->alt || state->alt->svid != USB_TYPEC_DP_SID)
|
|
+ /* Ignore mux events not involving USB or DP */
|
|
+ if (!rk_udphy_is_supported_mode(state))
|
|
return 0;
|
|
|
|
mutex_lock(&udphy->mutex);
|