From patchwork Mon Nov 19 20:23:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 1769091 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id C917B3FCAE for ; Mon, 19 Nov 2012 20:52:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB278E6276 for ; Mon, 19 Nov 2012 12:52:35 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org 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) Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id B90F4A3DDD; Mon, 19 Nov 2012 21:41:31 +0100 (CET) Received: from sles11.fritz.box (sles11.fritz.box [192.168.178.22]) by debian (Postfix) with ESMTP id 606E33F32B; Mon, 19 Nov 2012 21:41:30 +0100 (CET) From: Egbert Eich To: dri-devel@lists.freedesktop.org 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> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1353356598-10634-1-git-send-email-eich@suse.de> References: <1353356598-10634-1-git-send-email-eich@suse.de> Cc: Egbert Eich , Takashi Iwai X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@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;