Commit 07c2b84b authored by Jani Nikula's avatar Jani Nikula

drm: move edid property update and add modes out of edid firmware loader

Make the firmware loader more generic and generally useful.
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1487344854-18777-2-git-send-email-jani.nikula@intel.com
parent fb70046c
...@@ -256,15 +256,14 @@ static void *edid_load(struct drm_connector *connector, const char *name, ...@@ -256,15 +256,14 @@ static void *edid_load(struct drm_connector *connector, const char *name,
return edid; return edid;
} }
int drm_load_edid_firmware(struct drm_connector *connector) struct edid *drm_load_edid_firmware(struct drm_connector *connector)
{ {
const char *connector_name = connector->name; const char *connector_name = connector->name;
char *edidname, *last, *colon, *fwstr, *edidstr, *fallback = NULL; char *edidname, *last, *colon, *fwstr, *edidstr, *fallback = NULL;
int ret;
struct edid *edid; struct edid *edid;
if (edid_firmware[0] == '\0') if (edid_firmware[0] == '\0')
return 0; return ERR_PTR(-ENOENT);
/* /*
* If there are multiple edid files specified and separated * If there are multiple edid files specified and separated
...@@ -293,7 +292,7 @@ int drm_load_edid_firmware(struct drm_connector *connector) ...@@ -293,7 +292,7 @@ int drm_load_edid_firmware(struct drm_connector *connector)
if (!edidname) { if (!edidname) {
if (!fallback) { if (!fallback) {
kfree(fwstr); kfree(fwstr);
return 0; return ERR_PTR(-ENOENT);
} }
edidname = fallback; edidname = fallback;
} }
...@@ -305,13 +304,5 @@ int drm_load_edid_firmware(struct drm_connector *connector) ...@@ -305,13 +304,5 @@ int drm_load_edid_firmware(struct drm_connector *connector)
edid = edid_load(connector, edidname, connector_name); edid = edid_load(connector, edidname, connector_name);
kfree(fwstr); kfree(fwstr);
if (IS_ERR_OR_NULL(edid)) return edid;
return 0;
drm_mode_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
drm_edid_to_eld(connector, edid);
kfree(edid);
return ret;
} }
...@@ -311,7 +311,13 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -311,7 +311,13 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
count = drm_add_edid_modes(connector, edid); count = drm_add_edid_modes(connector, edid);
drm_edid_to_eld(connector, edid); drm_edid_to_eld(connector, edid);
} else { } else {
count = drm_load_edid_firmware(connector); 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) if (count == 0)
count = (*connector_funcs->get_modes)(connector); count = (*connector_funcs->get_modes)(connector);
} }
......
...@@ -331,11 +331,12 @@ int drm_av_sync_delay(struct drm_connector *connector, ...@@ -331,11 +331,12 @@ int drm_av_sync_delay(struct drm_connector *connector,
const struct drm_display_mode *mode); const struct drm_display_mode *mode);
#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE #ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
int drm_load_edid_firmware(struct drm_connector *connector); struct edid *drm_load_edid_firmware(struct drm_connector *connector);
#else #else
static inline int drm_load_edid_firmware(struct drm_connector *connector) static inline struct edid *
drm_load_edid_firmware(struct drm_connector *connector)
{ {
return 0; return ERR_PTR(-ENOENT);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment