mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hsin-Yi Wang <hsinyi@chromium.org>
To: Douglas Anderson <dianders@chromium.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
	Jessica Zhang <quic_jesszhan@quicinc.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] drm/panel-edp: Avoid adding multiple preferred modes
Date: Mon,  6 Nov 2023 12:22:50 -0800	[thread overview]
Message-ID: <20231106202718.2770821-4-hsinyi@chromium.org> (raw)
In-Reply-To: <20231106202718.2770821-1-hsinyi@chromium.org>

If a non generic edp-panel is under aux-bus, the mode read from edid would
still be selected as preferred and results in multiple preferred modes,
which is ambiguous.

If both hard-coded mode and edid exists, only add mode from hard-coded.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
v2->v3: if hard-coded mode presents, don't add edid mode.
---
 drivers/gpu/drm/panel/panel-edp.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index 0fb439b5efb1..54dbbdf62ec0 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -594,8 +594,20 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 				      p->detected_panel != ERR_PTR(-EINVAL) &&
 				      p->detected_panel->override_edid_mode;
 
-	/* probe EDID if a DDC bus is available */
-	if (p->ddc) {
+	/*
+	 * If both edid and hard-coded modes exists, only add hard-coded modes
+	 * to avoid multiple preferred modes.
+	 */
+	if (p->desc->num_timings || p->desc->num_modes) {
+		/*
+		 * Add hard-coded panel modes. Don't call this if there are no
+		 * timings and no modes (the generic edp-panel case) because it
+		 * will clobber the display_info that was already set by
+		 * drm_add_edid_modes().
+		 */
+		num += panel_edp_get_non_edid_modes(p, connector);
+	} else if (p->ddc) {
+		/* probe EDID if a DDC bus is available */
 		pm_runtime_get_sync(panel->dev);
 
 		if (!p->edid)
@@ -617,14 +629,7 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 		pm_runtime_put_autosuspend(panel->dev);
 	}
 
-	/*
-	 * Add hard-coded panel modes. Don't call this if there are no timings
-	 * and no modes (the generic edp-panel case) because it will clobber
-	 * the display_info that was already set by drm_add_edid_modes().
-	 */
-	if (p->desc->num_timings || p->desc->num_modes)
-		num += panel_edp_get_non_edid_modes(p, connector);
-	else if (!num)
+	if (!num)
 		dev_warn(p->base.dev, "No display modes\n");
 
 	/*
-- 
2.42.0.869.gea05f2083d-goog


  parent reply	other threads:[~2023-11-06 20:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 20:22 [PATCH v3 0/3] Add a few panels and use correct modes Hsin-Yi Wang
2023-11-06 20:22 ` [PATCH v3 1/3] drm/panel-edp: drm/panel-edp: Add several generic edp panels Hsin-Yi Wang
2023-11-06 22:13   ` Dmitry Baryshkov
2023-11-06 20:22 ` [PATCH v3 2/3] drm/panel-edp: Add override_edid_mode quirk for generic edp Hsin-Yi Wang
2023-11-06 20:22 ` Hsin-Yi Wang [this message]
2023-11-06 20:32   ` [PATCH v3 3/3] drm/panel-edp: Avoid adding multiple preferred modes Doug Anderson
2023-11-06 20:38     ` Hsin-Yi Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231106202718.2770821-4-hsinyi@chromium.org \
    --to=hsinyi@chromium.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_jesszhan@quicinc.com \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®