@@ -119,11 +119,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
goto prune;
}
-#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
- count = drm_load_edid_firmware(connector);
- if (count == 0)
-#endif
- count = (*connector_funcs->get_modes)(connector);
+ count = (*connector_funcs->get_modes)(connector);
if (count == 0 && connector->status == connector_status_connected)
count = drm_add_modes_noedid(connector, 1024, 768);
@@ -438,6 +438,13 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
u8 *block, *new;
bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
+ /* check if the user has specified a 'firmware' EDID file */
+ block = (u8*)drm_load_edid_firmware(connector);
+ if (block)
+ return block;
+#endif
+
if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
return NULL;
@@ -114,7 +114,7 @@ static u8 generic_edid[GENERIC_EDIDS][128] = {
},
};
-static u8 *edid_load(struct drm_connector *connector, char *name,
+static struct edid *edid_load(struct drm_connector *connector, char *name,
char *connector_name)
{
const struct firmware *fw;
@@ -192,36 +192,32 @@ out:
return edid;
}
-int drm_load_edid_firmware(struct drm_connector *connector)
+struct edid *
+drm_load_edid_firmware(struct drm_connector *connector)
{
char *connector_name = drm_get_connector_name(connector);
char *edidname = edid_firmware, *last, *colon;
- int ret;
struct edid *edid;
if (*edidname == '\0')
- return 0;
+ return NULL;
colon = strchr(edidname, ':');
if (colon != NULL) {
if (strncmp(connector_name, edidname, colon - edidname))
- return 0;
+ return NULL;
edidname = colon + 1;
if (*edidname == '\0')
- return 0;
+ return NULL;
}
last = edidname + strlen(edidname) - 1;
if (*last == '\n')
*last = '\0';
- edid = (struct edid *) edid_load(connector, edidname, connector_name);
+ edid = edid_load(connector, edidname, connector_name);
if (IS_ERR_OR_NULL(edid))
- return 0;
+ return NULL;
- drm_mode_connector_update_edid_property(connector, edid);
- ret = drm_add_edid_modes(connector, edid);
- kfree(edid);
-
- return ret;
+ return edid;
}
@@ -252,7 +252,9 @@ int drm_av_sync_delay(struct drm_connector *connector,
struct drm_display_mode *mode);
struct drm_connector *drm_select_eld(struct drm_encoder *encoder,
struct drm_display_mode *mode);
-int drm_load_edid_firmware(struct drm_connector *connector);
+#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
+struct edid *drm_load_edid_firmware(struct drm_connector *connector);
+#endif
int drm_validate_edid_blob(struct drm_connector *connector, u8 **blockp, int len);
#endif /* __DRM_EDID_H__ */
Firmware supplied EDIDs where fed in in drm_helper_probe_single_connector_modes() in place of calling the driver supplied get_modes() function. This has two problems: 1. Drivers don't call drm_get_edid() only from within get_modes(). 2. The get_modes() replacement in drm_load_edid_firmware() provided only the least common denominator of what driver provided get_modes() callbacks do. This patch now supplies a user provided 'firmware' EDID whenever drm_get_edid() is called if one is available. The user supplied EDID is thus used the same way as a display provided one (except for detecting the presence of a device thru EDID). Also it does so not on the helper level any more, the possibility for EDID loading now happens on the DRM KMS core level. Signed-off-by: Egbert Eich <eich@suse.de> --- drivers/gpu/drm/drm_crtc_helper.c | 6 +----- drivers/gpu/drm/drm_edid.c | 7 +++++++ drivers/gpu/drm/drm_edid_load.c | 22 +++++++++------------- include/drm/drm_edid.h | 4 +++- 4 files changed, 20 insertions(+), 19 deletions(-)