Add Type-C DP support for RK3399 EVB IND board
Subsystems (10)
v11 cover Add Type-C DP support for RK3399 EVB IND board
From: Chaoyi Chen <[email protected]>
This series focuses on adding Type-C DP support for USBDP PHY and DP driver. The USBDP PHY and DP will perceive the changes in cable status based on the USB PD and Type-C state machines provided by TCPM. Before this, the USBDP PHY and DP controller of RK3399 sensed cable state changes through extcon, and devices such as the RK3399 Gru-Chromebook rely on them. This series should not break them.
====
1. DisplayPort HPD status notify
Before v7, I implemented a variety of DP HPD status notify. However, they all had various problems and it was difficult to become a generic solution.
Under the guidance of Heikki and Dmitry, a decoupled notification method between the TypeC and DRM subsystems was introduced in v7. First, a notification is sent when TypeC registers a new altmode. Then, a generic DP AUX HPD bridge is implemented on the DRM side.
During v7-v10, we added a new notifier in typec to notify the altmode device register event. With the help of Greg and Heikki, we implemented the reuse of notifiers for the type bus itself in patch1 of v11.
That makes it redundant for each Type-C controller driver to implement a similar DP AUX HPD bridge in embedded scenarios.
====
2. Altmode switching and orientation switching for USBDP PHY
For USB Type-C interfaces, an external Type-C controller chip assists by detecting cable attachment, determining plug orientation, and reporting USB PD message. The USB/DP combo PHY supports software configurable pin mapping and DisplayPort lane assignment. Based on these message, the combo PHY can perform both altmode switching and orientation switching via software.
The RK3399 EVB IND board has a Type-C interface DisplayPort. It use fusb302 chip as Type-C controller. The connection diagram is shown below:
fusb302 chip +---> USB2.0 PHY ----> DWC3 USB controller
|
+---> USB/DP PHY0 +--> CDN-DP controller
|
+--> DWC3 USB controller====
3. Multiple bridge model for RK3399 CDN-DP
The RK3399 has two USB/DP combo PHY and one CDN-DP controller. And the CDN-DP can be switched to output to one of the PHYs.
USB/DP PHY0 ---+
| <----> CDN-DP controller
USB/DP PHY1 ---+
In previous versions, if both PHY ports were connected to DP, the CDN-DP driver would select the first PHY port for output.
On Dmitry's suggestion, we introduced a multi-bridge model to support flexible selection of the output PHY port. For each PHY port, a separate encoder and bridge are registered.
The change is based on the DRM AUX HPD bridge, rather than the extcon approach. This requires the DT to correctly describe the connections between the first bridge in bridge chain and DP controller. And Once the first bridge is obtained, we can get the last bridge corresponding to the USB-C connector, and then set the DRM connector's fwnode to the corresponding one to enable HPD notification.
====
Patch1 set the bus also for the port and plug altmodes. Patch2 export typec bus and typec altmode device types. Patch3 add generic USB Type-C DP HPD bridge.
Patch4 add new API drm_aux_bridge_register_from_node(). Patch5 add new Type-C mode switch for RK3399 USBDP phy binding. Patch6 add typec_mux and typec_switch for RK3399 USBDP PHY. Patch7 add DRM AUX bridge support for RK3399 USBDP PHY. Patch8 drops CDN-DP's extcon dependency when Type-C is present. Patch9 add multiple bridges to support PHY port selection. Patch10 add missing dp_out port for RK3399 CDN-DP. Patch11 add Type-C DP support for RK3399 EVB IND board.
Changes in v11:
- Link to V10: https://lore.kernel.org/all/[email protected]/
- Switch to using typec bus notifiers.
Changes in v10:
- Link to V9: https://lore.kernel.org/all/[email protected]/
- Notify TYPEC_ALTMODE_UNREGISTERED when altmode removed.
- Add drm_aux_bridge_register_from_node().
- Fix refcount usage of drm_bridge.
Changes in v9:
- Link to V8: https://lore.kernel.org/all/[email protected]/
- Remove the exposed DRM_AUX_HPD_BRIDGE option, and select DRM_AUX_HPD_TYPEC_BRIDGE when it is available.
- Add usb role switch for Type-C.
- Remove USB2 PHY in Type-C connection.
- ...
Changes in v8:
- Link to V7: https://lore.kernel.org/all/[email protected]/
- Export all typec device types for identification.
- Merge generic DP HPD bridge into one module.
- Fix coding style.
Changes in v7:
- Link to V6: https://lore.kernel.org/all/[email protected]/
- Add notifier functions for Type-C core.
- Add generic USB Type-C DP HPD bridge.
Changes in v6:
- Link to V5: https://lore.kernel.org/all/[email protected]/
- Fix depend in Kconfig.
- Check DP svid in tcphy_typec_mux_set().
- Remove mode setting in tcphy_orien_sw_set().
- Rename some variable names.
- Attach the DP bridge to the next bridge.
Changes in v5:
- Link to V4: https://lore.kernel.org/all/[email protected]/
- Remove the calls related to drm_aux_hpd_bridge_notify().
- Place the helper functions in the same compilation unit.
- Add more comments about parent device.
- Add DRM AUX bridge support for RK3399 USBDP PHY
- By parsing the HPD bridge chain, set the connector's of_node to the of_node corresponding to the USB-C connector.
- Return EDID cache when other port is already enabled.
Changes in v4:
- Link to V3: https://lore.kernel.org/all/[email protected]/
- Add default HPD device for DisplayPort altmode.
- Introduce multiple bridges for CDN-DP.
- ...
Changes in v3:
- Link to V2: https://lore.kernel.org/all/[email protected]/
- Add more descriptions to clarify the role of the PHY in switching.
- Fix wrong vdo value.
- Fix port node in usb-c-connector.
Changes in v2:
- Link to V1: https://lore.kernel.org/all/[email protected]/
- Reuse dp-port/usb3-port in rk3399-typec-phy binding.
- Fix compile error when CONFIG_TYPEC is not enabled.
- Notify DP HPD state by USB/DP PHY.
- Ignore duplicate HPD events.
- Add endpoint to link DP PHY and DP controller.
- Fix devicetree coding style.
Chaoyi Chen (10):
usb: typec: Export typec bus and typec altmode device type drm/bridge: Implement generic USB Type-C DP HPD bridge drm/bridge: aux: Add drm_aux_bridge_register_from_node()
dt-bindings: phy: rockchip: rk3399-typec-phy: Support mode-switch
phy: rockchip: phy-rockchip-typec: Add typec_mux/typec_switch support
phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge drm/rockchip: cdn-dp: Support handle lane info without extcon drm/rockchip: cdn-dp: Add multiple bridges to support PHY port
selection
arm64: dts: rockchip: Add missing dp_out port for RK3399 CDN-DP
arm64: dts: rockchip: rk3399-evb-ind: Add support for DisplayPort
Heikki Krogerus (1):
usb: typec: Set the bus also for the port and plug altmodes
.../phy/rockchip,rk3399-typec-phy.yaml | 6 + arch/arm64/boot/dts/rockchip/rk3399-base.dtsi | 10 +- .../boot/dts/rockchip/rk3399-evb-ind.dts | 147 +++++++ drivers/gpu/drm/bridge/Kconfig | 10 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/aux-bridge.c | 24 +- .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 51 +++ drivers/gpu/drm/rockchip/Kconfig | 1 + drivers/gpu/drm/rockchip/cdn-dp-core.c | 350 +++++++++++++--- drivers/gpu/drm/rockchip/cdn-dp-core.h | 18 +- drivers/phy/rockchip/Kconfig | 3 + drivers/phy/rockchip/phy-rockchip-typec.c | 373 +++++++++++++++++- drivers/usb/typec/bus.c | 25 +- drivers/usb/typec/bus.h | 6 - drivers/usb/typec/class.c | 36 +- include/drm/bridge/aux-bridge.h | 6 + include/linux/usb/typec.h | 3 + include/linux/usb/typec_altmode.h | 8 + 18 files changed, 976 insertions(+), 102 deletions(-) create mode 100644 drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c
Signature · 1 line
2.51.1
PATCH v11 1/11 usb: typec: Set the bus also for the port and plug altmodes
From: Heikki Krogerus <[email protected]>
The port and plug altmodes can't be bound to the altmode drivers because the altmode drivers are meant for partner communication using the VDM (vendor defined messages), but they can still be part of the bus. The bus will make sure that the normal bus notifications are available also with the port altmodes.
The previously used common device type for all alternate modes is replaced with separate dedicated device types for port, plug, and partner alternate modes.
--- drivers/usb/typec/bus.c | 24 +++++++++++++++++++++++- drivers/usb/typec/bus.h | 8 ++++++-- drivers/usb/typec/class.c | 33 ++++++++++++++++++++++----------- 3 files changed, 51 insertions(+), 14 deletions(-)
drivers/usb/typec/bus.c +23 -1
@@ -445,7 +445,23 @@ static struct attribute *typec_attrs[] = { &dev_attr_description.attr, NULL }; -ATTRIBUTE_GROUPS (typec); + +static umode_t typec_is_visible (struct kobject *kobj,struct attribute *attr,int n) +{ +if (is_typec_partner_altmode (kobj_to_dev (kobj))) +return attr->mode; +return 0 ; +} + +static const struct attribute_group typec_group = { + .is_visible = typec_is_visible, + .attrs = typec_attrs, +}; + +static const struct attribute_group *typec_groups[] = { + &typec_group, +NULL +};static int typec_match (struct device *dev,const struct device_driver *driver) {
@@ -453,6 +469,9 @@ static int typec_match(struct device *dev, const struct device_driver *driver)struct typec_altmode *altmode =to_typec_altmode (dev);const struct typec_device_id *id; +if (!is_typec_partner_altmode (dev)) +return 0 ; +for (id = drv->id_table; id->svid; id++)if (id->svid == altmode->svid)return 1 ;
@@ -463,6 +482,9 @@ static int typec_uevent(const struct device *dev, struct kobj_uevent_env *env) {const struct typec_altmode *altmode =to_typec_altmode (dev); +if (!is_typec_partner_altmode (dev)) +return 0 ; +if (add_uevent_var (env,"SVID=%04X" , altmode->svid))return -ENOMEM ;
drivers/usb/typec/bus.h +6 -2
@@ -29,8 +29,12 @@ struct altmode {#define to_altmode (d) container_of(d, struct altmode, adev)extern const struct bus_type typec_bus; -extern const struct device_type typec_altmode_dev_type; +extern const struct device_type typec_port_altmode_dev_type; +extern const struct device_type typec_plug_altmode_dev_type; +extern const struct device_type typec_partner_altmode_dev_type; -#define is_typec_altmode (_dev_) (_dev_->type == &typec_altmode_dev_type) +#define is_typec_port_altmode (dev) ((dev)->type == &typec_port_altmode_dev_type) +#define is_typec_plug_altmode (dev) ((dev)->type == &typec_plug_altmode_dev_type) +#define is_typec_partner_altmode (dev) ((dev)->type == &typec_partner_altmode_dev_type)#endif /* __USB_TYPEC_ALTMODE_H__ */
drivers/usb/typec/class.c +22 -11
@@ -235,7 +235,7 @@ static int altmode_match(struct device *dev, const void *data)struct typec_altmode *adev =to_typec_altmode (dev);const struct typec_device_id *id = data; -if (!is_typec_altmode (dev)) +if (!is_typec_port_altmode (dev))return 0 ;return (adev->svid == id->svid);
@@ -532,15 +532,28 @@ static void typec_altmode_release(struct device *dev)kfree (alt); } -const struct device_type typec_altmode_dev_type = { - .name ="typec_alternate_mode" , +const struct device_type typec_port_altmode_dev_type = { + .name ="typec_port_alternate_mode" , + .groups = typec_altmode_groups, + .release = typec_altmode_release, +}; + +const struct device_type typec_plug_altmode_dev_type = { + .name ="typec_plug_alternate_mode" , + .groups = typec_altmode_groups, + .release = typec_altmode_release, +}; + +const struct device_type typec_partner_altmode_dev_type = { + .name ="typec_partner_alternate_mode" , .groups = typec_altmode_groups, .release = typec_altmode_release, };static struct typec_altmode *typec_register_altmode (struct device *parent, -const struct typec_altmode_desc *desc) +const struct typec_altmode_desc *desc, +const struct device_type *type) {unsigned int id =altmode_id_get (parent);bool is_port =is_typec_port (parent);
@@ -575,7 +588,7 @@ typec_register_altmode(struct device *parent, alt->adev.dev.parent = parent; alt->adev.dev.groups = alt->groups; - alt->adev.dev.type = &typec_altmode_dev_type; + alt->adev.dev.type = type;dev_set_name (&alt->adev.dev,"%s.%u" ,dev_name (parent), id);get_device (alt->adev.dev.parent);
@@ -584,9 +597,7 @@ typec_register_altmode(struct device *parent,if (!is_port)typec_altmode_set_partner (alt); -/* The partners are bind to drivers */ -if (is_typec_partner (parent)) - alt->adev.dev.bus = &typec_bus; + alt->adev.dev.bus = &typec_bus;/* Plug alt modes need a class to generate udev events. */ if (is_typec_plug (parent))
@@ -963,7 +974,7 @@ struct typec_altmode * typec_partner_register_altmode(struct typec_partner *partner, const struct typec_altmode_desc *desc) { - return typec_register_altmode(&partner->dev, desc); + return typec_register_altmode(&partner->dev, desc, &typec_partner_altmode_dev_type); }EXPORT_SYMBOL_GPL (typec_partner_register_altmode);
@@ -1193,7 +1204,7 @@ struct typec_altmode * typec_plug_register_altmode(struct typec_plug *plug, const struct typec_altmode_desc *desc) { - return typec_register_altmode(&plug->dev, desc); + return typec_register_altmode(&plug->dev, desc, &typec_plug_altmode_dev_type); }EXPORT_SYMBOL_GPL (typec_plug_register_altmode);
@@ -2493,7 +2504,7 @@ typec_port_register_altmode(struct typec_port *port,return ERR_CAST (retimer); } - adev =typec_register_altmode (&port->dev, desc); + adev =typec_register_altmode (&port->dev, desc, &typec_port_altmode_dev_type);if (IS_ERR (adev)) {typec_retimer_put (retimer);typec_mux_put (mux);
Signature · 1 line
2.51.1
Greg Kroah-Hartman
maintainerRe: [PATCH v11 01/11] usb: typec: Set the bus also for the port and plug altmodes
Quoted 9 lines · Chaoyi Chen
From: Heikki Krogerus <[email protected]>
The port and plug altmodes can't be bound to the altmode drivers because the altmode drivers are meant for partner communication using the VDM (vendor defined messages), but they can still be part of the bus. The bus will make sure that the normal bus notifications are available also with the port altmodes.
Quoted 6 lines
The previously used common device type for all alternate modes is replaced with separate dedicated device types for port, plug, and partner alternate modes.
Signed-off-by Heikki Krogerus <[email protected]>---
You forgot to sign off on this :(
Re: [PATCH v11 01/11] usb: typec: Set the bus also for the port and plug altmodes
Quoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Chaoyi Chen
From: Heikki Krogerus <[email protected]>
The port and plug altmodes can't be bound to the altmode drivers because the altmode drivers are meant for partner communication using the VDM (vendor defined messages), but they can still be part of the bus. The bus will make sure that the normal bus notifications are available also with the port altmodes.
Quoted 9 lines
Quoted 6 lines
The previously used common device type for all alternate modes is replaced with separate dedicated device types for port, plug, and partner alternate modes.
Signed-off-by Heikki Krogerus <[email protected]>---
You forgot to sign off on this :(
Sorry for that. If there are no further problem on this series, I will resend it.
Signature · 2 lines
Best, Chaoyi
PATCH v11 2/11 usb: typec: Export typec bus and typec altmode device type
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The DRM may want to register a notifier on the typec bus to know when a typec altmode device is added, and distinguish between different types of typec altmode device.
Export these things.
---
Changes in v11:
- Also export typec bus.
- Add more detailed comments.
(no changes since v9)
drivers/usb/typec/bus.c | 1 + drivers/usb/typec/bus.h | 10 ---------- drivers/usb/typec/class.c | 3 +++ include/linux/usb/typec.h | 3 +++ include/linux/usb/typec_altmode.h | 8 ++++++++ 5 files changed, 15 insertions(+), 10 deletions(-)
drivers/usb/typec/bus.c +1 -0
@@ -569,3 +569,4 @@ const struct bus_type typec_bus = { .probe = typec_probe, .remove = typec_remove, }; +EXPORT_SYMBOL_GPL (typec_bus);
drivers/usb/typec/bus.h +0 -10
@@ -5,7 +5,6 @@#include <linux/usb/typec_altmode.h> -struct bus_type ;struct typec_mux ;struct typec_retimer ;
@@ -28,13 +27,4 @@ struct altmode {#define to_altmode (d) container_of(d, struct altmode, adev) -extern const struct bus_type typec_bus; -extern const struct device_type typec_port_altmode_dev_type; -extern const struct device_type typec_plug_altmode_dev_type; -extern const struct device_type typec_partner_altmode_dev_type; - -#define is_typec_port_altmode (dev) ((dev)->type == &typec_port_altmode_dev_type) -#define is_typec_plug_altmode (dev) ((dev)->type == &typec_plug_altmode_dev_type) -#define is_typec_partner_altmode (dev) ((dev)->type == &typec_partner_altmode_dev_type) -#endif /* __USB_TYPEC_ALTMODE_H__ */
drivers/usb/typec/class.c +3 -0
@@ -537,18 +537,21 @@ const struct device_type typec_port_altmode_dev_type = { .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL (typec_port_altmode_dev_type);const struct device_type typec_plug_altmode_dev_type = { .name ="typec_plug_alternate_mode" , .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL (typec_plug_altmode_dev_type);const struct device_type typec_partner_altmode_dev_type = { .name ="typec_partner_alternate_mode" , .groups = typec_altmode_groups, .release = typec_altmode_release, }; +EXPORT_SYMBOL_GPL (typec_partner_altmode_dev_type);static struct typec_altmode * typec_register_altmode(struct device *parent,
include/linux/usb/typec.h +3 -0
@@ -20,12 +20,15 @@ struct typec_port;struct typec_altmode_ops ;struct typec_cable_ops ; +struct bus_type ;struct fwnode_handle ;struct device ;struct usb_power_delivery ;struct usb_power_delivery_desc ; +extern const struct bus_type typec_bus; +enum typec_port_type {TYPEC_PORT_SRC ,TYPEC_PORT_SNK ,
include/linux/usb/typec_altmode.h +8 -0
@@ -9,6 +9,14 @@#define MODE_DISCOVERY_MAX 6 +extern const struct device_type typec_port_altmode_dev_type; +extern const struct device_type typec_plug_altmode_dev_type; +extern const struct device_type typec_partner_altmode_dev_type; + +#define is_typec_port_altmode (dev) ((dev)->type == &typec_port_altmode_dev_type) +#define is_typec_plug_altmode (dev) ((dev)->type == &typec_plug_altmode_dev_type) +#define is_typec_partner_altmode (dev) ((dev)->type == &typec_partner_altmode_dev_type) +struct typec_altmode_ops ;/**
Signature · 1 line
2.51.1
PATCH v11 3/11 drm/bridge: Implement generic USB Type-C DP HPD bridge
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The HPD function of Type-C DP is implemented through drm_connector_oob_hotplug_event(). For embedded DP, it is required that the DRM connector fwnode corresponds to the Type-C port fwnode.
To describe the relationship between the DP controller and the Type-C port device, we usually using drm_bridge to build a bridge chain.
Now several USB-C controller drivers have already implemented the DP HPD bridge function provided by aux-hpd-bridge.c, it will build a DP HPD bridge on USB-C connector port device.
But this requires the USB-C controller driver to manually register the HPD bridge. If the driver does not implement this feature, the bridge will not be create.
So this patch implements a generic DP HPD bridge based on aux-hpd-bridge.c. It will monitor Type-C bus events, and when a Type-C port device containing the DP svid is registered, it will create an HPD bridge for it without the need for the USB-C controller driver to implement it.
---
Changes in v11:
- Switch to using typec bus notifiers.
(no changes since v10)
Changes in v9:
- Remove the exposed DRM_AUX_HPD_BRIDGE option, and select DRM_AUX_HPD_TYPEC_BRIDGE when it is available.
- Add more commit comment about problem background.
Changes in v8:
- Merge generic DP HPD bridge into one module.
drivers/gpu/drm/bridge/Kconfig | 10 ++++ drivers/gpu/drm/bridge/Makefile | 1 + .../gpu/drm/bridge/aux-hpd-typec-dp-bridge.c | 51 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c
drivers/gpu/drm/bridge/Kconfig +10 -0
@@ -30,6 +30,16 @@ config DRM_AUX_HPD_BRIDGE Simple bridge that terminates the bridge chain and provides HPD support. +if DRM_AUX_HPD_BRIDGE +config DRM_AUX_HPD_TYPEC_BRIDGE + tristate + depends on TYPEC || !TYPEC + default TYPEC + help + Simple bridge that terminates the bridge chain and provides HPD + support. It build bridge on each USB-C connector device node. +endif + menu "Display Interface Bridges" depends on DRM && DRM_BRIDGE
drivers/gpu/drm/bridge/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_AUX_BRIDGE) += aux-bridge.o obj-$(CONFIG_DRM_AUX_HPD_BRIDGE) += aux-hpd-bridge.o +obj-$(CONFIG_DRM_AUX_HPD_TYPEC_BRIDGE) += aux-hpd-typec-dp-bridge.o obj-$(CONFIG_DRM_CHIPONE_ICN6211) += chipone-icn6211.o obj-$(CONFIG_DRM_CHRONTEL_CH7033) += chrontel-ch7033.o obj-$(CONFIG_DRM_CROS_EC_ANX7688) += cros-ec-anx7688.o
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.51.1
Heikki Krogerus
maintainerRe: [PATCH v11 03/11] drm/bridge: Implement generic USB Type-C DP HPD bridge
Hi,
Fri, Nov 28, 2025 at 10:03:57AM +0800, Chaoyi Chen kirjoitti:
Quoted 14 lines
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file +8
-0@@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include <linux/of.h> +#include <linux/usb/typec_altmode.h> +#include <linux/usb/typec_dp.h> + +#include <drm/bridge/aux-bridge.h> + +static int drm_typec_bus_event(struct notifier_block *nb,
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c line 18
Quoted 10 lines
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file +10
-0+ unsigned long action, void *data) +{ + struct device *dev = (struct device *)data; +struct typec_altmode *alt =to_typec_altmode (dev); + +if (action !=BUS_NOTIFY_ADD_DEVICE ) + goto done; + +if (is_typec_partner_altmode (&alt->dev) || alt->svid !=USB_TYPEC_DP_SID ) + goto done;
There are also plug altmodes. Just make sure it's a plug altmode.
if (!is_typec_plug_altmode(&alt->dev) || alt->svid != USB_TYPEC_DP_SID)
goto done;Quoted 22 lines
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file +22
-0+/* +* alt->dev.parent->parent : USB-C controller device +* alt->dev.parent : USB-C connector device +*/ +drm_dp_hpd_bridge_register (alt->dev.parent->parent, +to_of_node (alt->dev.parent->fwnode)); + +done: +return NOTIFY_OK ; +} + +static struct notifier_block drm_typec_event_nb = { + .notifier_call = drm_typec_bus_event, +}; + +static void drm_aux_hpd_typec_dp_bridge_module_exit (void ) +{ +bus_unregister_notifier (&typec_bus, &drm_typec_event_nb); +} + +static int __init drm_aux_hpd_typec_dp_bridge_module_init (void ) +{
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c line 51
Quoted 10 lines
drivers/gpu/drm/bridge/aux-hpd-typec-dp-bridge.c new file +10
-0+bus_register_notifier (&typec_bus, &drm_typec_event_nb); + +return 0 ; +} + +module_init (drm_aux_hpd_typec_dp_bridge_module_init); +module_exit (drm_aux_hpd_typec_dp_bridge_module_exit); + +MODULE_DESCRIPTION ("DRM TYPEC DP HPD BRIDGE" ); +MODULE_LICENSE ("GPL" );
thanks,
Signature · 1 line
heikki
PATCH v11 4/11 drm/bridge: aux: Add drm_aux_bridge_register_from_node()
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The drm_aux_bridge_register() uses the device->of_node as the bridge->of_node.
This patch adds drm_aux_bridge_register_from_node() to allow specifying the of_node corresponding to the bridge.
---
(no changes since v11)
drivers/gpu/drm/bridge/aux-bridge.c | 24 ++++++++++++++++++++++-- include/drm/bridge/aux-bridge.h | 6 ++++++ 2 files changed, 28 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/aux-bridge.c +22 -2
@@ -35,6 +35,7 @@ static void drm_aux_bridge_unregister_adev(void *_adev)/** * drm_aux_bridge_register - Create a simple bridge device to link the chain * @parent: device instance providing this bridge +* @np: device node pointer corresponding to this bridge instance * * Creates a simple DRM bridge that doesn't implement any drm_bridge * operations. Such bridges merely fill a place in the bridge chain linking
@@ -42,7 +43,7 @@ static void drm_aux_bridge_unregister_adev(void *_adev)* * Return: zero on success, negative error code on failure */ -int drm_aux_bridge_register (struct device *parent) +int drm_aux_bridge_register_from_node (struct device *parent,struct device_node *np) {struct auxiliary_device *adev;int ret;
@@ -62,7 +63,10 @@ int drm_aux_bridge_register(struct device *parent) adev->dev.parent = parent; adev->dev.release = drm_aux_bridge_release; -device_set_of_node_from_dev (&adev->dev, parent); +if (np) +device_set_node (&adev->dev,of_fwnode_handle (np)); +else +device_set_of_node_from_dev (&adev->dev, parent); ret =auxiliary_device_init (adev);if (ret) {
@@ -80,6 +84,22 @@ int drm_aux_bridge_register(struct device *parent)return devm_add_action_or_reset (parent, drm_aux_bridge_unregister_adev, adev); } +EXPORT_SYMBOL_GPL (drm_aux_bridge_register_from_node); + +/** +* drm_aux_bridge_register - Create a simple bridge device to link the chain +* @parent: device instance providing this bridge +* +* Creates a simple DRM bridge that doesn't implement any drm_bridge +* operations. Such bridges merely fill a place in the bridge chain linking +* surrounding DRM bridges. +* +* Return: zero on success, negative error code on failure +*/ +int drm_aux_bridge_register (struct device *parent) +{ +return drm_aux_bridge_register_from_node (parent,NULL ); +}EXPORT_SYMBOL_GPL (drm_aux_bridge_register);struct drm_aux_bridge_data {
include/drm/bridge/aux-bridge.h +6 -0
@@ -13,11 +13,17 @@ struct auxiliary_device;#if IS_ENABLED (CONFIG_DRM_AUX_BRIDGE )int drm_aux_bridge_register (struct device *parent); +int drm_aux_bridge_register_from_node (struct device *parent,struct device_node *np);#else static inline int drm_aux_bridge_register (struct device *parent) {return 0 ; } + +static inline int drm_aux_bridge_register_from_node (struct device *parent,struct device_node *np) +{ +return 0 ; +}#endif #if IS_ENABLED (CONFIG_DRM_AUX_HPD_BRIDGE )
Signature · 1 line
2.51.1
PATCH v11 5/11 dt-bindings: phy: rockchip: rk3399-typec-phy: Support mode-switch
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The RK3399 SoC integrates two USB/DP combo PHYs, each of which supports software-configurable pin mapping and DisplayPort lane assignment. These capabilities enable the PHY itself to handle both mode switching and orientation switching, based on the Type-C plug orientation and USB PD negotiation results.
While an external Type-C controller is still required to detect cable attachment and report USB PD events, the actual mode and orientation switching is performed internally by the PHY through software configuration. This allows the PHY to act as a Type-C multiplexer for both data role and DP altmode configuration.
To reflect this hardware design, this patch introduces a new "mode-switch" property for the dp-port node in the device tree bindings. This property indicates that the connected PHY is capable of handling Type-C mode switching itself.
---
(no changes since v5)
Changes in v4:
- Remove "|" in description.
Changes in v3:
- Add more descriptions to clarify the role of the PHY in switching.
Changes in v2:
- Reuse dp-port/usb3-port in rk3399-typec-phy binding.
.../devicetree/bindings/phy/rockchip,rk3399-typec-phy.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/phy/rockchip,rk3399-typec-phy.yaml +6 -0
@@ -51,6 +51,12 @@ properties: '#phy-cells': const: 0 + mode-switch: + description: + Indicates the PHY can handle altmode switching. In this case, + requires an external USB Type-C controller to report USB PD message. + type: boolean + port: $ref: /schemas/graph.yaml#/properties/port description: Connection to USB Type-C connector
Signature · 1 line
2.51.1
Rob Herring (Arm)
maintainerRe: [PATCH v11 05/11] dt-bindings: phy: rockchip: rk3399-typec-phy: Support mode-switch
Quoted 28 lines · Chaoyi Chen
From: Chaoyi Chen <[email protected]>
The RK3399 SoC integrates two USB/DP combo PHYs, each of which supports software-configurable pin mapping and DisplayPort lane assignment. These capabilities enable the PHY itself to handle both mode switching and orientation switching, based on the Type-C plug orientation and USB PD negotiation results.
While an external Type-C controller is still required to detect cable attachment and report USB PD events, the actual mode and orientation switching is performed internally by the PHY through software configuration. This allows the PHY to act as a Type-C multiplexer for both data role and DP altmode configuration.
To reflect this hardware design, this patch introduces a new "mode-switch" property for the dp-port node in the device tree bindings. This property indicates that the connected PHY is capable of handling Type-C mode switching itself.
Signed-off-by Chaoyi Chen <[email protected]>---
(no changes since v5)
Changes in v4:
- Remove "|" in description.
Quoted 9 lines
Changes in v3:
- Add more descriptions to clarify the role of the PHY in switching.Changes in v2:
- Reuse dp-port/usb3-port in rk3399-typec-phy binding..../devicetree/bindings/phy/rockchip,rk3399-typec-phy.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/slimbus/slimbus.example.dtb: slim@28080000 (qcom,slim-ngd-v1.5.0): 'audio-codec@1,0' does not match any of the regexes: '^pinctrl-[0-9]+$', '^slim@[0-9a-f]+$'
from schema $id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/slimbus/slimbus.example.dtb: slim@28080000 (qcom,slim-ngd-v1.5.0): #address-cells: 1 was expected
from schema $id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/slimbus/slimbus.example.dtb: slim@28080000 (qcom,slim-ngd-v1.5.0): 'dmas' is a required property
from schema $id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/slimbus/slimbus.example.dtb: slim@28080000 (qcom,slim-ngd-v1.5.0): 'dma-names' is a required property
from schema $id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yamlDocumentation/devicetree/bindings/thermal/thermal-sensor.example.dtb: /example-0/soc/thermal-sensor@c263000: failed to match any schema with compatible: ['qcom,sdm845-tsens', 'qcom,tsens-v2'] Documentation/devicetree/bindings/thermal/thermal-sensor.example.dtb: /example-0/soc/thermal-sensor@c263000: failed to match any schema with compatible: ['qcom,sdm845-tsens', 'qcom,tsens-v2'] Documentation/devicetree/bindings/thermal/thermal-sensor.example.dtb: /example-0/soc/thermal-sensor@c265000: failed to match any schema with compatible: ['qcom,sdm845-tsens', 'qcom,tsens-v2'] Documentation/devicetree/bindings/thermal/thermal-sensor.example.dtb: /example-0/soc/thermal-sensor@c265000: failed to match any schema with compatible: ['qcom,sdm845-tsens', 'qcom,tsens-v2']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
PATCH v11 6/11 phy: rockchip: phy-rockchip-typec: Add typec_mux/typec_switch support
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
This patch add support for Type-C Port Controller Manager. Each PHY will register typec_mux and typec_switch when external Type-C controller is present. Type-C events are handled by TCPM without extcon.
The extcon device should still be supported.
---
(no changes since v7)
Changes in v6:
- Fix depend in Kconfig.
- Check DP svid in tcphy_typec_mux_set().
- Remove mode setting in tcphy_orien_sw_set().
(no changes since v5)
Changes in v4:
- Remove notify DP HPD state by USB/DP PHY.
(no changes since v3)
Changes in v2:
- Fix compile error when CONFIG_TYPEC is not enabled.
- Notify DP HPD state by USB/DP PHY.
drivers/phy/rockchip/Kconfig | 1 + drivers/phy/rockchip/phy-rockchip-typec.c | 368 +++++++++++++++++++++- 2 files changed, 353 insertions(+), 16 deletions(-)
drivers/phy/rockchip/Kconfig +1 -0
@@ -119,6 +119,7 @@ config PHY_ROCKCHIP_SNPS_PCIE3 config PHY_ROCKCHIP_TYPEC tristate "Rockchip TYPEC PHY Driver" depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST) + depends on TYPEC || TYPEC=n select EXTCON select GENERIC_PHY select RESET_CONTROLLER
drivers/phy/rockchip/phy-rockchip-typec.c +352 -16
507 lines not on this page · raw message
Signature · 1 line
2.51.1
PATCH v11 7/11 phy: rockchip: phy-rockchip-typec: Add DRM AUX bridge
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
Using the DRM_AUX_BRIDGE helper to create the transparent DRM bridge device.
---
(no changes since v11)
Changes in v10:
- Use drm_aux_bridge_register_from_node() instead.
(no changes since v7)
Changes in v6:
- Fix depend in Kconfig.
drivers/phy/rockchip/Kconfig | 2 ++ drivers/phy/rockchip/phy-rockchip-typec.c | 5 +++++ 2 files changed, 7 insertions(+)
drivers/phy/rockchip/Kconfig +2 -0
@@ -120,6 +120,8 @@ config PHY_ROCKCHIP_TYPEC tristate "Rockchip TYPEC PHY Driver" depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST) depends on TYPEC || TYPEC=n + depends on DRM || DRM=n + select DRM_AUX_BRIDGE if DRM_BRIDGE select EXTCON select GENERIC_PHY select RESET_CONTROLLER
drivers/phy/rockchip/phy-rockchip-typec.c +5 -0
@@ -56,6 +56,7 @@#include <linux/phy/phy.h> #include <linux/usb/typec_dp.h> #include <linux/usb/typec_mux.h> +#include <drm/bridge/aux-bridge.h> #define CMN_SSM_BANDGAP (0x21 << 2)#define CMN_SSM_BIAS (0x22 << 2)
@@ -1312,6 +1313,10 @@ static int tcphy_setup_typec_mux(struct rockchip_typec_phy *tcphy)if (!of_property_read_bool (np,"mode-switch" )) goto put_np; + ret =drm_aux_bridge_register_from_node (tcphy->dev, np); +if (ret) + goto put_np; + mux_desc.drvdata = tcphy; mux_desc.fwnode =device_get_named_child_node (tcphy->dev,"dp-port" ); mux_desc.set = tcphy_typec_mux_set;
Signature · 1 line
2.51.1
PATCH v11 8/11 drm/rockchip: cdn-dp: Support handle lane info without extcon
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
This patch add support for get PHY lane info without help of extcon.
There is no extcon needed if the Type-C controller is present. In this case, the lane info can be get from PHY instead of extcon.
The extcon device should still be supported if Type-C controller is not present.
---
(no changes since v5)
Changes in v4:
- Remove cdn_dp_hpd_notify().
(no changes since v3)
Changes in v2:
- Ignore duplicate HPD events.
drivers/gpu/drm/rockchip/cdn-dp-core.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
drivers/gpu/drm/rockchip/cdn-dp-core.c +17 -8
@@ -156,6 +156,9 @@ static int cdn_dp_get_port_lanes(struct cdn_dp_port *port)int dptx;u8 lanes; +if (!edev) +return phy_get_bus_width (port->phy); + dptx =extcon_get_state (edev,EXTCON_DISP_DP );if (dptx >0 ) { extcon_get_property(edev, EXTCON_DISP_DP,
@@ -219,7 +222,7 @@ static bool cdn_dp_check_sink_connection(struct cdn_dp_device *dp)* some docks need more time to power up. */ while (time_before (jiffies, timeout)) { -if (!extcon_get_state (port->extcon,EXTCON_DISP_DP )) +if (port->extcon && !extcon_get_state (port->extcon,EXTCON_DISP_DP ))return false;if (!cdn_dp_get_sink_count (dp, &sink_count))
@@ -385,11 +388,14 @@ static int cdn_dp_enable_phy(struct cdn_dp_device *dp, struct cdn_dp_port *port) goto err_power_on; } - ret =extcon_get_property (port->extcon,EXTCON_DISP_DP , -EXTCON_PROP_USB_TYPEC_POLARITY , &property); -if (ret) { -DRM_DEV_ERROR (dp->dev,"get property failed\n" ); - goto err_power_on; + property.intval =0 ; +if (port->extcon) { + ret =extcon_get_property (port->extcon,EXTCON_DISP_DP , +EXTCON_PROP_USB_TYPEC_POLARITY , &property); +if (ret) { +DRM_DEV_ERROR (dp->dev,"get property failed\n" ); + goto err_power_on; + } } port->lanes =cdn_dp_get_port_lanes (port);
@@ -1028,6 +1034,9 @@ static int cdn_dp_bind(struct device *dev, struct device *master, void *data)for (i =0 ; i < dp->ports; i++) { port = dp->port[i]; +if (!port->extcon) +continue ; + port->event_nb.notifier_call = cdn_dp_pd_event; ret = devm_extcon_register_notifier(dp->dev, port->extcon, EXTCON_DISP_DP,
@@ -1120,14 +1129,14 @@ static int cdn_dp_probe(struct platform_device *pdev) PTR_ERR(phy) == -EPROBE_DEFER)return -EPROBE_DEFER ; -if (IS_ERR (extcon) ||IS_ERR (phy)) +if (IS_ERR (phy) ||PTR_ERR (extcon) != -ENODEV )continue ; port =devm_kzalloc (dev,sizeof (*port),GFP_KERNEL );if (!port)return -ENOMEM ; - port->extcon = extcon; + port->extcon =IS_ERR (extcon) ?NULL : extcon; port->phy = phy; port->dp = dp; port->id = i;
Signature · 1 line
2.51.1
PATCH v11 9/11 drm/rockchip: cdn-dp: Add multiple bridges to support PHY port selection
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The RK3399 has two USB/DP combo PHY and one CDN-DP controller. And the CDN-DP can be switched to output to one of the PHYs. If both ports are plugged into DP, DP will select the first port for output.
This patch adds support for multiple bridges, enabling users to flexibly select the output port. For each PHY port, a separate encoder and bridge are registered.
The change is based on the DRM AUX HPD bridge, rather than the extcon approach. This requires the DT to correctly describe the connections between the first bridge in bridge chain and DP controller. For example, the bridge chain may be like this:
PHY aux birdge -> fsa4480 analog audio switch bridge -> onnn,nb7vpq904m USB reminder bridge -> USB-C controller AUX HPD bridge
In this case, the connection relationships among the PHY aux bridge and the DP contorller need to be described in DT.
In addition, the cdn_dp_parse_next_bridge_dt() will parses it and determines whether to register one or two bridges.
Since there is only one DP controller, only one of the PHY ports can output at a time. The key is how to switch between different PHYs, which is handled by cdn_dp_switch_port() and cdn_dp_enable().
There are two cases:
1. Neither bridge is enabled. In this case, both bridges can independently read the EDID, and the PHY port may switch before reading the EDID.
2. One bridge is already enabled. In this case, other bridges are not allowed to read the EDID. So we will try to return the cached EDID.
Since the scenario of two ports plug in at the same time is rare, I don't have a board which support two TypeC connector to test this. Therefore, I tested forced switching on a single PHY port, as well as output using a fake PHY port alongside a real PHY port.
---
(no changes since v11)
Changes in v10:
- Fix refcount usage of drm_bridge.
- Remove unused cdn_dp_next_bridge type.
Changes in v9:
- Select DRM_AUX_HPD_BRIDGE when using DP driver.
(no changes since v7)
Changes in v6:
- Rename some variable names.
- Attach the DP bridge to the next bridge.
Changes in v5:
- By parsing the HPD bridge chain, set the connector's of_node to the of_node corresponding to the USB-C connector.
- Return EDID cache when other port is already enabled.
drivers/gpu/drm/rockchip/Kconfig | 1 + drivers/gpu/drm/rockchip/cdn-dp-core.c | 325 ++++++++++++++++++++----- drivers/gpu/drm/rockchip/cdn-dp-core.h | 18 +- 3 files changed, 287 insertions(+), 57 deletions(-)
drivers/gpu/drm/rockchip/Kconfig +1 -0
@@ -56,6 +56,7 @@ config ROCKCHIP_CDN_DP select DRM_DISPLAY_HELPER select DRM_BRIDGE_CONNECTOR select DRM_DISPLAY_DP_HELPER + select DRM_AUX_HPD_BRIDGE help This selects support for Rockchip SoC specific extensions for the cdn DP driver. If you want to enable Dp on
drivers/gpu/drm/rockchip/cdn-dp-core.c +270 -55
474 lines not on this page · raw message
drivers/gpu/drm/rockchip/cdn-dp-core.h +16 -2
@@ -38,6 +38,8 @@ enum vic_pxl_encoding_format { Y_ONLY = 0x10, }; +struct cdn_dp_device ; +struct video_info {bool h_sync_polarity;bool v_sync_polarity;
@@ -63,16 +65,28 @@ struct cdn_dp_port {u8 id; }; +struct cdn_dp_bridge { +struct cdn_dp_device *parent; +struct drm_bridge bridge; +struct rockchip_encoder encoder; +bool connected; +bool enabled; +int id; +}; +struct cdn_dp_device {struct device *dev;struct drm_device *drm_dev; -struct drm_bridge bridge; -struct rockchip_encoder encoder; +int bridge_count; +struct cdn_dp_bridge *bridge_list[MAX_PHY ]; +struct drm_bridge *next_bridge_list[MAX_PHY ]; +const struct drm_edid *edid_cache[MAX_PHY ];struct drm_display_mode mode;struct platform_device *audio_pdev;struct work_struct event_work;struct mutex lock; +bool next_bridge_valid;bool connected;bool active;bool suspended;
Signature · 1 line
2.51.1
PATCH v11 10/11 arm64: dts: rockchip: Add missing dp_out port for RK3399 CDN-DP
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
Let's make the ports nodes of cdn_dp in the same style as the other display interface, and match the style of ports's yaml.
---
(no changes since v5)
Changes in v4:
- Remove unnecessary #address/#size-cells
(no changes since v1)
arch/arm64/boot/dts/rockchip/rk3399-base.dtsi | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-base.dtsi +9 -1
@@ -618,7 +618,11 @@ cdn_dp: dp@fec00000 { status = "disabled"; ports { - dp_in: port { + #address-cells = <1>; + #size-cells = <0>; + + dp_in: port@0 { + reg = <0>; #address-cells = <1>; #size-cells = <0>;
@@ -632,6 +636,10 @@ dp_in_vopl: endpoint@1 { remote-endpoint = <&vopl_out_dp>; }; }; + + dp_out: port@1 { + reg = <1>; + }; }; };
Signature · 1 line
2.51.1
PATCH v11 11/11 arm64: dts: rockchip: rk3399-evb-ind: Add support for DisplayPort
In reply to Chaoyi ChenFrom: Chaoyi Chen <[email protected]>
The RK3399 EVB IND board has a Type-C interface DisplayPort. It use fusb302 chip as Type-C controller.
fusb302 chip ---> USB/DP PHY0 <----> CDN-DP controller
---
(no changes since v10)
Changes in v9:
- Add usb role switch for Type-C.
- Remove USB2 PHY in Type-C connection.
(no changes since v4)
Changes in v3:
- Fix wrong vdo value.
- Fix port node in usb-c-connector.
Changes in v2:
- Add endpoint to link DP PHY and DP controller.
- Fix devicetree coding style.
.../boot/dts/rockchip/rk3399-evb-ind.dts | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-evb-ind.dts +147 -0
@@ -4,6 +4,7 @@ */ /dts-v1/; +#include <dt-bindings/usb/pd.h> #include "rk3399.dtsi" / {
@@ -19,6 +20,21 @@ chosen { stdout-path = "serial2:1500000n8"; }; + sound: sound { + compatible = "rockchip,rk3399-gru-sound"; + rockchip,cpu = <&i2s0 &spdif>; + }; + + vbus_typec: regulator-vbus-typec { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_typec0_en>; + regulator-name = "vbus_typec"; + vin-supply = <&vcc5v0_sys>; + }; + vcc5v0_sys: regulator-vcc5v0-sys { compatible = "regulator-fixed"; enable-active-high;
@@ -31,6 +47,11 @@ vcc5v0_sys: regulator-vcc5v0-sys { }; }; +&cdn_dp { + phys = <&tcphy0_dp>; + status = "okay"; +}; + &cpu_b0 { cpu-supply = <&vdd_cpu_b>; };
@@ -55,6 +76,12 @@ &cpu_l3 { cpu-supply = <&vdd_cpu_l>; }; +&dp_out { + dp_controller_output: endpoint { + remote-endpoint = <&dp_phy_in>; + }; +}; + &emmc_phy { status = "okay"; };
@@ -341,6 +368,71 @@ regulator-state-mem { }; }; +&i2c4 { + i2c-scl-rising-time-ns = <475>; + i2c-scl-falling-time-ns = <26>; + status = "okay"; + + usbc0: typec-portc@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = <RK_PA2 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus_typec>; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + try-power-role = "sink"; + op-sink-microwatt = <1000000>; + sink-pdos = + <PDO_FIXED(5000, 2500, PDO_FIXED_USB_COMM)>; + source-pdos = + <PDO_FIXED(5000, 1500, PDO_FIXED_USB_COMM)>; + + altmodes { + displayport { + svid = /bits/ 16 <0xff01>; + vdo = <0x00001c46>; + }; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + usbc0_orien_sw: endpoint { + remote-endpoint = <&tcphy0_orientation_switch>; + }; + }; + + port@1 { + reg = <1>; + + usbc0_role_sw: endpoint { + remote-endpoint = <&dwc3_0_role_switch>; + }; + }; + + port@2 { + reg = <2>; + + dp_altmode_mux: endpoint { + remote-endpoint = <&tcphy0_typec_dp>; + }; + }; + }; + }; + }; +}; + &i2s2 { status = "okay"; };
@@ -354,6 +446,16 @@ &io_domains { }; &pinctrl { + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + vcc5v0_typec0_en: vcc5v0-typec0-en { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + pmic { pmic_int_l: pmic-int-l { rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
@@ -400,10 +502,48 @@ &sdmmc { status = "okay"; }; +&sound { + rockchip,codec = <&cdn_dp>; + status = "okay"; +}; + +&spdif { + status = "okay"; +}; + &tcphy0 { status = "okay"; }; +&tcphy0_dp { + mode-switch; + + port { + #address-cells = <1>; + #size-cells = <0>; + + tcphy0_typec_dp: endpoint@0 { + reg = <0>; + remote-endpoint = <&dp_altmode_mux>; + }; + + dp_phy_in: endpoint@1 { + reg = <1>; + remote-endpoint = <&dp_controller_output>; + }; + }; +}; + +&tcphy0_usb3 { + orientation-switch; + + port { + tcphy0_orientation_switch: endpoint { + remote-endpoint = <&usbc0_orien_sw>; + }; + }; +}; + &tcphy1 { status = "okay"; };
@@ -461,7 +601,14 @@ &usb_host1_ohci { }; &usbdrd_dwc3_0 { + usb-role-switch; status = "okay"; + + port { + dwc3_0_role_switch: endpoint { + remote-endpoint = <&usbc0_role_sw>; + }; + }; }; &usbdrd3_0 {
Signature · 1 line
2.51.1