drm/bridge-connector: handle subconnector types
PATCH v2 1/1 drm/bridge-connector: handle subconnector types
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.
---
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 since v1:
- 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)
--- drivers/gpu/drm/drm_bridge_connector.c | 29 +++++++++++++++++++++++++- include/drm/drm_bridge.h | 4 ++++ 2 files changed, 32 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_bridge_connector.c +28 -1
@@ -332,6 +332,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,struct i2c_adapter *ddc =NULL ;struct drm_bridge *bridge, *panel_bridge =NULL ;const char *path =NULL ; +enum drm_mode_subconnector subconnector;int connector_type;int ret;
@@ -369,8 +370,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,if (bridge->ops &DRM_BRIDGE_OP_MODES ) bridge_connector->bridge_modes = bridge; -if (!drm_bridge_get_next_bridge (bridge)) +if (!drm_bridge_get_next_bridge (bridge)) { connector_type = bridge->type; + subconnector = bridge->subtype; + }if (!drm_bridge_get_next_bridge (bridge) && bridge->of_node)
@@ -418,6 +421,30 @@ 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 && + subconnector) { +/* +* 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);
include/drm/drm_bridge.h +4 -0
@@ -738,6 +738,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.
Signature · 1 line
2.39.2