From nobody Sun Feb 8 10:30:32 2026 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9182F2103 for ; Wed, 28 Feb 2024 01:11:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082701; cv=none; b=aMyJNXUasNdFJPhLTvZCzXTvlHLzhIY24zWArBFHSBTQqKmGo/lvO9aupMHPBrZTZ35qDq6R5+5tt5TDAMNwsUpQfurKJOpI+tHHSkeEpMfzfUh88fKgLtGHfc6UErpEvkobFYmDEfAiFWZR6sH9itj3yHMHFYdSL25eJFewg6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082701; c=relaxed/simple; bh=+Za4WiG0WeyFO8aiqq35F/0dX8b+SoiVTKiGqv26ccQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F0F/M8pwJJIeRHs3rFseWM2qA34I4WjO/nsVdoO0J+tWb9h8EtDHWJ+0m9mfkB6AgKyY8s4l+uM6WbP0XWl1pJbfpddZXFyneh4J3M1HR+oHZWwFAwvC0KobLTyvYXlz3arohwHBSF9JZ+kv3wjTWcjXF5E2R2LGLj3XgU7uY2s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=YXCjJu/p; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="YXCjJu/p" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1dc49b00bdbso43938445ad.3 for ; Tue, 27 Feb 2024 17:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709082699; x=1709687499; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iXmDMoR5fxDfWHfx9hk2z/Xni/CCYvEBdkiUT3ERlc4=; b=YXCjJu/pDXM02doM7Ol9O5QLVQIXeH+9fvOKY08FxUrKvW9WmKJ9x9Ohafd1o6lRmE YqM7HXaJzBzfBVqMOTqSQHNVCZRLx8WvpksriTLhVY26lm07BtF7ThiKqHUAFmgywSZW V2UzkH6yaUemZ4/1bQNdc8ttWCF/L/ZiLR8bg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709082699; x=1709687499; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iXmDMoR5fxDfWHfx9hk2z/Xni/CCYvEBdkiUT3ERlc4=; b=kh1raWzf3h8gCsQ3xpHpyEwEqmeR415hFwncU3of2fSp0uraq30/31K2WpklMJZES4 llm409iPMazl2dm3Pi06kYymzuLCjch0wN3vVQYpoiOJHccSHcLRM95gGia7k1HqKT2l FDa3PfA+Nj4goYD70V5YI9FiYEdWTqhxMUOHq9eUgnwFof8Nib/gJiju1cZE2AeYnlan DF9KXQZ9PKyCao7KVASyja5EwR5wcZwd52HE36ei6BhPDB82Y+gJbYXVTOvasNylSpX3 gY/64o2t2f3A90eCtLarfxiT2Nntm702bOAyqQDXe0OBBnJ7HtYq53GtRUHtzxFvNlih 733w== X-Forwarded-Encrypted: i=1; AJvYcCWuLvrw57VLZKjnz7jIp+SVq0x9iKZAN1P6ziR2OlYpeNqe+fH7TbgY8qSdj8sQpzeAkJWKyTqLLugEN9+HOnALV1RUahar8O7zsQox X-Gm-Message-State: AOJu0Yxss8KsQsBiqUxVhuXHhNd02ZpNggRS9QRosJObpRaoGthhkz5l 7Fq+y5McgLkHSWN9CTS5FP5HDBvGcNe479kC2rc+IUY2HYk0Ut8outQogqs+6Q== X-Google-Smtp-Source: AGHT+IFZU274TcXtjwUJ4KumuJnFvswQ8pqcET9/pvdjkcdY+FVA+6GXBMXUpT3bKpLlEHZ2fby6QQ== X-Received: by 2002:a17:902:8303:b0:1dc:5e8a:93b with SMTP id bd3-20020a170902830300b001dc5e8a093bmr9108581plb.8.1709082698923; Tue, 27 Feb 2024 17:11:38 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:87d1:e95d:b670:4783]) by smtp.gmail.com with ESMTPSA id kl14-20020a170903074e00b001db4b3769f6sm2131529plb.280.2024.02.27.17.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:11:38 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] drm_edid: Support getting EDID through ddc without connector Date: Tue, 27 Feb 2024 17:05:58 -0800 Message-ID: <20240228011133.1238439-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog In-Reply-To: <20240228011133.1238439-1-hsinyi@chromium.org> References: <20240228011133.1238439-1-hsinyi@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some panels are interested in the EDID during early probe when connector is still unknown. Add a function drm_get_edid_no_connector() to get edid without connector. No functional change for existing usage. Signed-off-by: Hsin-Yi Wang --- v1->v2: add a function to return the entire edid without updating connector. --- drivers/gpu/drm/drm_edid.c | 45 ++++++++++++++++++++++++++++---------- include/drm/drm_edid.h | 1 + 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1ad94473e400..15b97c8ed993 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2364,7 +2364,7 @@ static struct edid *_drm_do_get_edid(struct drm_conne= ctor *connector, struct edid *edid, *new; size_t alloc_size =3D EDID_LENGTH; =20 - override =3D drm_edid_override_get(connector); + override =3D connector ? drm_edid_override_get(connector) : false; if (override) { alloc_size =3D override->size; edid =3D kmemdup(override->edid, alloc_size, GFP_KERNEL); @@ -2385,18 +2385,20 @@ static struct edid *_drm_do_get_edid(struct drm_con= nector *connector, if (status =3D=3D EDID_BLOCK_READ_FAIL) goto fail; =20 - /* FIXME: Clarify what a corrupt EDID actually means. */ - if (status =3D=3D EDID_BLOCK_OK || status =3D=3D EDID_BLOCK_VERSION) - connector->edid_corrupt =3D false; - else - connector->edid_corrupt =3D true; + if (connector) { + /* FIXME: Clarify what a corrupt EDID actually means. */ + if (status =3D=3D EDID_BLOCK_OK || status =3D=3D EDID_BLOCK_VERSION) + connector->edid_corrupt =3D false; + else + connector->edid_corrupt =3D true; =20 - if (!edid_block_status_valid(status, edid_block_tag(edid))) { - if (status =3D=3D EDID_BLOCK_ZERO) - connector->null_edid_counter++; + if (!edid_block_status_valid(status, edid_block_tag(edid))) { + if (status =3D=3D EDID_BLOCK_ZERO) + connector->null_edid_counter++; =20 - connector_bad_edid(connector, edid, 1); - goto fail; + connector_bad_edid(connector, edid, 1); + goto fail; + } } =20 if (!edid_extension_block_count(edid)) @@ -2444,7 +2446,8 @@ static struct edid *_drm_do_get_edid(struct drm_conne= ctor *connector, } =20 if (invalid_blocks) { - connector_bad_edid(connector, edid, num_blocks); + if (connector) + connector_bad_edid(connector, edid, num_blocks); =20 edid =3D edid_filter_invalid_blocks(edid, &alloc_size); } @@ -2637,6 +2640,24 @@ struct edid *drm_get_edid(struct drm_connector *conn= ector, } EXPORT_SYMBOL(drm_get_edid); =20 +/** + * drm_get_edid_no_connector - get EDID data without updating connector st= atus + * @adapter: I2C adapter to use for DDC + * + * Similar to drm_edid_read_ddc(), but not checking any connector status. = Use + * this function to get EDID when connector is still unknown. + * + * Return: Pointer to valid EDID or NULL if we couldn't find any. + */ +struct edid *drm_get_edid_no_connector(struct i2c_adapter *adapter) +{ + if (!drm_probe_ddc(adapter)) + return NULL; + + return _drm_do_get_edid(NULL, drm_do_probe_ddc_edid, adapter, NULL); +} +EXPORT_SYMBOL(drm_get_edid_no_connector); + /** * drm_edid_read_custom - Read EDID data using given EDID block read funct= ion * @connector: Connector to use diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 70ae6c290bdc..80c9e32ff80e 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -565,6 +565,7 @@ struct edid *drm_do_get_edid(struct drm_connector *conn= ector, void *data); struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); +struct edid *drm_get_edid_no_connector(struct i2c_adapter *adapter); u32 drm_edid_get_panel_id(struct i2c_adapter *adapter); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); --=20 2.44.0.rc1.240.g4c46232300-goog From nobody Sun Feb 8 10:30:32 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A5424400 for ; Wed, 28 Feb 2024 01:11:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082702; cv=none; b=ijyMDAOXgPJJ+xHTrGGfi+wKPwblQtLx5/gJdxU7jm73/1SOeNmKMWiR2h2f58H/JNCDp058s0yswN29ShsNuvWK5OnRZi1TliROALaTNvH8RAzsN6HYttO6n2ZXiLnM8ODMgczr0Ni4Xw5cjb00KARvqg243LtKpCzRcleRLU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082702; c=relaxed/simple; bh=yzb11FO0nW1yy8hePLHX/ocuoarx6rze5KYkOu5/1xw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c/GLxiCM1UUPtfUZTdAOxRQ3fliR4Jke+nvJT50yV7UURXLsUqyjYkFd6xp/vekTMmv6zYXCgfJtZtqC+P92GUfholIAaysYCJU6vtBeCZJDhUPCX5vEI2mdz8R8YYK9XQndyqwFGVoPJvCbIjU2XA4uNJ20ntUIWV7Zs64Yy6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Wp5cOO8S; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Wp5cOO8S" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dc0e5b223eso41303755ad.1 for ; Tue, 27 Feb 2024 17:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709082700; x=1709687500; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sqVPOgao3nUBQcfuJjPRQ/Z77KczM3H/soIyvGzsAUo=; b=Wp5cOO8SpN1+T1t826nQPc3iHmyI+ofOiO7Jr1U/ZzQBba+ZzKxk9mfMIMX3EqWWo6 3VJxHh4MgGtcdejyu9khPx2PbEa8KgIcOny9fF5yRMOQPaAQuZmcSwmid51l/w/N3Ng3 UQ3iNL4Lbjb0G1D2I9Lqz+lxIbaHP1jb6L084= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709082700; x=1709687500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sqVPOgao3nUBQcfuJjPRQ/Z77KczM3H/soIyvGzsAUo=; b=uHj/++G5i2icnHgeWSC070eIn7cQqNgcJa0a2613OT5cVLWF9XbBURi3XPwbjVOnhF PCc2JITfW0Eew6XKE24FlbpnMMe3ZmrOtp7aNes1/jDEkB7JwsuJSpAuw9veI4N9wdgN Jljycy91OaEChzg258gXXEKZBkYT7LIHIqL2B02/U/ZKpF5qPiG58DZ23er27RzJDRS2 V3aEuwG2KBRB8wLL8opNcPqP1lmiu3cTk+41sk7o2C3nmZ4HjOWzbGTtYDS1UkRfJ46F G9w7zVDGCP8pJ2UqUcUWm/jD/jwS6r4iFtvObXzMSUsFKByz5xYYw6AYckuXN76MXeqh DAfg== X-Forwarded-Encrypted: i=1; AJvYcCUtx+eVjAz1lgEtsn9K3IslMWB8EGNrcf9F8Q6kHLR7GOw0btq39vIZ6zKDR3AQeZty/dJ2wdzBi3YyXSvsmnar0bCwXUhoPdZyz++3 X-Gm-Message-State: AOJu0YxhSNyf4nYEsZ7/zI7hVtwWzgSzQmaxciC/HPZH9S3OEh11VnMd V3eudXBDmMRMJEa9m0ARf1YFTA+1G983KYmHA+FdZw+oFJa75KWRUuUc1k+zTQ== X-Google-Smtp-Source: AGHT+IEanBcdy/4EmkJInHO9eSzsmi9IHlJxuOJZ78Yq00y6wV5YFHQmlw+GKcpe6EBwL9YtY+2iHA== X-Received: by 2002:a17:902:d4c6:b0:1dc:af71:4d46 with SMTP id o6-20020a170902d4c600b001dcaf714d46mr6771119plg.13.1709082699902; Tue, 27 Feb 2024 17:11:39 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:87d1:e95d:b670:4783]) by smtp.gmail.com with ESMTPSA id kl14-20020a170903074e00b001db4b3769f6sm2131529plb.280.2024.02.27.17.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:11:39 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] drm/panel: panel-edp: Match edp_panels with panel name Date: Tue, 27 Feb 2024 17:05:59 -0800 Message-ID: <20240228011133.1238439-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog In-Reply-To: <20240228011133.1238439-1-hsinyi@chromium.org> References: <20240228011133.1238439-1-hsinyi@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It's found that some panels have variants that they share the same panel id although their EDID and names are different. When matching generic edp panels, we should first match with both panel id and panel name by checking if edid contains the name string. If not found, match with panel id only. Signed-off-by: Hsin-Yi Wang --- v1->v2: match with panel name instead of crc hash. Note that we can't directly use drm_edid_get_monitor_name(), because some panel store the name after EDID_DETAIL_MONITOR_STRING instead of EDID_DETAIL_MONITOR_NAME. --- drivers/gpu/drm/drm_edid.c | 69 +++++++------------------------ drivers/gpu/drm/panel/panel-edp.c | 44 +++++++++++++++++--- include/drm/drm_edid.h | 2 +- 3 files changed, 54 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 15b97c8ed993..c4126475ff0a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2764,7 +2764,19 @@ const struct drm_edid *drm_edid_read(struct drm_conn= ector *connector) } EXPORT_SYMBOL(drm_edid_read); =20 -static u32 edid_extract_panel_id(const struct edid *edid) +/** + * edid_extract_panel_id - Extract a panel's ID from EDID + * @edid: EDID used to extract the panel's ID. + * + * Extract panel ID from EDID. + * + * Return: A 32-bit ID that should be different for each make/model of pan= el. + * See the functions drm_edid_encode_panel_id() and + * drm_edid_decode_panel_id() for some details on the structure of= this + * ID. + */ + +u32 edid_extract_panel_id(const struct edid *edid) { /* * We represent the ID as a 32-bit number so it can easily be compared @@ -2783,60 +2795,7 @@ static u32 edid_extract_panel_id(const struct edid *= edid) (u32)edid->mfg_id[1] << 16 | (u32)EDID_PRODUCT_ID(edid); } - -/** - * drm_edid_get_panel_id - Get a panel's ID through DDC - * @adapter: I2C adapter to use for DDC - * - * This function reads the first block of the EDID of a panel and (assuming - * that the EDID is valid) extracts the ID out of it. The ID is a 32-bit v= alue - * (16 bits of manufacturer ID and 16 bits of per-manufacturer ID) that's - * supposed to be different for each different modem of panel. - * - * This function is intended to be used during early probing on devices wh= ere - * more than one panel might be present. Because of its intended use it mu= st - * assume that the EDID of the panel is correct, at least as far as the ID - * is concerned (in other words, we don't process any overrides here). - * - * NOTE: it's expected that this function and drm_do_get_edid() will both - * be read the EDID, but there is no caching between them. Since we're only - * reading the first block, hopefully this extra overhead won't be too big. - * - * Return: A 32-bit ID that should be different for each make/model of pan= el. - * See the functions drm_edid_encode_panel_id() and - * drm_edid_decode_panel_id() for some details on the structure of= this - * ID. - */ - -u32 drm_edid_get_panel_id(struct i2c_adapter *adapter) -{ - enum edid_block_status status; - void *base_block; - u32 panel_id =3D 0; - - /* - * There are no manufacturer IDs of 0, so if there is a problem reading - * the EDID then we'll just return 0. - */ - - base_block =3D kzalloc(EDID_LENGTH, GFP_KERNEL); - if (!base_block) - return 0; - - status =3D edid_block_read(base_block, 0, drm_do_probe_ddc_edid, adapter); - - edid_block_status_print(status, base_block, 0); - - if (edid_block_status_valid(status, edid_block_tag(base_block))) - panel_id =3D edid_extract_panel_id(base_block); - else - edid_block_dump(KERN_NOTICE, base_block, 0); - - kfree(base_block); - - return panel_id; -} -EXPORT_SYMBOL(drm_edid_get_panel_id); +EXPORT_SYMBOL(edid_extract_panel_id); =20 /** * drm_get_edid_switcheroo - get EDID data for a vga_switcheroo output diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/pane= l-edp.c index 3fb5fcd326a4..72ad552bff24 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -761,11 +761,13 @@ static void panel_edp_parse_panel_timing_node(struct = device *dev, dev_err(dev, "Reject override mode: No display_timing found\n"); } =20 -static const struct edp_panel_entry *find_edp_panel(u32 panel_id); +static bool edid_has_name(struct edid *edid, const char *panel_name); +static const struct edp_panel_entry *find_edp_panel(u32 panel_id, struct e= did *edid); =20 static int generic_edp_panel_probe(struct device *dev, struct panel_edp *p= anel) { struct panel_desc *desc; + struct edid *edid; u32 panel_id; char vend[4]; u16 product_id; @@ -795,15 +797,19 @@ static int generic_edp_panel_probe(struct device *dev= , struct panel_edp *panel) goto exit; } =20 - panel_id =3D drm_edid_get_panel_id(panel->ddc); - if (!panel_id) { + edid =3D drm_get_edid_no_connector(panel->ddc); + if (!edid) { dev_err(dev, "Couldn't identify panel via EDID\n"); ret =3D -EIO; goto exit; } + panel_id =3D edid_extract_panel_id(edid); drm_edid_decode_panel_id(panel_id, vend, &product_id); =20 - panel->detected_panel =3D find_edp_panel(panel_id); + panel->detected_panel =3D find_edp_panel(panel_id, edid); + + /* Read EDID again in panel_edp_get_modes() when connector is known. */ + kfree(edid); =20 /* * We're using non-optimized timings and want it really obvious that @@ -2107,13 +2113,41 @@ static const struct edp_panel_entry edp_panels[] = =3D { { /* sentinal */ } }; =20 -static const struct edp_panel_entry *find_edp_panel(u32 panel_id) +static bool edid_has_name(struct edid *edid, const char *panel_name) +{ + int i, j; + char buf[13]; + + for (i =3D 0; i < 4; i++) { + strncpy(buf, edid->detailed_timings[i].data.other_data.data.str.str, + sizeof(buf)); + for (j =3D 0; j < 13; j++) { + if (buf[j] =3D=3D 0x0a) { + buf[j] =3D '\0'; + break; + } + } + buf[12] =3D '\0'; + if (strncmp(panel_name, buf, strlen(panel_name)) =3D=3D 0) + return true; + } + + return false; +} + +static const struct edp_panel_entry *find_edp_panel(u32 panel_id, struct e= did *edid) { const struct edp_panel_entry *panel; =20 if (!panel_id) return NULL; =20 + /* Match with both panel_id and name. Find if EDID contains name. */ + for (panel =3D edp_panels; panel->panel_id; panel++) + if (panel->panel_id =3D=3D panel_id && edid_has_name(edid, panel->name)) + return panel; + + /* Match with only panel_id */ for (panel =3D edp_panels; panel->panel_id; panel++) if (panel->panel_id =3D=3D panel_id) return panel; diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 80c9e32ff80e..4cefff357789 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -566,7 +566,7 @@ struct edid *drm_do_get_edid(struct drm_connector *conn= ector, struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_get_edid_no_connector(struct i2c_adapter *adapter); -u32 drm_edid_get_panel_id(struct i2c_adapter *adapter); +u32 edid_extract_panel_id(const struct edid *edid); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); --=20 2.44.0.rc1.240.g4c46232300-goog From nobody Sun Feb 8 10:30:32 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63DFE524A for ; Wed, 28 Feb 2024 01:11:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082702; cv=none; b=b7ZnDVgMn9B1djPLwXEEsQ/TB2hd9X3oGfGLzKH5Wz7ttrgXcBMkbv0zvlRyUDX+ol46n+7ADwenuGPbDe0jwK9eHWuCL68ksQDVjmzaYUOoK05YoPR4ehpfgW26KB+dv8wWe5yXdRJsU045UaECDync67qkKowKREPEkZN1rJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709082702; c=relaxed/simple; bh=vZThvoMpdMVB0bR3QX6Z7AfXdGCXxCbTtC+Qsih/PaM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W5xRfhp3rcCHtWU5p+cx6q3652hutRzi7P43BXUoQXdVyLK8LGDsdu7BDGB9JXKXMku6CpL916YiNZa5Qx8dBzMxuF1SJ7y3HGouDECugofUgQW1keF25qwLiZM+1zChFk+us4oAWW1Xl+rBEqisddf+40O0l7wnJ5l2jtXT7eU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=JdYfd3We; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JdYfd3We" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1dbae7b8ff2so26218855ad.3 for ; Tue, 27 Feb 2024 17:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709082701; x=1709687501; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JUDXeYcrvidwDBcA1WOXXMMQ4eSI9QRabZdiDLCy8AY=; b=JdYfd3WeVZxkIyt+ITeBN+60LEyPfRqjNA6y+gtQ/NmTNn1Vb4uyKs1tfAnhQ0PA6T 0nxXdvhGA5JJTs/zJDsSHz/b1DGpEx/kaQdiPxbOkHJzKyn5z8c3rVQVDS0GTs05BFSE jsgibS45mE5otCPzWR8uVDipvHuIk6QByW+5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709082701; x=1709687501; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JUDXeYcrvidwDBcA1WOXXMMQ4eSI9QRabZdiDLCy8AY=; b=pq25gqSEMS9ShSxKeZzf6FmRHitwn7MMyMsWNjAIC1bWLxIfCMIPj55Cf0R2n917tk xYYlvUnBGowDy3MsKKkgtb41pCmI5iaVvJGr9WU0/cSsKJHOaGUA/tPya3feAIfw8QpI sgLZ9fQSGqg/EEa5FuMDxYcQbFX+cjlTqQCu286h9p6XuQKQWyCe0HXcWp3xdeDVNS7K 2ldEqdS5CbNXMYZT7fWdZrwOQIjfUlEnX11amXEEMUsWeuFWe8MUUT4dK37a6e85/rgy K3wuco0R2R7HSZe4jFrLKMEzwfQZ0Zb9UOC4inis40wV0VEOKe7Hs2kr8BuSr35ZA3PL M9mw== X-Forwarded-Encrypted: i=1; AJvYcCVy3gSHsBOTVyilDw5eCToDQA06nPCDr9nTCUpZH9uVzktN1MXJN3ZIlj/rXWetRWeH0StkkVFvcuigJAVAwqa4bxJ8z3QoDrxU1FHc X-Gm-Message-State: AOJu0YxOMY8WQ8LV2C7A0th6r+qAYTKYSPuSWSb4Zs8pkQuTiMeJ9v9R ykHfdot9znLvmu+bIUZ4p9ZxpTdOX4cM+yAgz/1fBelSEiIOxJJVyLCTLcsy0A== X-Google-Smtp-Source: AGHT+IE0Z6fIVeriFN1uMUOqrW9/ukSipbQ+YPExtZ1nyKsCKZYK1PuQscgD1Vwgs+5BAfFvhvuBsg== X-Received: by 2002:a17:903:985:b0:1db:c6ff:6648 with SMTP id mb5-20020a170903098500b001dbc6ff6648mr13245620plb.10.1709082700718; Tue, 27 Feb 2024 17:11:40 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:87d1:e95d:b670:4783]) by smtp.gmail.com with ESMTPSA id kl14-20020a170903074e00b001db4b3769f6sm2131529plb.280.2024.02.27.17.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 17:11:40 -0800 (PST) From: Hsin-Yi Wang To: Douglas Anderson Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] drm/panel: panel-edp: Fix AUO 0x405c panel naming and add a variant Date: Tue, 27 Feb 2024 17:06:00 -0800 Message-ID: <20240228011133.1238439-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog In-Reply-To: <20240228011133.1238439-1-hsinyi@chromium.org> References: <20240228011133.1238439-1-hsinyi@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There are 2 different AUO panels using the same panel id. One of the variants requires using overridden modes to resolve glitching issue as described in commit 70e0d5550f5c ("drm/panel-edp: Add auo_b116xa3_mode"). Other variants should use the modes parsed from EDID. Signed-off-by: Hsin-Yi Wang --- v2: new --- drivers/gpu/drm/panel/panel-edp.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/pane= l-edp.c index 72ad552bff24..e39af92342e8 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -1013,6 +1013,19 @@ static const struct panel_desc auo_b101ean01 =3D { }, }; =20 +static const struct drm_display_mode auo_b116xa3_mode =3D { + .clock =3D 70589, + .hdisplay =3D 1366, + .hsync_start =3D 1366 + 40, + .hsync_end =3D 1366 + 40 + 40, + .htotal =3D 1366 + 40 + 40 + 32, + .vdisplay =3D 768, + .vsync_start =3D 768 + 10, + .vsync_end =3D 768 + 10 + 12, + .vtotal =3D 768 + 10 + 12 + 6, + .flags =3D DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + static const struct drm_display_mode auo_b116xak01_mode =3D { .clock =3D 69300, .hdisplay =3D 1366, @@ -1990,7 +2003,9 @@ static const struct edp_panel_entry edp_panels[] =3D { EDP_PANEL_ENTRY('A', 'U', 'O', 0x239b, &delay_200_500_e50, "B116XAN06.1"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x255c, &delay_200_500_e50, "B116XTN02.5"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x403d, &delay_200_500_e50, "B140HAN04.0"), - EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.0= "), + EDP_PANEL_ENTRY('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAN04.0= "), + EDP_PANEL_ENTRY2('A', 'U', 'O', 0x405c, &auo_b116xak01.delay, "B116XAK01.= 0 ", + &auo_b116xa3_mode), EDP_PANEL_ENTRY('A', 'U', 'O', 0x435c, &delay_200_500_e50, "Unknown"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x582d, &delay_200_500_e50, "B133UAN01.0"), EDP_PANEL_ENTRY('A', 'U', 'O', 0x615c, &delay_200_500_e50, "B116XAN06.1"), --=20 2.44.0.rc1.240.g4c46232300-goog