[PATCH 13/17] DRM/KMS/EDID: Allow for multiple Connectors when specifying 'firmware'-EDID Files.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>]..."

Signed-off-by: Egbert Eich <eich@xxxxxxx>
---
 drivers/gpu/drm/drm_edid_load.c |   45 ++++++++++++++++++++++++++------------
 1 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index 1475c6f..a40a88505 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -196,26 +196,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);
+	do {
+		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;
+	} while (edidname);
+
+	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;
 
-- 
1.7.7

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux