From patchwork Thu Mar 7 22:57:41 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: 13586331 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 4B572C54798 for ; Thu, 7 Mar 2024 23:07:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4958110F1FD; Thu, 7 Mar 2024 23:07:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="S7PaJ6y4"; dkim-atps=neutral Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0793010F1FD for ; Thu, 7 Mar 2024 23:06:58 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1dd68d4cff1so474435ad.2 for ; Thu, 07 Mar 2024 15:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709852818; x=1710457618; 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=wkLCh/y3IjSBIuB7VpYySGCB+kkdSKNkvE8IPrhfDCM=; b=S7PaJ6y43M1S5gIju/BlHrp4/djkWrtLNx6aHXfzK7XQWDQjZTOixB2Qxnm/LzcWmH J8aueoq91MXkYWX897AJqLXql5q0R+gCTUXKZneiV+NJrjVeXVfBhlrCyOOG3uz+tmoT QPnbSO7AeFPjz4jUBBP8BjoZR6LyXkWbB0pzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852818; x=1710457618; 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=wkLCh/y3IjSBIuB7VpYySGCB+kkdSKNkvE8IPrhfDCM=; b=G9jLkeXn4Zq2gWGYnOueXPgf81gNu3KSxso2lNgyGyI2jpCjpRJ4aLQ1CQofwTj4Gh MBoWMvpRr3mGtCp5EBSGBqTkq6g32h7Fwhq7ik16P3D2PS3iopqBLVOITiK3eYGOhegx UvGOcnVzRq23q2//fUcjGAsJ8k+QX/KGdj7U+2ieoQU7IvnjWBA400C1H99PKE5h4BWi mTfaDjnFlPrKEHl+RGPK0WQpt5mz3+OTn88wdh7k2ogdzfeY9pDuO9eFjVOCLR6OrOUE 3ggPO5sPx77NnRaRDZGWs9fmwyymLxuAlpb4yyPD7gsFDJvbqbMTYyvXCvRC8F7KtKGC ojbw== X-Forwarded-Encrypted: i=1; AJvYcCX/+IaB7wsa+c6Xh2BlZJjnx8kq/D+SL3WBrSdTW+MTPeHTFcjpiulrDEEJIUdOYYuxzKtAuPv+1VoR/SNwCvDP7dgZcNekR27tp2gOwOiF X-Gm-Message-State: AOJu0YyvYsk56OmQXwCqEXBEnvfcOXdiOQlkYuEo0eB3Qr9YBHcthPAa cQ/G7kdrw6I7cU9taxxbTF7CfH0iR+UnwQq59MRvCdvCBWUoGfmsi3H+KP2DiQ== X-Google-Smtp-Source: AGHT+IF2gvDVIYxcgS8kfWnjSoptKcy1MM6/6fHNuxZ8umM7rh3jijEYYGJernNayoi6EgPjGatHJw== X-Received: by 2002:a17:902:cf0f:b0:1dc:f157:51ba with SMTP id i15-20020a170902cf0f00b001dcf15751bamr11928254plg.35.1709852818332; Thu, 07 Mar 2024 15:06:58 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:bf8f:10d4:f877:bee3]) by smtp.gmail.com with ESMTPSA id h19-20020a170902f2d300b001db63cfe07dsm15196654plc.283.2024.03.07.15.06.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:06:58 -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 v6 1/5] drm_edid: Add a function to get EDID base block Date: Thu, 7 Mar 2024 14:57:41 -0800 Message-ID: <20240307230653.1807557-2-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240307230653.1807557-1-hsinyi@chromium.org> References: <20240307230653.1807557-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. Merge drm_edid_get_panel_id() and edid_extract_panel_id() into one function. Signed-off-by: Hsin-Yi Wang Reviewed-by: Douglas Anderson Reviewed-by: Jani Nikula --- v5->v6: 1. squash v5 2/6 into this patch. 2. check edid size. --- drivers/gpu/drm/drm_edid.c | 71 ++++++++++++++++++------------- drivers/gpu/drm/panel/panel-edp.c | 8 +++- include/drm/drm_edid.h | 3 +- 3 files changed, 50 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1ad94473e400..284255a0315e 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2743,8 +2743,27 @@ const struct drm_edid *drm_edid_read(struct drm_connector *connector) } EXPORT_SYMBOL(drm_edid_read); -static u32 edid_extract_panel_id(const struct edid *edid) +/** + * drm_edid_get_panel_id - Get a panel's ID from EDID + * @drm_edid: EDID that contains panel ID. + * + * 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. Return 0 if the EDID size is less than a base block. + */ +u32 drm_edid_get_panel_id(const struct drm_edid *drm_edid) { + const struct edid *edid = drm_edid->edid; + + if (drm_edid->size < EDID_LENGTH) + return 0; + /* * We represent the ID as a 32-bit number so it can easily be compared * with "==". @@ -2762,60 +2781,54 @@ static u32 edid_extract_panel_id(const struct edid *edid) (u32)edid->mfg_id[1] << 16 | (u32)EDID_PRODUCT_ID(edid); } +EXPORT_SYMBOL(drm_edid_get_panel_id); /** - * drm_edid_get_panel_id - Get a panel's ID through DDC + * drm_edid_read_base_block - Get a panel's EDID base block * @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 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. + * 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 @@ -2868,7 +2881,7 @@ EXPORT_SYMBOL(drm_edid_duplicate); */ static u32 edid_get_quirks(const struct drm_edid *drm_edid) { - u32 panel_id = edid_extract_panel_id(drm_edid->edid); + u32 panel_id = drm_edid_get_panel_id(drm_edid); const struct edid_quirk *quirk; int i; diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index 3fb5fcd326a4..fe51680feb61 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 70ae6c290bdc..8b233865b085 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -565,7 +565,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 Thu Mar 7 22:57:42 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: 13586335 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 8F0E5C54798 for ; Thu, 7 Mar 2024 23:07:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48F8A10F24D; Thu, 7 Mar 2024 23:07:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Yd8Dbsks"; dkim-atps=neutral Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id E0D4A10F1FD for ; Thu, 7 Mar 2024 23:06:59 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1dc0d11d1b7so13051035ad.2 for ; Thu, 07 Mar 2024 15:06:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709852819; x=1710457619; 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=HYEZNIcMNd/BeaNkmjBMYO1g1hMPvuNRl+gv7+BprBg=; b=Yd8DbsksHAQ9nhWVIH03Wt2WKQghSvL9xYaKqi7Ep+wjuTsI2Ptka1wsCgb92zyLkz X1Tb+MKXQxN5DxnJEx2TwdLAdWTaoTCsi3j4Cn14LO327qBPTNU4qlwOif8zgkDK9qUG Q/gyUz5/03FEAqHA5nors00owQSRzl0DbkB7M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852819; x=1710457619; 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=HYEZNIcMNd/BeaNkmjBMYO1g1hMPvuNRl+gv7+BprBg=; b=M7edkBddwHF0mhi6RgR1EZINfSgXdve8PvlM92F4+exvhg5/NZZL9fzVnaTbE0czFS XqiwHrGHLQKNHS0HetaK6AXLWPwAOCFdxLZrG78nt8eLw2Jgf+Rk40HwKwqEco2jtT/h CandJpmkd3try5PQ5BbsUUuqWxMbglbqqWt1g4B8YxT/fDCDciJTgtQpjitUfluvpoyl 8AxWHEV8PmWywgO6GciL1vtD67R+LSMrGVBw/SQ2cITr/dZXKOROVhlB9sQE31DyLIbo WMfOnGqgK+1xYEn33ar8rb+9PXIkhg/LCuTGjh+rFKAdVhStYyxbo0DI/renXE4Mvsdo IXpw== X-Forwarded-Encrypted: i=1; AJvYcCWGl2yIQquXBCB6cGROBFvvQl4v4ecvAFhjU9EwznSW+tmOFURrvUsOruyLGG6NQCnjuPs0jOrWxvJJeHtheHLB8pvsIHRJh4HcFpliY/2n X-Gm-Message-State: AOJu0YxmcFsqNmYOBQ4IYg1P6IR+GT5jJLS2EdHgV7easjtulVFbdQmZ Wmh1vfNeaWhTuR7W0CZb0zGLabwHH795xkZOLuhL5lUgokyIkL8lI1XmPinaSg== X-Google-Smtp-Source: AGHT+IH4JN/Y0kdeG70rMVv9p/9iS1bg9i0S07bplO9mD21xLH7uN7ZRgi0aG8PNT/zsDNvLmvr2xQ== X-Received: by 2002:a17:902:c146:b0:1dc:b874:583f with SMTP id 6-20020a170902c14600b001dcb874583fmr8850154plj.38.1709852819245; Thu, 07 Mar 2024 15:06:59 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:bf8f:10d4:f877:bee3]) by smtp.gmail.com with ESMTPSA id h19-20020a170902f2d300b001db63cfe07dsm15196654plc.283.2024.03.07.15.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:06:58 -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 v6 2/5] drm/edid: Add a function to match EDID with identity Date: Thu, 7 Mar 2024 14:57:42 -0800 Message-ID: <20240307230653.1807557-3-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240307230653.1807557-1-hsinyi@chromium.org> References: <20240307230653.1807557-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 Reviewed-by: Douglas Anderson Reviewed-by: Jani Nikula --- v5->v6: finalize the trailing white space and/or NUL decision: Allow only white space before \n. --- drivers/gpu/drm/drm_edid.c | 65 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_edid.h | 9 ++++++ 2 files changed, 74 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 284255a0315e..58fe35058181 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -100,6 +100,11 @@ struct detailed_mode_closure { int modes; }; +struct drm_edid_match_closure { + const struct drm_edid_ident *ident; + bool matched; +}; + #define LEVEL_DMT 0 #define LEVEL_GTF 1 #define LEVEL_GTF2 2 @@ -5408,6 +5413,66 @@ 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_match_closure *closure = data; + unsigned int i; + const char *name = closure->ident->name; + unsigned int name_len = strlen(name); + const char *desc = timing->data.other_data.data.str.str; + unsigned int desc_len = ARRAY_SIZE(timing->data.other_data.data.str.str); + + if (name_len > desc_len || + !(is_display_descriptor(timing, EDID_DETAIL_MONITOR_NAME) || + is_display_descriptor(timing, EDID_DETAIL_MONITOR_STRING))) + return; + + if (strncmp(name, desc, name_len)) + return; + + for (i = name_len; i < desc_len; i++) { + if (desc[i] == '\n') + break; + /* Allow white space before EDID string terminator. */ + if (!isspace(desc[i])) + return; + } + + closure->matched = true; +} + +/** + * drm_edid_match - 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(const struct drm_edid *drm_edid, + const struct drm_edid_ident *ident) +{ + if (!drm_edid || drm_edid_get_panel_id(drm_edid) != ident->panel_id) + return false; + + /* Match with name only if it's not NULL. */ + if (ident->name) { + struct drm_edid_match_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); + 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 8b233865b085..5e3fc8c83a31 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -367,6 +367,13 @@ struct edid { u8 checksum; } __attribute__((packed)); +/* EDID matching */ +struct drm_edid_ident { + /* ID encoded by drm_edid_encode_panel_id() */ + u32 panel_id; + const char *name; +}; + #define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) /* Short Audio Descriptor */ @@ -567,6 +574,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(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 Thu Mar 7 22:57:43 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: 13586332 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 40E25C54798 for ; Thu, 7 Mar 2024 23:07:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D851C10F24B; Thu, 7 Mar 2024 23:07:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="M82COFF0"; dkim-atps=neutral Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8203210F243 for ; Thu, 7 Mar 2024 23:07:00 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1dc13fb0133so1576385ad.3 for ; Thu, 07 Mar 2024 15:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709852820; x=1710457620; 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=DhMzn7mAql0qeAQCBndfDWvU8yMf9cLlH/SFDDXTa5Q=; b=M82COFF05/Oc35O+Ux+3bXtC440XUD4qStqAoWqNviPPV2KHR5i6mqkBxW8JTa+rva BqTSbx4gyE0riahD8yiVGD2sNl95UpAcM9mnY1Ld/5Ed9ZWBTSfzsdyn0P/OyNzIxSav R+N72+JSNy8zY8QZqeRcw78rtr0nVlcgOB2/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852820; x=1710457620; 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=DhMzn7mAql0qeAQCBndfDWvU8yMf9cLlH/SFDDXTa5Q=; b=kkumXv17G4G0bb4ra4T6QqqzYRXy7rGJ8jWR+IbQEBPzN5bLHvu9ojvjaDqnZRF/OD koiO0enKOEfIQI64DHtTlfKKjpFmONNASXEDyNtXv6K2Ww8l5G21+Fc8tnRfIzgHvqK6 Bmt5YE862f6GEL0tKeJdOebUDuq9DXPVECcyPNoJF6hDv04oJi/35SKvCYXPnTmDdQpO IDd04f94y9c8k6NRK+K14dtXtmuJtx8ENr83NR8Cs67yhKLwkNq8Nz6MAw3DRORA5Q8x xQ9GIvVNgxsxANrFRTFZJ/XvY963s34yKMzBcsek7bO9XKZ3JgbGZyFqpXfOWLIn6XAA KMOg== X-Forwarded-Encrypted: i=1; AJvYcCULwlZ9r8Zb7m2GzlObq73IejFHPXs9NPDM+DHGXrEvkZC2vPFeYe/WoCdEjMpdWc5L3WXty9OpsmdHkiwKZiRW/vjJXuXJW9cONlNl3s0d X-Gm-Message-State: AOJu0Yzl7WSQoc/3br8ovGAOKysz2bteCqfadfMcj5e0uVvLy650+2wv vHqATJa9F1ciF9yLy0dt72vDCG+fv9TTkvLHgWQ9/XM+w2WYLewizQIpGLChcw== X-Google-Smtp-Source: AGHT+IGM8Dqm/6+6/lxZ8pSJg338UR6F0X81KWVG5uRhl9oNBtnBdU4y50jzsgc9NatZRGXMVzuApQ== X-Received: by 2002:a17:902:e806:b0:1dc:b063:34ac with SMTP id u6-20020a170902e80600b001dcb06334acmr11901220plg.21.1709852820139; Thu, 07 Mar 2024 15:07:00 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:bf8f:10d4:f877:bee3]) by smtp.gmail.com with ESMTPSA id h19-20020a170902f2d300b001db63cfe07dsm15196654plc.283.2024.03.07.15.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:06:59 -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 v6 3/5] drm/edid: Match edid quirks with identity Date: Thu, 7 Mar 2024 14:57:43 -0800 Message-ID: <20240307230653.1807557-4-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240307230653.1807557-1-hsinyi@chromium.org> References: <20240307230653.1807557-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. Signed-off-by: Hsin-Yi Wang Reviewed-by: Jani Nikula Reviewed-by: Douglas Anderson --- 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 58fe35058181..4abc50516cda 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -112,13 +112,15 @@ struct drm_edid_match_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 */ @@ -2883,16 +2885,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 = drm_edid_get_panel_id(drm_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(drm_edid, &quirk->ident)) return quirk->quirks; } From patchwork Thu Mar 7 22:57:44 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: 13586334 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 0AFA0C54E58 for ; Thu, 7 Mar 2024 23:07:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BAD2110F24C; Thu, 7 Mar 2024 23:07:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gcEKu51+"; dkim-atps=neutral Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EAC610F243 for ; Thu, 7 Mar 2024 23:07:01 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dca3951ad9so11785095ad.3 for ; Thu, 07 Mar 2024 15:07:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709852821; x=1710457621; 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=kB/qX4HZuCvCcxbPmER5bpPaaStWtmbIuwHw3vs9CPk=; b=gcEKu51+rSCAv8a6Q7QrOTCZ/+RzPTSSf/O0tq6Dv43M4FzaWD0n3vi3FY899102Wr VXyWXfKdeP7oTXeab6hn9vOUZQClvvHvMa8FmUUzDv27MtlP/rGH0Zb7ZPmOboRebTrc dl5iksDuBbq/kMJ7/m1qLlqehyCOufIp4s5AQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852821; x=1710457621; 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=kB/qX4HZuCvCcxbPmER5bpPaaStWtmbIuwHw3vs9CPk=; b=nCDpSuzkQJNHjnuCoypYbv45pZ7EnzHZyUhO/UVYZ510VDbR5px20cJrafnIWluMqT CWBv9hz3DJMarqFUm0OmMhI7AnYVfQwzWjzIk0T2dOlyzKqKnP1tTz8h3YG9DefHWah4 flkS4xie0FO1IJoSC6ow6T7fG5QeiYfCln3yhJM30Eq/z/cE0o0VwLjYxlBW44FGJGLE TjvESRkoDF8chAzFwE2zMmhwOcJagXuMRjyZmWc21u0Xigy2oWwnfMsFvdqUsVNU4hi9 ZbggsQmgyhlKqfGWePirEVu4tr4PxAAmZ+QacdJNE4twrcyWiN3OwstBP8f8KORr86jb BbKw== X-Forwarded-Encrypted: i=1; AJvYcCUxPGrYt0nXLsFFFa1LQsK90Em5zyjZqnCGOL8fo9cK8hJU2gAcZ5hnWmYcpGr8ZyPLHddNQnLMq2uyDNngj2EBebgF1IIHzPxEqVWmeFJw X-Gm-Message-State: AOJu0Yxp71HnNGlBvG4+iRLP9SJYx8u2Zaf1hrw5DtjpKMhYx9HS/PEN bEnBjR7AOjEyps3pJ1hC118XHJw51umosuYt/qjQ3tfHBJh78ePMvSRq/6UoRg== X-Google-Smtp-Source: AGHT+IEl2SKEsnIe/1ux3kSFRla9XwGixgGKsomT1jpfmaa9qvtDZ24gCTCnu2EwFPABsHHlxklyGg== X-Received: by 2002:a17:902:d58d:b0:1dc:bb8e:d28f with SMTP id k13-20020a170902d58d00b001dcbb8ed28fmr2842865plh.66.1709852821077; Thu, 07 Mar 2024 15:07:01 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:bf8f:10d4:f877:bee3]) by smtp.gmail.com with ESMTPSA id h19-20020a170902f2d300b001db63cfe07dsm15196654plc.283.2024.03.07.15.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:07:00 -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 v6 4/5] drm/panel-edp: Match edp_panels with panel identity Date: Thu, 7 Mar 2024 14:57:44 -0800 Message-ID: <20240307230653.1807557-5-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240307230653.1807557-1-hsinyi@chromium.org> References: <20240307230653.1807557-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 Reviewed-by: Douglas Anderson --- v5->v6: add some comments. --- drivers/gpu/drm/panel/panel-edp.c | 50 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c index fe51680feb61..7f749b17df85 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; @@ -1954,17 +1952,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 \ } @@ -2111,15 +2113,25 @@ 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->panel_id; panel++) - if (panel->panel_id == panel_id) + /* + * Match with identity first. This allows handling the case where + * vendors incorrectly reused the same panel ID for multiple panels that + * need different settings. If there's no match, try again with panel + * ID, which should be unique. + */ + for (panel = edp_panels; panel->ident.panel_id; panel++) + if (drm_edid_match(edid, &panel->ident)) + return panel; + + for (panel = edp_panels; panel->ident.panel_id; panel++) + if (panel->ident.panel_id == panel_id) return panel; return NULL; From patchwork Thu Mar 7 22:57:45 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: 13586333 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 E9783C54798 for ; Thu, 7 Mar 2024 23:07:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08CE310F243; Thu, 7 Mar 2024 23:07:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="JNktelNy"; dkim-atps=neutral Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8072A10F243 for ; Thu, 7 Mar 2024 23:07:02 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1dd6412da28so3978695ad.3 for ; Thu, 07 Mar 2024 15:07:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709852822; x=1710457622; 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=XiUQw1ZTVNc5PMf1jcXsUl5pNMmYncCeRdBmheYnxcM=; b=JNktelNynh1SxTw7m5IKoUTisvgNIU0XNK7tySNGyHVrDV30k3oZNXKecFX/NXyzhs EM4SQXPiWwbpKzb8HF6ITW9so/VO7+KckoTzUVtaRzdh/9ZYdOFzbUJeaS16Ky95WxDX r3nI9Kixx6yfq+4PJRaanR8eMgwbNjaTucLJY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709852822; x=1710457622; 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=XiUQw1ZTVNc5PMf1jcXsUl5pNMmYncCeRdBmheYnxcM=; b=KVJv/EIwOjZfFMLb7AEAnxhNCWnd1fY5aa6gaZ43/Mkjvn4fwzkCPftjJtTZRNePRS EXFE/pLevoytkp9sCZze3RapApexIlDOP9CiZ+fPsqDFH9KHkwwtqdgf0CFoxVrOi3YX FnSgaroRiYoV7DAeUp7BO0usqfhe87ZiKsX5VRgNz9h+9h3ZrreFBYEz+4VGzLIGIhEI KyawZh6m++yMcdhG0tALfJRNzKN6VRNrK0ltSmYQjPlVFtxE0Q+5Dq5P28DF4akKdjy2 T3I7jexiAjk9qOo1eqrMi7FluSCOXWg67DbMU/ICoEiTf4eDtOAXMn2KpaiTGXDmYFoW jveg== X-Forwarded-Encrypted: i=1; AJvYcCUrXpAsFQpySb3We7ZkDVZgKT7vO/a7OMph44DGqn1q/uTuHlr0rBamNpLt3abbNWPeUO4oc8CGP260nmL60UO5wjoU5/ZiS/ZoG/Wp4oI9 X-Gm-Message-State: AOJu0Yy9mzppdScpnCdblJVsErVJkxBmV5hrFgHw34weqiQYvmpKJyHE ViVS4TnyvHG6eGtcTcgKRADhTurukD30SG2rC8GtTOj3mYOeuXpRm3yzaKnNqg== X-Google-Smtp-Source: AGHT+IHoYt0E9CsIcSAwhLVXdVdiYr8vP/Y4N6g58/0g0X9YeIdqoKrM/CVpefcc0EVSlKAUOt/Mmg== X-Received: by 2002:a17:902:f690:b0:1dd:46ca:be1 with SMTP id l16-20020a170902f69000b001dd46ca0be1mr4634856plg.55.1709852821963; Thu, 07 Mar 2024 15:07:01 -0800 (PST) Received: from hsinyi.sjc.corp.google.com ([2620:15c:9d:2:bf8f:10d4:f877:bee3]) by smtp.gmail.com with ESMTPSA id h19-20020a170902f2d300b001db63cfe07dsm15196654plc.283.2024.03.07.15.07.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:07:01 -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 v6 5/5] drm/panel-edp: Fix AUO 0x405c panel naming and add a variant Date: Thu, 7 Mar 2024 14:57:45 -0800 Message-ID: <20240307230653.1807557-6-hsinyi@chromium.org> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240307230653.1807557-1-hsinyi@chromium.org> References: <20240307230653.1807557-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 Reviewed-by: Douglas Anderson --- v5->v6: remove trailing white space. --- 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 7f749b17df85..c7f81dd9023f 100644 --- a/drivers/gpu/drm/panel/panel-edp.c +++ b/drivers/gpu/drm/panel/panel-edp.c @@ -1009,6 +1009,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, @@ -1990,7 +2003,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"),