From patchwork Thu Nov 22 10:23:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 1783371 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 A4C953FC64 for ; Thu, 22 Nov 2012 11:03:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EB89E6499 for ; Thu, 22 Nov 2012 03:03:56 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by gabe.freedesktop.org (Postfix) with ESMTP id 8EE99E5CCE for ; Thu, 22 Nov 2012 02:51:11 -0800 (PST) Received: from debian (p5DCF0728.dip0.t-ipconnect.de [93.207.7.40]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MOzJP-1TeX2U3XqJ-005mcr; Thu, 22 Nov 2012 11:51:06 +0100 Received: from sles11.fritz.box (sles11.fritz.box [192.168.178.22]) by debian (Postfix) with ESMTP id 9AD7F3F35B; Thu, 22 Nov 2012 11:51:03 +0100 (CET) From: Egbert Eich To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 11/18] DRM/KMS/EDID: Allow for multiple Connectors when specifying 'firmware'-EDID Files (v2) Date: Thu, 22 Nov 2012 05:23:01 -0500 Message-Id: <1353579788-30637-12-git-send-email-eich@suse.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1353579788-30637-1-git-send-email-eich@suse.com> References: <1353356598-10634-1-git-send-email-eich@suse.de> <1353579788-30637-1-git-send-email-eich@suse.com> X-Provags-ID: V02:K0:yl23YUog/EaqUe8bsaLGkTgB5eaERi4Ytp7PlPeOgsP 4Rgs1p9v8RRz9bPjS+YgsuxHGuzsmLpSerXlfQTICXYjokIs74 mNZKD72iOKB0yMSzIEiiZAfXKnd7KHmt/0QtlaKdZfsQHs9if/ +uNnAqec48LOh7w9ViMwUTvO7jJd3CbNkNLXZrnRGpKiawievE X71UhBKAwmTbpc/2UrTF2SsvrvDFyfolkTNREi8AMpOfGThxec bZLUVneDpLkTJ0Ebde4DF/MQom8rze1gHYdmMjpC28IYqzwRnF LibSBgIc35eiYNhHjByBTv1WZzOXl/DffrZqwOD4eEy15D2kwN 0Z5gG7XTPgNcE8hR4yfA= Cc: Egbert Eich , tiwai@suse.com 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="[:][;:]..." v2: Check for edidname != NULL before entering loop. 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 748f63b..9c15c4a 100644 --- a/drivers/gpu/drm/drm_edid_load.c +++ b/drivers/gpu/drm/drm_edid_load.c @@ -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;