drm: add drm_connector_attach_edid_property()
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 2 Oct 2018 11:10:40 +0000 (13:10 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 5 Oct 2018 11:53:50 +0000 (13:53 +0200)
drm_connector_init doesn't attach the edid property for some connector
types, drm_connector_attach_edid_property() can be used to enable the
edid property in these cases.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20181002111041.17053-2-kraxel@redhat.com
drivers/gpu/drm/drm_connector.c
include/drm/drm_connector.h

index 1e40e5decbe91a4f709305d5259b5b7c0425e617..5d01414ec9f7581b133a58dcaba84e63a0c21862 100644 (file)
@@ -260,9 +260,7 @@ int drm_connector_init(struct drm_device *dev,
 
        if (connector_type != DRM_MODE_CONNECTOR_VIRTUAL &&
            connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
-               drm_object_attach_property(&connector->base,
-                                             config->edid_property,
-                                             0);
+               drm_connector_attach_edid_property(connector);
 
        drm_object_attach_property(&connector->base,
                                      config->dpms_property, 0);
@@ -294,6 +292,25 @@ out_put:
 }
 EXPORT_SYMBOL(drm_connector_init);
 
+/**
+ * drm_connector_attach_edid_property - attach edid property.
+ * @dev: DRM device
+ * @connector: the connector
+ *
+ * Some connector types like DRM_MODE_CONNECTOR_VIRTUAL do not get a
+ * edid property attached by default.  This function can be used to
+ * explicitly enable the edid property in these cases.
+ */
+void drm_connector_attach_edid_property(struct drm_connector *connector)
+{
+       struct drm_mode_config *config = &connector->dev->mode_config;
+
+       drm_object_attach_property(&connector->base,
+                                  config->edid_property,
+                                  0);
+}
+EXPORT_SYMBOL(drm_connector_attach_edid_property);
+
 /**
  * drm_connector_attach_encoder - attach a connector to an encoder
  * @connector: connector to attach
index 91a877fa00cb59161125a711515931e49b040e53..5b3cf909fd5e4c31072a849572db66a87565e2aa 100644 (file)
@@ -1084,6 +1084,7 @@ int drm_connector_init(struct drm_device *dev,
                       struct drm_connector *connector,
                       const struct drm_connector_funcs *funcs,
                       int connector_type);
+void drm_connector_attach_edid_property(struct drm_connector *connector);
 int drm_connector_register(struct drm_connector *connector);
 void drm_connector_unregister(struct drm_connector *connector);
 int drm_connector_attach_encoder(struct drm_connector *connector,