@@ -523,6 +523,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
struct drm_bridge *bridge, *panel_bridge = NULL;
unsigned int supported_formats = BIT(HDMI_COLORSPACE_RGB);
unsigned int max_bpc = 8;
+ enum drm_mode_subconnector subconnector;
int connector_type;
int ret;
@@ -576,8 +577,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
max_bpc = bridge->max_bpc;
}
- if (!drm_bridge_get_next_bridge(bridge))
+ if (!drm_bridge_get_next_bridge(bridge)) {
connector_type = bridge->type;
+ subconnector = bridge->subtype;
+ }
#ifdef CONFIG_OF
if (!drm_bridge_get_next_bridge(bridge) &&
@@ -643,6 +646,29 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
if (panel_bridge)
drm_panel_bridge_set_orientation(connector, panel_bridge);
+ if (connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
+ drm_connector_attach_dp_subconnector_property(connector);
+ } else if (connector_type == DRM_MODE_CONNECTOR_DVII) {
+ ret = drm_mode_create_dvi_i_properties(drm);
+ if (ret)
+ return ERR_PTR(ret);
+
+ drm_object_attach_property(&connector->base,
+ drm->mode_config.dvi_i_subconnector_property,
+ subconnector);
+ } else if (connector_type == DRM_MODE_CONNECTOR_TV) {
+ /*
+ * We do not know which modes are supported by the HW, so the
+ * property should be created in advance.
+ */
+ if (!drm->mode_config.tv_subconnector_property)
+ return ERR_PTR(-EINVAL);
+
+ drm_object_attach_property(&connector->base,
+ drm->mode_config.tv_subconnector_property,
+ subconnector);
+ }
+
return connector;
}
EXPORT_SYMBOL_GPL(drm_bridge_connector_init);
@@ -361,9 +361,6 @@ struct drm_connector *msm_dp_drm_connector_init(struct msm_dp *msm_dp_display,
if (IS_ERR(connector))
return connector;
- if (!msm_dp_display->is_edp)
- drm_connector_attach_dp_subconnector_property(connector);
-
drm_connector_attach_encoder(connector, encoder);
return connector;
@@ -850,6 +850,10 @@ struct drm_bridge {
* identifies the type of connected display.
*/
int type;
+ /**
+ * @subtype: the subtype of the connector for the DP/TV/DVI-I cases.
+ */
+ enum drm_mode_subconnector subtype;
/**
* @interlace_allowed: Indicate that the bridge can handle interlaced
* modes.
If the created connector type supports subconnector type property, create and attach corresponding it. The default subtype value is 0, which maps to the DRM_MODE_SUBCONNECTOR_Unknown type. Also remove subconnector creation from the msm_dp driver to prevent having duplicate properties on the DP connectors. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- This is a leftover of my previous attempt to implement USB-C DisplayPort uABI. The idea was dropped, but I consider this part still to be useful, as it allows one to register corresponding subconnector properties and also to export the subconnector type. --- Changes in v3: - Rebased on top of linux-next - Drop subconnector property from msm_dp driver - Link to v2: https://lore.kernel.org/r/20230903214934.2877259-1-dmitry.baryshkov@linaro.org Changes in v2: - Dropped all DP and USB-related patches - Dropped the patch adding default subtype to drm_connector_attach_dp_subconnector_property() - Replaced creation of TV subconnector property with the check that it was created beforehand (Neil, Laurent) - Link to v1: https://lore.kernel.org/r/20230729004913.215872-1-dmitry.baryshkov@linaro.org/ --- drivers/gpu/drm/display/drm_bridge_connector.c | 28 +++++++++++++++++++++++++- drivers/gpu/drm/msm/dp/dp_drm.c | 3 --- include/drm/drm_bridge.h | 4 ++++ 3 files changed, 31 insertions(+), 4 deletions(-) --- base-commit: 8defad9f57376a89914d16757717a27b567de04e change-id: 20250117-subconnector-246b6fe49488 Best regards,