92 lines
3.1 KiB
Diff
92 lines
3.1 KiB
Diff
From git@z Thu Jan 1 00:00:00 1970
|
|
Subject: [PATCH v13 16/35] phy: rockchip: usbdp: Register DP aux bridge
|
|
From: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
Date: Tue, 14 Jul 2026 21:26:17 +0200
|
|
Message-Id: <20260714-rockchip-usbdp-cleanup-v13-16-6cb3e769d4c5@collabora.com>
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Add support to use USB-C connectors with the DP altmode helper code on
|
|
devicetree based platforms. To get this working there must be a DRM
|
|
bridge chain from the DisplayPort controller to the USB-C connector.
|
|
E.g. on Rockchip RK3576:
|
|
|
|
root@rk3576 # cat /sys/kernel/debug/dri/0/encoder-0/bridges
|
|
bridge[0]: dw_dp_bridge_funcs
|
|
refcount: 7
|
|
type: [10] DP
|
|
OF: /soc/dp@27e40000:rockchip,rk3576-dp
|
|
ops: [0x47] detect edid hpd
|
|
bridge[1]: drm_aux_bridge_funcs
|
|
refcount: 4
|
|
type: [0] Unknown
|
|
OF: /soc/phy@2b010000:rockchip,rk3576-usbdp-phy
|
|
ops: [0x0]
|
|
bridge[2]: drm_aux_hpd_bridge_funcs
|
|
refcount: 5
|
|
type: [10] DP
|
|
OF: /soc/i2c@2ac50000/typec-portc@22/connector:usb-c-connector
|
|
ops: [0x4] hpd
|
|
|
|
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
|
|
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
|
---
|
|
drivers/phy/rockchip/Kconfig | 2 ++
|
|
drivers/phy/rockchip/phy-rockchip-usbdp.c | 17 +++++++++++++++++
|
|
2 files changed, 19 insertions(+)
|
|
|
|
--- a/drivers/phy/rockchip/Kconfig
|
|
+++ b/drivers/phy/rockchip/Kconfig
|
|
@@ -136,8 +136,10 @@ config PHY_ROCKCHIP_USBDP
|
|
tristate "Rockchip USBDP COMBO PHY Driver"
|
|
depends on ARCH_ROCKCHIP && OF
|
|
depends on TYPEC
|
|
+ depends on DRM || DRM=n
|
|
select GENERIC_PHY
|
|
select USB_COMMON
|
|
+ select DRM_AUX_BRIDGE if DRM_BRIDGE
|
|
help
|
|
Enable this to support the Rockchip USB3.0/DP combo PHY with
|
|
Samsung IP block. This is required for USB3 support on RK3588.
|
|
--- a/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
+++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c
|
|
@@ -6,6 +6,7 @@
|
|
* Copyright (C) 2024 Collabora Ltd
|
|
*/
|
|
|
|
+#include <drm/bridge/aux-bridge.h>
|
|
#include <dt-bindings/phy/phy.h>
|
|
#include <linux/bitfield.h>
|
|
#include <linux/bits.h>
|
|
@@ -1414,6 +1415,7 @@ static int rk_udphy_probe(struct platfor
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct phy_provider *phy_provider;
|
|
+ struct fwnode_handle *dp_aux_ep;
|
|
struct resource *res;
|
|
struct rk_udphy *udphy;
|
|
void __iomem *base;
|
|
@@ -1467,6 +1469,21 @@ static int rk_udphy_probe(struct platfor
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
+
|
|
+ /*
|
|
+ * Only register the DRM bridge, if the DP aux channel is connected.
|
|
+ * Some boards use the USBDP PHY only for its USB3 capabilities. The
|
|
+ * aux bridge itself will be registered using port 0, endpoint 0, which
|
|
+ * is fine as that is the actual superspeed data connection shared by
|
|
+ * USB3 and DP based on the mux config.
|
|
+ */
|
|
+ dp_aux_ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev), 3, 0, 0);
|
|
+ if (dp_aux_ep) {
|
|
+ ret = drm_aux_bridge_register(dev);
|
|
+ fwnode_handle_put(dp_aux_ep);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+ }
|
|
|
|
udphy->phy_u3 = devm_phy_create(dev, dev->of_node, &rk_udphy_usb3_phy_ops);
|
|
if (IS_ERR(udphy->phy_u3)) {
|