Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp947024lqs; Wed, 6 Mar 2024 01:24:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXpg5qh1qMWv1hYQKNWjI9kUyvkwwzH4J0QnDB3aEbNxTugqBIo8Ide1JuPNn02Kldw+jYKVOPIz9vh8kw2EUJXRaV7tgoWNByEuqDAFw== X-Google-Smtp-Source: AGHT+IEcnN4BnLXQlKnDKl/MG8nWah0P4cjHaXtfpiWUnMB5F+3IeLFWT46UmYAhmsA+CQy3Jnbm X-Received: by 2002:a50:9558:0:b0:566:47ef:29f with SMTP id v24-20020a509558000000b0056647ef029fmr9896882eda.38.1709717040792; Wed, 06 Mar 2024 01:24:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709717040; cv=pass; d=google.com; s=arc-20160816; b=ZWW5kAgTGQM6nDzMEh5HSnYfEAAeVQsso1GMc6sJr+NjxB9FQiOcTNl15Ff4aBfU5c cQy2KSjUzwBViI5uxRT8Up2n6P3Tih+BhhURVPFeGefqJxD0MPp04/hgNR+qY831/B2V 7uCknW48j3o/iTFOuDpDipDDrSBgUHoBCgEOwhUTAj9NUihHFQeyTFCFijzsg/AbRE+h gIK94aQYXOyhhrAmMyFW5HIRXRom+kZsSQRlXOSp4dAHWSeH7ZG0wp3/pV847T+tujR4 0LQzyeAmSg5NC9cQLuiRn4ohaXSp2gf0k+qFXISccluZ45hgksFX0ZrqgD1MdNuUJ7wc mqbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:organization:in-reply-to:subject:cc:to :from:dkim-signature; bh=dYWPY+2Dv11iAQD3yL+Qz5hhK+KrdnTiqjNECgHJr/Q=; fh=j8R91R4C7W09DW0hqt3DCC2LgtHqu3BkVbedLMzUihg=; b=Pr333JVnK4q6SXrWRs2WnGx9j9GAvySco1ur0cEhoAAnGoWJ3ivPX3Q5M1ArCXzPOL mMRtw5CBhYO7pj/u+Zvukubupj69K9WHW4Dm1pY8vleLNmOyv2E6WDiD1L2/f4SY/Lir EVLhOX5JKWwSqELCcpva1w1YG+XDBxAVrEqTPOp9QhlqmhdNFmexVdf230DPZ0aE+SRI QQ8j9TycPfxTQi6fFSG9pZj8MDilY25CZfUjctw25HS6RJ3jBUufOVMlRyp+FNEL96V1 yZrP1CLgXZtN1u8RjZD+KN0f03nA+IW1Y8p1o8v4MP7kz7Jq/XbqYQHb4ECWyz7qUZ22 rHWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zhv+RRBJ; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-93622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r18-20020a056402235200b005675e7951e8si2549233eda.157.2024.03.06.01.24.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 01:24:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Zhv+RRBJ; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-93622-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93622-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5AB121F233AE for ; Wed, 6 Mar 2024 09:24:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC5C85DF30; Wed, 6 Mar 2024 09:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Zhv+RRBJ" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE7EE5DF16 for ; Wed, 6 Mar 2024 09:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709717028; cv=none; b=UEZfmBxfEH8PBC0+FRi8lR4+vKB3FBbnGD08eNiDuoo4zFVyZjS36k/n4NvrvOLC1b4ckGvj33atF9k8BQlw67xwRSeq7ndMAwQZKRWogoIkcO6maElFF5x8BRDTHprNNe9759uEUWZJumFtr3Eo4ulmS3XN/noeYrZBjetEsgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709717028; c=relaxed/simple; bh=8azOrkKOqGN52FwT3QPVf8+BwT58YaCcbX8PIF4gYek=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=IAFgCN7HLiTVEgr1yegXSQFFyZoJxxxy7y0R3feoQ8PemSc551oAngvOGZVuDQpHw55RrqPQ5cmqhdnqCJqZHY+QAIo5zRKyDqHnYipOJo66zpZLdlgaNtOu6MKtRoLdtveBfx38vrv3hn2vBRuhu4Fo0TkN2yMj1ERaZkt0mF4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Zhv+RRBJ; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709717028; x=1741253028; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=8azOrkKOqGN52FwT3QPVf8+BwT58YaCcbX8PIF4gYek=; b=Zhv+RRBJ++jFZCskWTbxZGrjbVFzJg05q/jXT0l0ZdFMkMO3U+h3P2XX 1YIGL2HL+pJ6U2RlqhtQlrAiZ8fDEl4kQGSz4MpACDiQX97sw3mrvFssD NGAVUkL0tetdVkX/SKm/Er+juVq0eV/ps34ko3wxsYaoemV+n/V0zgkx7 azBcAaeBJTtY5fhvjfEXHtZbwpqaE9QNTn1gjFpM9rCwAM+2UxMKMHRJu sc4QokcQ0Ng02Fc/62FUgXMovMzc3wuV1dkxmNFVTuWUdL+FaGyASMy80 oPkqOCQkabBqVYUnfvyuCb20le1a34aKuTb/L4tZc9ZN1RtcMwZWaGSuY g==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="8135416" X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="8135416" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 01:23:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="9635982" Received: from rjongalo-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.33.211]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 01:23:41 -0800 From: Jani Nikula To: Hsin-Yi Wang , 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: Re: [PATCH v4 4/5] drm/panel-edp: Match edp_panels with panel identity In-Reply-To: <20240306004347.974304-5-hsinyi@chromium.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20240306004347.974304-1-hsinyi@chromium.org> <20240306004347.974304-5-hsinyi@chromium.org> Date: Wed, 06 Mar 2024 11:23:37 +0200 Message-ID: <87msrbzpba.fsf@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Tue, 05 Mar 2024, Hsin-Yi Wang wrote: > 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. Do you want to start matching also with name, for all panels? That's totally up to you, but that's the big functional change here. BR, Jani. > > 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; -- Jani Nikula, Intel