From mboxrd@z Thu Jan 1 00:00:00 1970 From: Egbert Eich Subject: [PATCH 13/17] DRM/KMS/EDID: Allow for multiple Connectors when specifying 'firmware'-EDID Files. Date: Mon, 19 Nov 2012 15:23:14 -0500 Message-ID: <1353356598-10634-14-git-send-email-eich@suse.de> References: <1353356598-10634-1-git-send-email-eich@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 61E7CE6250 for ; Mon, 19 Nov 2012 12:41:32 -0800 (PST) In-Reply-To: <1353356598-10634-1-git-send-email-eich@suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org Cc: Egbert Eich , Takashi Iwai List-Id: dri-devel@lists.freedesktop.org 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="[:][;:]..." Signed-off-by: Egbert Eich --- 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