diff mbox series

[RFC,v1,04/12] drm/bridge-connector: set the PATH property for the connector

Message ID 20230903214150.2877023-5-dmitry.baryshkov@linaro.org (mailing list archive)
State New, archived
Headers show
Series drm,usb/typec: uABI for USB-C DisplayPort connectors | expand

Commit Message

Dmitry Baryshkov Sept. 3, 2023, 9:41 p.m. UTC
In order to properly identify connectors (in particular, DisplayPort
connectors wrapped into USB-C) allow bridge drivers to specify the value
to be used for connector's PATH property.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/drm_bridge_connector.c | 12 ++++++++++++
 include/drm/drm_bridge.h               |  7 +++++++
 2 files changed, 19 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c
index bf73960c2c2a..008d730e1c2f 100644
--- a/drivers/gpu/drm/drm_bridge_connector.c
+++ b/drivers/gpu/drm/drm_bridge_connector.c
@@ -331,6 +331,7 @@  struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 	struct drm_connector *connector;
 	struct i2c_adapter *ddc = NULL;
 	struct drm_bridge *bridge, *panel_bridge = NULL;
+	const char *path = NULL;
 	int connector_type;
 	int ret;
 
@@ -377,6 +378,9 @@  struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 			connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node));
 #endif
 
+		if (bridge->path)
+			path = bridge->path;
+
 		if (bridge->ddc)
 			ddc = bridge->ddc;
 
@@ -405,6 +409,14 @@  struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 		connector->polled = DRM_CONNECTOR_POLL_CONNECT
 				  | DRM_CONNECTOR_POLL_DISCONNECT;
 
+	if (path) {
+		drm_object_attach_property(&connector->base,
+					   drm->mode_config.path_property,
+					   0);
+
+		drm_connector_set_path_property(connector, path);
+	}
+
 	if (panel_bridge)
 		drm_panel_bridge_set_orientation(connector, panel_bridge);
 
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index c339fc85fd07..98e9d76474f4 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -753,6 +753,13 @@  struct drm_bridge {
 	 * before the peripheral.
 	 */
 	bool pre_enable_prev_first;
+	/**
+	 * @path: the 'path' of the bridge. For bridges at the end of this
+	 * chain this is used to set the 'PATH' property of the connector.
+	 * This string is not freed manually, so one either should use a static
+	 * string here or a devres-allocated one.
+	 */
+	const char *path;
 	/**
 	 * @ddc: Associated I2C adapter for DDC access, if any.
 	 */