[RFC PATCH 3/7] drm: abstract override and firmware edid

Jani Nikula
2016-12-27T16:21:50Z

The functional change is that if firmware edid is present, it'll still
bypass get_modes even if number of modes is 0. This is in line with
override edid handling.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/drm_probe_helper.c | 44 ++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index fe65af8f48b9..431349673846 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -163,6 +163,32 @@ drm_connector_detect(struct drm_connector *connector, bool force)
connector_status_connected;
}

+static bool bypass_edid(struct drm_connector *connector, int *count)
+{
+ struct edid *edid;
+
+ if (connector->override_edid) {
+ edid = (struct edid *) connector->edid_blob_ptr->data;
+
+ *count = drm_add_edid_modes(connector, edid);
+ drm_edid_to_eld(connector, edid);
+
+ return true;
+ }
+
+ edid = drm_load_edid_firmware(connector);
+ if (!IS_ERR_OR_NULL(edid)) {
+ drm_mode_connector_update_edid_property(connector, edid);
+ *count = drm_add_edid_modes(connector, edid);
+ drm_edid_to_eld(connector, edid);
+ kfree(edid);
+
+ return true;
+ }
+
+ return false;
+}
+
/**
* drm_helper_probe_single_connector_modes - get complete set of display modes
* @connector: connector to probe
@@ -292,22 +318,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
goto prune;
}

- if (connector->override_edid) {
- struct edid *edid = (struct edid *) connector->edid_blob_ptr->data;
-
- count = drm_add_edid_modes(connector, edid);
- drm_edid_to_eld(connector, edid);
- } else {
- struct edid *edid = drm_load_edid_firmware(connector);
- if (!IS_ERR_OR_NULL(edid)) {
- drm_mode_connector_update_edid_property(connector, edid);
- count = drm_add_edid_modes(connector, edid);
- drm_edid_to_eld(connector, edid);
- kfree(edid);
- }
- if (count == 0)
- count = (*connector_funcs->get_modes)(connector);
- }
+ if (!bypass_edid(connector, &count))
+ count = (*connector_funcs->get_modes)(connector);

if (count == 0 && connector->status == connector_status_connected)
count = drm_add_modes_noedid(connector, 1024, 768);
--
2.1.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org