[PATCH v2 4/4] drm/panel-edp: Choose correct preferred mode

Hsin-Yi Wang posted 4 patches 2 years, 1 month ago
Only 3 patches received!
There is a newer version of this series
[PATCH v2 4/4] drm/panel-edp: Choose correct preferred mode
Posted by Hsin-Yi Wang 2 years, 1 month ago
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 a hard-coded mode is present, unset the preferred bit of the modes read
from edid.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
v1->v2: split patches from drm_modes.
---
 drivers/gpu/drm/panel/panel-edp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-edp.c b/drivers/gpu/drm/panel/panel-edp.c
index 0fb439b5efb1..021322ff9f65 100644
--- a/drivers/gpu/drm/panel/panel-edp.c
+++ b/drivers/gpu/drm/panel/panel-edp.c
@@ -622,10 +622,13 @@ static int panel_edp_get_modes(struct drm_panel *panel,
 	 * 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)
+	if (p->desc->num_timings || p->desc->num_modes) {
+		/* hard-coded modes present, unset preferred modes from edid. */
+		drm_mode_unset_preferred_modes(connector);
 		num += panel_edp_get_non_edid_modes(p, connector);
-	else if (!num)
+	} else if (!num) {
 		dev_warn(p->base.dev, "No display modes\n");
+	}
 
 	/*
 	 * TODO: Remove once all drm drivers call
-- 
2.42.0.869.gea05f2083d-goog
Re: [PATCH v2 4/4] drm/panel-edp: Choose correct preferred mode
Posted by Doug Anderson 2 years, 1 month ago
Hi,

On Thu, Nov 2, 2023 at 3:13 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
>
> 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 a hard-coded mode is present, unset the preferred bit of the modes read
> from edid.
>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> v1->v2: split patches from drm_modes.
> ---
>  drivers/gpu/drm/panel/panel-edp.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

Do you think this should have a "Fixes?" As per discussion on V1 [1],
this has probably been a bit broken from the beginning, though I guess
it only became a big deal after the AUX bus made it so that the panel
driver commonly had the EDID...

[1] https://lore.kernel.org/r/CAD=FV=WHzCdiYumsxUm_am+ALqq9SOOrjf=JYHqJuiKFB+Dnsw@mail.gmail.com
Re: [PATCH v2 4/4] drm/panel-edp: Choose correct preferred mode
Posted by Hsin-Yi Wang 2 years, 1 month ago
On Fri, Nov 3, 2023 at 9:03 AM Doug Anderson <dianders@chromium.org> wrote:
>
> Hi,
>
> On Thu, Nov 2, 2023 at 3:13 PM Hsin-Yi Wang <hsinyi@chromium.org> wrote:
> >
> > 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 a hard-coded mode is present, unset the preferred bit of the modes read
> > from edid.
> >
> > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > ---
> > v1->v2: split patches from drm_modes.
> > ---
> >  drivers/gpu/drm/panel/panel-edp.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>
> Do you think this should have a "Fixes?" As per discussion on V1 [1],
> this has probably been a bit broken from the beginning, though I guess
> it only became a big deal after the AUX bus made it so that the panel
> driver commonly had the EDID...
>
If this patch needs to apply Fixes, then the previous patch might also have to?

Fixes: 280921de7241 ("drm/panel: Add simple panel support")


> [1] https://lore.kernel.org/r/CAD=FV=WHzCdiYumsxUm_am+ALqq9SOOrjf=JYHqJuiKFB+Dnsw@mail.gmail.com