From patchwork Wed Mar 6 00:34:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13583149 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0A38C54798 for ; Wed, 6 Mar 2024 00:43:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAB7410E75A; Wed, 6 Mar 2024 00:43:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TX6rwnaM"; dkim-atps=neutral Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8325110E75A for ; Wed, 6 Mar 2024 00:43:52 +0000 (UTC) Received: by mail-oi1-f178.google.com with SMTP id 5614622812f47-3c1a2f7e302so3443817b6e.0 for ; Tue, 05 Mar 2024 16:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709685831; x=1710290631; darn=lists.freedesktop.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=MwnVHHF+SAy7EA+lave/HwOmjTm+ySnhWai82DKOimc=; b=TX6rwnaMHkd/TeGRxIF7wwcHi5+Mr19mrlUu2yqmKbi6UagFBGJeB2Rw6VRwZlqzDQ 8dSLhbCW95cnizj7HjbvnJA58P1fZ8aR/F75Y/YszhGsYU5bEFiNNfGYxjp09gWEF36U PCCuusYdUt2HFjudITvNZ708TOM8cKjXzJxOc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709685831; x=1710290631; 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=MwnVHHF+SAy7EA+lave/HwOmjTm+ySnhWai82DKOimc=; b=BpEWptiBlfAKnMy9ul4/XWQ3lQk+hhFFwbg0OFUhA/mwZyUjgs9VPyM7y/jOIndDFd kSfW4p2vzJ9mtngcsDI+NpzYXtBllQIGYEMtqsLrWXymfy7SnQqvJzbQJhN0oSo5KEEL 8Ha/1dqzE5TKXctn0jAXJlx2wIqFtDi92K/ASmc7St3X/Q56ldVqg3QsJ4Wtb85P3/bZ y6w9un1hCt4YV0nIOe+tsoTGfkotBCOx35FLA159TCJyVNSoJrNX6c9vnhT95cbAoJiC 07mtrqaio2ur7VSOnfz/5uT0A+/BZDKPsB2leiwCzngd1ZI0CU1vLdcDubzgjwJfFVdN GRdQ== X-Forwarded-Encrypted: i=1; AJvYcCVEiEVA6+GOENyExtTLL+8PEDXfjF9dowQvc7B8yYme5bWkrWet8BzFtqisOlmfRVi6Bb4lfqPreGcjl3KVmv1ZXslH8t3OizK1tYxfkshx X-Gm-Message-State: AOJu0YwZyDydByaXd/Vw+6ItZ1gZXym1hWLXeUGno34BciFA4XZ4JWIp qazhrzTJz7jMb5MxuPZmEcNEJ9zQw52l6D0jlV+GY2G0P3BNwu4yB7PMDkdAYQ== X-Google-Smtp-Source: AGHT+IEohVRqWaXH8EBXFArEg9r3SrVjJiR1PWflATvQ2Oat0xAfK/zbvZ2qASv1MelHpAUDLJQEZg== X-Received: by 2002:a05:6808:4286:b0:3c1:f46c:d796 with SMTP id dq6-20020a056808428600b003c1f46cd796mr3054966oib.34.1709685831519; Tue, 05 Mar 2024 16:43:51 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:29bc:b3d:1ba8:cf52]) by smtp.gmail.com with ESMTPSA id x37-20020a631725000000b005dc48e56191sm8512885pgl.11.2024.03.05.16.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 16:43:51 -0800 (PST) From: Hsin-Yi Wang To: Jani Nikula , Dmitry Baryshkov , 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 v4 1/5] drm_edid: Add a function to get EDID base block Date: Tue, 5 Mar 2024 16:34:01 -0800 Message-ID: <20240306004347.974304-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240306004347.974304-1-hsinyi@chromium.org> References: <20240306004347.974304-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's found that some panels have variants that they share the same panel id although their EDID and names are different. Besides panel id, now we need more information from the EDID base block to distinguish these panel variants. Add drm_edid_read_base_block() to return the EDID base block, which is wrapped in struct drm_edid. Caller can further use it to get panel id or check if the block contains certain strings, such as panel name. Signed-off-by: Hsin-Yi Wang --- v3->v4: change drm_edid_read_base_block return type to drm_edid. --- drivers/gpu/drm/drm_edid.c | 63 +++++++++++++++++++------------ drivers/gpu/drm/panel/panel-edp.c | 8 +++- include/drm/drm_edid.h | 3 +- 3 files changed, 46 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 923c4423151c..f9e09f327f81 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2770,58 +2770,71 @@ static u32 edid_extract_panel_id(const struct edid *edid) } /** - * drm_edid_get_panel_id - Get a panel's ID through DDC - * @adapter: I2C adapter to use for DDC + * drm_edid_get_panel_id - Get a panel's ID from EDID + * @drm_edid: EDID that contains panel ID. * - * This function reads the first block of the EDID of a panel and (assuming + * This function uses 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 value * (16 bits of manufacturer ID and 16 bits of per-manufacturer ID) that's * supposed to be different for each different modem of panel. * + * Return: A 32-bit ID that should be different for each make/model of panel. + * 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(const struct drm_edid *drm_edid) +{ + return edid_extract_panel_id(drm_edid->edid); +} +EXPORT_SYMBOL(drm_edid_get_panel_id); + +/** + * drm_edid_read_base_block - Get a panel's EDID base block + * @adapter: I2C adapter to use for DDC + * + * This function returns the drm_edid containing the first block of the EDID of + * a panel. + * * This function is intended to be used during early probing on devices where * more than one panel might be present. Because of its intended use it must - * 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). + * assume that the EDID of the panel is correct, at least as far as the base + * block is concerned (in other words, we don't process any overrides here). + * + * Caller should call drm_edid_free() after use. * * 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 panel. - * See the functions drm_edid_encode_panel_id() and - * drm_edid_decode_panel_id() for some details on the structure of this - * ID. + * WARNING: Only use this function when the connector is unknown. For example, + * during the early probe of panel. The EDID read from the function is temporary + * and should be replaced by the full EDID returned from other drm_edid_read. + * + * Return: Pointer to allocated EDID base block, or NULL on any failure. */ - -u32 drm_edid_get_panel_id(struct i2c_adapter *adapter) +const struct drm_edid *drm_edid_read_base_block(struct i2c_adapter *adapter) { enum edid_block_status status; void *base_block; - u32 panel_id = 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 = kzalloc(EDID_LENGTH, GFP_KERNEL); if (!base_block) - return 0; + return NULL; status = 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 = edid_extract_panel_id(base_block); - else + if (!edid_block_status_valid(status, edid_block_tag(base_block))) { edid_block_dump(KERN_NOTICE, base_block, 0); + kfree(base_block); + return NULL; + } - kfree(base_block); - - return panel_id; + return drm_edid_alloc(base_block, EDID_LENGTH); } -EXPORT_SYMBOL(drm_edid_get_panel_id); +EXPORT_SYMBOL(drm_edid_read_base_block); /** * 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/panel-edp.c index 745f3e48f02a..d094cfc43da8 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -766,6 +766,7 @@ static const struct edp_panel_entry *find_edp_panel(u32 panel_id); static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) { struct panel_desc *desc; + const struct drm_edid *base_block; u32 panel_id; char vend[4]; u16 product_id; @@ -795,8 +796,11 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) goto exit; } - panel_id = drm_edid_get_panel_id(panel->ddc); - if (!panel_id) { + base_block = drm_edid_read_base_block(panel->ddc); + if (base_block) { + panel_id = drm_edid_get_panel_id(base_block); + drm_edid_free(base_block); + } else { dev_err(dev, "Couldn't identify panel via EDID\n"); ret = -EIO; goto exit; diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 7923bc00dc7a..9686a7cee6a6 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -410,7 +410,8 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, void *data); struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); -u32 drm_edid_get_panel_id(struct i2c_adapter *adapter); +const struct drm_edid *drm_edid_read_base_block(struct i2c_adapter *adapter); +u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); From patchwork Wed Mar 6 00:34:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13583151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1203CC54E49 for ; Wed, 6 Mar 2024 00:44:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2EBB2112DB9; Wed, 6 Mar 2024 00:43:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="S0DNPZck"; dkim-atps=neutral Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C476112DB5 for ; Wed, 6 Mar 2024 00:43:53 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1dba177c596so2322165ad.0 for ; Tue, 05 Mar 2024 16:43:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709685832; x=1710290632; darn=lists.freedesktop.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=1jdDSZHjVilOHoD9Mz88hwX3pgYSN/T59roGid0+2HE=; b=S0DNPZckMhS3ntWiFqb9CbCH/w6oWBCvTrysIYBle3X9TxDH9utv5Ixiz1jGtwuh1J 8bn4mX3tJFkawKXOE35c/WzdUoIGlZsGzwWipFfOq7daoLmIDTCPSEYjukUQySKKGAKm XieTc6ROrkhwD8D2YbOTB8iauj1CeKlYpby9g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709685832; x=1710290632; 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=1jdDSZHjVilOHoD9Mz88hwX3pgYSN/T59roGid0+2HE=; b=dyzXU7Jw8RuF/Ug+fcE1iZBIQqKk/4PzD8alzZNiaMmbYoK3SiDtQYr9cL3kiQOQSf 22aBimmJffIsESSepPVnR3zvf0bKAWvx2+GIS31W1j8Wy9SJfUX/e84ZD6CacHyIm3sX 5wllJ3YybrB5zCrZPuz6VS0KzIDiTOMzK0eK506itSxfITxJI4NLdV2vPAzKnHOva7ea SnKOcia4Z1K4mKfsBlHJdxzij56bBNsayazmc82tUQI84WeKCmc1ZbR4MhDhLz1uF4Y/ u4Cfoj0Pp9DpGkiRR6qQvHxo6Q4w5WGSeUxJvTXdkCiohNn93UGfPcd4/J8n830aRqB4 QgUQ== X-Forwarded-Encrypted: i=1; AJvYcCU7mBHifxQhcc+sQ7FyLVb9MSjmBGa8cCjyvD9kYMWjY2UVMMg4mlhgSDiF63iVjfWvWDMiX1+NHzFvS5Vg+Y9HGKXHgyXhDM+ZdPo4khDO X-Gm-Message-State: AOJu0YwUvGs9QMmc/15xiaYB34ZdaQZEalDJwo57XlhSKMArr6hKDCGl NFWsZeh3DgufIGrfffg0O4RWEVRSivG/WBwznWMX9+iygJMpvyq3Vd/H5jdnNQ== X-Google-Smtp-Source: AGHT+IHpeCSw6qFXG6z+qH6Amd+u9YxeuylmnfupBVB5t2dOKqVPQdY/9+/kxV/f5BbAsu5vN5zylA== X-Received: by 2002:a17:902:e741:b0:1dc:b7d2:3f28 with SMTP id p1-20020a170902e74100b001dcb7d23f28mr5058993plf.32.1709685832378; Tue, 05 Mar 2024 16:43:52 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:29bc:b3d:1ba8:cf52]) by smtp.gmail.com with ESMTPSA id x37-20020a631725000000b005dc48e56191sm8512885pgl.11.2024.03.05.16.43.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 16:43:52 -0800 (PST) From: Hsin-Yi Wang To: Jani Nikula , Dmitry Baryshkov , 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 v4 2/5] drm/edid: Add a function to match EDID with identity Date: Tue, 5 Mar 2024 16:34:02 -0800 Message-ID: <20240306004347.974304-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240306004347.974304-1-hsinyi@chromium.org> References: <20240306004347.974304-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Create a type drm_edid_ident as the identity of an EDID. Currently it contains panel id and monitor name. Create a function that can match a given EDID and an identity: 1. Reject if the panel id doesn't match. 2. If name is not null in identity, try to match it in the detailed timing blocks. Note that some panel vendors put the monitor name after EDID_DETAIL_MONITOR_STRING. Signed-off-by: Hsin-Yi Wang --- v3->v4: 1. add a type drm_edid_ident 2. match name -> match identity. Modify function to use edid iterators. --- drivers/gpu/drm/drm_edid.c | 76 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_edid.h | 8 ++++ 2 files changed, 84 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index f9e09f327f81..5e7e69e0e345 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -102,6 +102,11 @@ struct detailed_mode_closure { int modes; }; +struct drm_edid_ident_closure { + const struct drm_edid_ident *ident; + bool matched; +}; + #define LEVEL_DMT 0 #define LEVEL_GTF 1 #define LEVEL_GTF2 2 @@ -5455,6 +5460,77 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db) connector->audio_latency[0], connector->audio_latency[1]); } +static void +match_identity(const struct detailed_timing *timing, void *data) +{ + struct drm_edid_ident_closure *closure = data; + unsigned int i, j; + const char *str = closure->ident->name; + unsigned int buflen = strlen(str); + unsigned int size = ARRAY_SIZE(timing->data.other_data.data.str.str); + + if (buflen > size || + !(is_display_descriptor(timing, EDID_DETAIL_MONITOR_NAME) || + is_display_descriptor(timing, EDID_DETAIL_MONITOR_STRING))) + return; + + for (i = 0; i < buflen; i++) { + char c = timing->data.other_data.data.str.str[i]; + + if (c != str[i] || c == '\n') + break; + } + + if (i == buflen) { + /* Allow trailing white spaces. */ + for (j = i; j < size; j++) { + char c = timing->data.other_data.data.str.str[j]; + + if (c == '\n') { + closure->matched = true; + return; + } else if (c != ' ') { + break; + } + } + if (j == size) { + closure->matched = true; + return; + } + } +} + +/** + * drm_edid_match_identity - match drm_edid with given identity + * @drm_edid: EDID + * @ident: the EDID identity to match with + * + * Check if the EDID matches with the given identity. + * + * Return: True if the given identity matched with EDID, false otherwise. + */ +bool drm_edid_match_identity(const struct drm_edid *drm_edid, + const struct drm_edid_ident *ident) +{ + if (!drm_edid || edid_extract_panel_id(drm_edid->edid) != ident->panel_id) + return false; + + /* Match with name only if it's not NULL. */ + if (ident->name) { + struct drm_edid_ident_closure closure = { + .ident = ident, + .matched = false, + }; + + drm_for_each_detailed_block(drm_edid, match_identity, &closure); + + return closure.matched; + } + + return true; +} +EXPORT_SYMBOL(drm_edid_match_identity); + static void monitor_name(const struct detailed_timing *timing, void *data) { diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 9686a7cee6a6..01825a8954b6 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -312,6 +312,12 @@ struct edid { u8 checksum; } __packed; +/* EDID matching */ +struct drm_edid_ident { + u32 panel_id; + const char *name; +}; + #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) /* Short Audio Descriptor */ @@ -412,6 +418,8 @@ struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); const struct drm_edid *drm_edid_read_base_block(struct i2c_adapter *adapter); u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid); +bool drm_edid_match_identity(const struct drm_edid *drm_edid, + const struct drm_edid_ident *ident); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); From patchwork Wed Mar 6 00:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13583153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2D3EC54E55 for ; Wed, 6 Mar 2024 00:44:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9377A112DBB; Wed, 6 Mar 2024 00:43:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="A+Kf81BE"; dkim-atps=neutral Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by gabe.freedesktop.org (Postfix) with ESMTPS id 562DE112DB5 for ; Wed, 6 Mar 2024 00:43:54 +0000 (UTC) Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3c1f55ba3ecso1336000b6e.3 for ; Tue, 05 Mar 2024 16:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709685833; x=1710290633; darn=lists.freedesktop.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=EmN32yDBtw8o7MT20mOBDUzK3nXP1eK8tU0sZE85v7Q=; b=A+Kf81BE8eKnfjNwupFX67z9nbGqtS99BrWV7y4kI6IeBmCkrJdbbt5C77uO3K2+18 GXIErd9zO8baCH5Ur/3S1IdlAcRHmU2c5D1wOxyMkMmLQcms9csnMbx0xajks1OB88Ah Z1A+C9uw2GilREONy+thv+6M/Qv3q+Yz2vDAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709685833; x=1710290633; 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=EmN32yDBtw8o7MT20mOBDUzK3nXP1eK8tU0sZE85v7Q=; b=BGgOMmxS260caQhFKBfvWeRqHmfS+wxWoS1wE9/0PIcSJgxEq5WjSUumsRRCPkZL59 4QFTkHHC5MLHxfKCGzGJYyDWcjumFaY06AmvTmq0s9v56ohz8RP+XYZOt3gJKpRSRzdM 5m48BENHCIKfWgATDhnhcYMbP4YSW0Um2h+ir9981zQcmyCIk9E7DrQBExN0DZ8zazry DYQUwCjX2IBcGk30ggicUr+lfbGo1Fso6mvvB+D4VKO+E/IURjesnm7XAv8aebCXRqRF I6dEAix/hmWC6fa92I7NucGLxBQvfq1oiMRvQb7KEFH4BUG/sAWGG5HN9kOXZ7kPwwtA iRSw== X-Forwarded-Encrypted: i=1; AJvYcCXri/yuFs7vOCL9KT6UEkfkk3OO2VP/hgfSW0q3CJwq7cyOqKLGr0ptGvpYGU/tBeJ2jNYbhQPHR99WuaKQYItvSQR4G5hTIivYWn7QsPHh X-Gm-Message-State: AOJu0YwryebU0lewkPw6U4mNbztUobFq8nH8TJpFwnoXpRy8Ug7vkjQ/ HBfO6aOjnIH62oZRoO4NwLSi7IoTqwUN2B1vYwmxTMF34Md8+vhuAJCgvs+LHg== X-Google-Smtp-Source: AGHT+IF9JDWMnbkfo7qAITIq4vU3d+C8vqidkBtNkEVN4h5JsUh1v6Vd9HjSE/5hv0doQQPhuxukSg== X-Received: by 2002:a05:6808:610:b0:3c2:1ab4:3323 with SMTP id y16-20020a056808061000b003c21ab43323mr472567oih.51.1709685833369; Tue, 05 Mar 2024 16:43:53 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:29bc:b3d:1ba8:cf52]) by smtp.gmail.com with ESMTPSA id x37-20020a631725000000b005dc48e56191sm8512885pgl.11.2024.03.05.16.43.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 16:43:53 -0800 (PST) From: Hsin-Yi Wang To: Jani Nikula , Dmitry Baryshkov , 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 v4 3/5] drm/edid: Match edid quirks with identity Date: Tue, 5 Mar 2024 16:34:03 -0800 Message-ID: <20240306004347.974304-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240306004347.974304-1-hsinyi@chromium.org> References: <20240306004347.974304-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently edid quirks are matched by panel id only. Modify it to match with identity so it's easier to be extended for more complex matching if required. Suggested-by: Jani Nikula Signed-off-by: Hsin-Yi Wang Reviewed-by: Jani Nikula --- v4: new Per discussion https://lore.kernel.org/lkml/87a5nd4tsg.fsf@intel.com/ --- drivers/gpu/drm/drm_edid.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 5e7e69e0e345..93a49b262dbe 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -114,13 +114,15 @@ struct drm_edid_ident_closure { #define EDID_QUIRK(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _quirks) \ { \ - .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ - product_id), \ + .ident = { \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, \ + vend_chr_2, product_id), \ + }, \ .quirks = _quirks \ } static const struct edid_quirk { - u32 panel_id; + const struct drm_edid_ident ident; u32 quirks; } edid_quirk_list[] = { /* Acer AL1706 */ @@ -2921,16 +2923,17 @@ EXPORT_SYMBOL(drm_edid_duplicate); * @drm_edid: EDID to process * * This tells subsequent routines what fixes they need to apply. + * + * Return: A u32 represents the quirks to apply. */ static u32 edid_get_quirks(const struct drm_edid *drm_edid) { - u32 panel_id = edid_extract_panel_id(drm_edid->edid); const struct edid_quirk *quirk; int i; for (i = 0; i < ARRAY_SIZE(edid_quirk_list); i++) { quirk = &edid_quirk_list[i]; - if (quirk->panel_id == panel_id) + if (drm_edid_match_identity(drm_edid, &quirk->ident)) return quirk->quirks; } From patchwork Wed Mar 6 00:34:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13583154 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A7CEC54E49 for ; Wed, 6 Mar 2024 00:44:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 46C35112DB8; Wed, 6 Mar 2024 00:43:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ZCYTmcM6"; dkim-atps=neutral Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 059AB112DB6 for ; Wed, 6 Mar 2024 00:43:55 +0000 (UTC) Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3c1c3ab19c3so3059028b6e.1 for ; Tue, 05 Mar 2024 16:43:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709685834; x=1710290634; darn=lists.freedesktop.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=j07CQ2B9VSDqAzaDJZq3q/Yl1tEHZa3IBFEiQqTUDBc=; b=ZCYTmcM6FQxqc2E6rSjLmeGlxaEpO+6X9jE/Q/DpD/7vsrwQUTWEPHw7PIBrCkk8sW z21ByUCGWu2rIfJ6YS5/siH7F+1CAx1h/StZBRsN4iGt9+XZ/VRmUwFfTMuU9g/48mdt iWVLXv4nnta4YihRiuwInb0ujBoTP8UPNS4gE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709685834; x=1710290634; 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=j07CQ2B9VSDqAzaDJZq3q/Yl1tEHZa3IBFEiQqTUDBc=; b=XtbdfzTia7vona7gZg2D3fzqp0tk3+zQkQWvqQoLFM3buns4vdxRH+sU7pZsyycZvr E9/UNht6VHVpKPjPEi6GpSh1gI4URumWyCBFWBuIU4Ddqi1lrfjIiJUEaYCW+b/JmpjK 9ojk+49ZBJdku/XEVIKXzAuHDbcugTG12N/dUIXWf1Y6vAZoYr+sPLfdDFrmVhGxcnKd IjV14VMVtLt93U69XKrOJtt21LnTK+7A7GZOVm3/HmV2WTS+NnahgumuRjo+OxFPhEEm deIxxmWHOedWgi58uk9Bs0yiGtxKEEo82S4f/SQdCqmbgWJM4iXlcTZuUBPFqrMH4W+B k8wA== X-Forwarded-Encrypted: i=1; AJvYcCUhSigtPqrVKxLRszGZSz5jaijfV3jSELKvn/kW6WUnU0q5d988rhRrx0eMzEIqTluTwAY49IzW92XjJW5E3690GUqNec9EBTIsu/6WUggz X-Gm-Message-State: AOJu0YyE2tzqi1Kj4XTmQMsM+fwavpsbdHZJZyWpYPf7ZwgKxCa0wIOb +VQCEhwiTaZ/FC6NtGbb0zRRB2mSqQvFvYjlUy8ypmRnr5Ho/ge/AN+L2uQppA== X-Google-Smtp-Source: AGHT+IGVnGKEsExHxbPRiJmGh3KBiVOW4N6JErxuzUZyiTZ6ITHKHl+QpRGST85Fo1jkHYkBxJWVAg== X-Received: by 2002:aca:1208:0:b0:3c1:ea81:64e9 with SMTP id 8-20020aca1208000000b003c1ea8164e9mr3292594ois.44.1709685834206; Tue, 05 Mar 2024 16:43:54 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:29bc:b3d:1ba8:cf52]) by smtp.gmail.com with ESMTPSA id x37-20020a631725000000b005dc48e56191sm8512885pgl.11.2024.03.05.16.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 16:43:54 -0800 (PST) From: Hsin-Yi Wang To: Jani Nikula , Dmitry Baryshkov , 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 v4 4/5] drm/panel-edp: Match edp_panels with panel identity Date: Tue, 5 Mar 2024 16:34:04 -0800 Message-ID: <20240306004347.974304-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240306004347.974304-1-hsinyi@chromium.org> References: <20240306004347.974304-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 identity, which contains both panel id and panel name. If not found, match with panel id only. Signed-off-by: Hsin-Yi Wang --- v3->v4: combine name and id to identity. --- drivers/gpu/drm/panel/panel-edp.c | 45 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index d094cfc43da8..fb70e97a2e71 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -210,15 +210,12 @@ struct panel_desc { * struct edp_panel_entry - Maps panel ID to delay / panel name. */ struct edp_panel_entry { - /** @panel_id: 32-bit ID for panel, encoded with drm_edid_encode_panel_id(). */ - u32 panel_id; + /** @ident: edid identity used for panel matching. */ + const struct drm_edid_ident ident; /** @delay: The power sequencing delays needed for this panel. */ const struct panel_delay *delay; - /** @name: Name of this panel (for printing to logs). */ - const char *name; - /** @override_edid_mode: Override the mode obtained by edid. */ const struct drm_display_mode *override_edid_mode; }; @@ -691,7 +688,7 @@ static int detected_panel_show(struct seq_file *s, void *data) else if (!p->detected_panel) seq_puts(s, "HARDCODED\n"); else - seq_printf(s, "%s\n", p->detected_panel->name); + seq_printf(s, "%s\n", p->detected_panel->ident.name); return 0; } @@ -761,7 +758,7 @@ static void panel_edp_parse_panel_timing_node(struct device *dev, dev_err(dev, "Reject override mode: No display_timing found\n"); } -static const struct edp_panel_entry *find_edp_panel(u32 panel_id); +static const struct edp_panel_entry *find_edp_panel(u32 panel_id, const struct drm_edid *edid); static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) { @@ -799,7 +796,6 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) base_block = drm_edid_read_base_block(panel->ddc); if (base_block) { panel_id = drm_edid_get_panel_id(base_block); - drm_edid_free(base_block); } else { dev_err(dev, "Couldn't identify panel via EDID\n"); ret = -EIO; @@ -807,7 +803,9 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) } drm_edid_decode_panel_id(panel_id, vend, &product_id); - panel->detected_panel = find_edp_panel(panel_id); + panel->detected_panel = find_edp_panel(panel_id, base_block); + + drm_edid_free(base_block); /* * We're using non-optimized timings and want it really obvious that @@ -840,7 +838,7 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) panel->detected_panel = ERR_PTR(-EINVAL); } else { dev_info(dev, "Detected %s %s (%#06x)\n", - vend, panel->detected_panel->name, product_id); + vend, panel->detected_panel->ident.name, product_id); /* Update the delay; everything else comes from EDID */ desc->delay = *panel->detected_panel->delay; @@ -1930,17 +1928,21 @@ static const struct panel_delay delay_200_500_e50_po2e200 = { #define EDP_PANEL_ENTRY(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name) \ { \ - .name = _name, \ - .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ - product_id), \ + .ident = { \ + .name = _name, \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ + product_id), \ + }, \ .delay = _delay \ } #define EDP_PANEL_ENTRY2(vend_chr_0, vend_chr_1, vend_chr_2, product_id, _delay, _name, _mode) \ { \ - .name = _name, \ - .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ - product_id), \ + .ident = { \ + .name = _name, \ + .panel_id = drm_edid_encode_panel_id(vend_chr_0, vend_chr_1, vend_chr_2, \ + product_id), \ + }, \ .delay = _delay, \ .override_edid_mode = _mode \ } @@ -2087,15 +2089,16 @@ static const struct edp_panel_entry edp_panels[] = { { /* sentinal */ } }; -static const struct edp_panel_entry *find_edp_panel(u32 panel_id) +static const struct edp_panel_entry *find_edp_panel(u32 panel_id, const struct drm_edid *edid) { const struct edp_panel_entry *panel; - if (!panel_id) - return NULL; + for (panel = edp_panels; panel->ident.panel_id; panel++) + if (drm_edid_match_identity(edid, &panel->ident)) + return panel; - for (panel = edp_panels; panel->panel_id; panel++) - if (panel->panel_id == panel_id) + for (panel = edp_panels; panel->ident.panel_id; panel++) + if (panel->ident.panel_id == panel_id) return panel; return NULL; From patchwork Wed Mar 6 00:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 13583152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2945C54798 for ; Wed, 6 Mar 2024 00:44:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 904F1112DBA; Wed, 6 Mar 2024 00:43:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AcSBmxMD"; dkim-atps=neutral Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1AD0D112DB8 for ; Wed, 6 Mar 2024 00:43:56 +0000 (UTC) Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c1e992f069so155086b6e.3 for ; Tue, 05 Mar 2024 16:43:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709685835; x=1710290635; darn=lists.freedesktop.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=hYTrgZgcMnGwzTHQ0raTPV6Zr3av/0t0vLxqDGbq+dE=; b=AcSBmxMDaXurmheF3r7JDPq/HzAfjUeXjQy3hn9fZ53xqK66aM9jsdXzpN+vdJJqmp 82S+hQ4+8ujC3t4AGL+A4DETgkpRyHgk8VPjZZBp1FkY/mzBQXOPlJnBrzL7bwXgCy/K Xjib+A1uzoXnfGD0s1ZSn1xxPUT2FNjmcTjwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709685835; x=1710290635; 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=hYTrgZgcMnGwzTHQ0raTPV6Zr3av/0t0vLxqDGbq+dE=; b=g1ooX0tJJwqgDEPZv1dkp0SlYGD+UhQWtGB+wDv7YJKt76k0gnqJKgWVXvrMr4u7JQ w2PUT8ffiWr++0OahpEn6V+MFAkVptQz8nU9AFIpV+gKkbLteCmBSNo7CRNtuyxmob4g qjV6IMFF5Z3w9sUUhd9wVRuTlC6dtaXxuGpJsodcd2A3bAVLYs59NV3ltq3KHpRDpesO FILuvQLEJ9tvUAmiVBFGuAdbPb2vIQw0KVkQRqQeOKoiwqnmpwT+ZdsBjaTPDvruUkxn FQVWdr7yBZ92WlG7KnA8Z7FZHqnP67TF68Yts0sSoTLwMMF6F1/5IP0i6ZXJi6b7+y0r 26CQ== X-Forwarded-Encrypted: i=1; AJvYcCVt70v6d11/+Tp7d+oEgVFT7QDUmUmmFHkUi5w7Ag1PFinMpdIskljbpiPIb3v6Ua3QmQuTY3J+/P3B8eKZv7xwg3UCFXdSo/rSpCbF4J3Q X-Gm-Message-State: AOJu0YyfqUDyZ1HS8PTBH5sTtUWGkIIkS4aR3GCEiNutDbmxCfQ+xn2g A6YStnwbYxWWT/H7Y3XktkOVYrCFotAm5zWISc9F/ocVsW0ZZ1JIAMBC2cpAxg== X-Google-Smtp-Source: AGHT+IEnBwCzfwvZftrY1cUSm8yx44TS6umhWaiFT1TsIPhxo+eKQUM29yFatyjGk7F35NHZ6+gzsQ== X-Received: by 2002:a05:6808:9b0:b0:3c1:db6b:aa7c with SMTP id e16-20020a05680809b000b003c1db6baa7cmr3045373oig.1.1709685835241; Tue, 05 Mar 2024 16:43:55 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:29bc:b3d:1ba8:cf52]) by smtp.gmail.com with ESMTPSA id x37-20020a631725000000b005dc48e56191sm8512885pgl.11.2024.03.05.16.43.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 16:43:54 -0800 (PST) From: Hsin-Yi Wang To: Jani Nikula , Dmitry Baryshkov , 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 v4 5/5] drm/panel-edp: Fix AUO 0x405c panel naming and add a variant Date: Tue, 5 Mar 2024 16:34:05 -0800 Message-ID: <20240306004347.974304-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240306004347.974304-1-hsinyi@chromium.org> References: <20240306004347.974304-1-hsinyi@chromium.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- v4->v5: no change --- 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/panel-edp.c index fb70e97a2e71..9db04457fb4d 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -1007,6 +1007,19 @@ static const struct panel_desc auo_b101ean01 = { }, }; +static const struct drm_display_mode auo_b116xa3_mode = { + .clock = 70589, + .hdisplay = 1366, + .hsync_start = 1366 + 40, + .hsync_end = 1366 + 40 + 40, + .htotal = 1366 + 40 + 40 + 32, + .vdisplay = 768, + .vsync_start = 768 + 10, + .vsync_end = 768 + 10 + 12, + .vtotal = 768 + 10 + 12 + 6, + .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC, +}; + static const struct drm_display_mode auo_b116xak01_mode = { .clock = 69300, .hdisplay = 1366, @@ -1966,7 +1979,9 @@ static const struct edp_panel_entry edp_panels[] = { 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"),