@@ -226,26 +226,43 @@ struct edid *
drm_load_edid_firmware(struct drm_connector *connector)
{
char *connector_name = drm_get_connector_name(connector);
- char *edidname = edid_firmware, *last, *colon;
- struct edid *edid;
+ char *edidname, *last, *colon;
+ struct edid *edid = NULL;
+ char *next, *mem;
+ bool many = false;
- if (*edidname == '\0')
+ if (*edid_firmware == '\0')
return NULL;
- colon = strchr(edidname, ':');
- if (colon != NULL) {
- if (strncmp(connector_name, edidname, colon - edidname))
- return NULL;
- edidname = colon + 1;
- if (*edidname == '\0')
- return NULL;
+ edidname = mem = kstrndup(edid_firmware, PATH_MAX, GFP_KERNEL);
+ while (edidname) {
+ next = strchr(edidname, ';');
+ if (next)
+ *(next++) = '\0';
+ colon = strchr(edidname, ':');
+ if (colon == NULL) {
+ if (next || many)
+ edidname = NULL;
+ break;
+ } else if (!strncmp(connector_name, edidname, colon - edidname)) {
+ edidname = colon + 1;
+ break;
+ }
+ edidname = next;
+ many = true;
+ }
+
+ if (edidname && *edidname != '\0') {
+ last = edidname + strlen(edidname) - 1;
+ if (*last == '\n')
+ *last = '\0';
+
+ if (strlen(edidname) > 0)
+ edid = edid_load(connector, edidname, connector_name);
}
- last = edidname + strlen(edidname) - 1;
- if (*last == '\n')
- *last = '\0';
+ kfree(mem);
- edid = edid_load(connector, edidname, connector_name);
if (IS_ERR_OR_NULL(edid))
return NULL;
So far it was only possible to load an EDID for a single connector (unless no connector was specified at all in which case the same EDID file was used for all). This patch extends the EDID loader so that EDID files can be specified for more than one connector. A semicolon is used to separate the different connector sections. The option now looks like this: edid_firmware="[<connector_0>:]<edid_file_0>[;<connector_n>:<edid_file_1>]..." v2: Check for edidname != NULL before entering loop. Signed-off-by: Egbert Eich <eich@suse.com> --- drivers/gpu/drm/drm_edid_load.c | 45 ++++++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 14 deletions(-)