dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>,
	kbuild test robot <lkp@intel.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Peter Senna Tschudin <peter.senna@gmail.com>,
	dri-devel@lists.freedesktop.org,
	Andrzej Hajda <a.hajda@samsung.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Thierry Reding <thierry.reding@gmail.com>,
	Martyn Welch <martyn.welch@collabora.co.uk>
Subject: Re: [PATCH] drm/panel: panel-simple: validate panel description
Date: Sun, 12 Jul 2020 12:58:19 +0200	[thread overview]
Message-ID: <20200712105819.GA1079176@ravnborg.org> (raw)
In-Reply-To: <20200711225616.GF5954@pendragon.ideasonboard.com>

Hi Laurent.

On Sun, Jul 12, 2020 at 01:56:16AM +0300, Laurent Pinchart wrote:
> Hi Sam,
> 
> (CC'ing Daniel)
> 
> Thank you for the patch.
> 
> On Sat, Jul 11, 2020 at 11:47:26AM +0200, Sam Ravnborg wrote:
> > Warn is we detect a panel with missing descriptions.
> 
> s/is/if/
> 
> > This is inpsired by a similar patch by Laurent that introduced checks
> > for LVDS panels - this extends the checks to the reminaing type of
> 
> s/reminaing type/remaining types/
> 
> > connectors.
> > 
> > This is known to fail for some of the existing panels but added
> > despite this as we need help from people using the panels to
> > add the missing info.
> > The checks are not complete but will catch the most common mistakes.
> > The checks at the same time serves as documentation for the minimum
> > required description for a panel.
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > ---
> > 
> > This is my attempt on the validation described in the previous mail.
> > The assignment of default connector_type will then be a follow-up patch
> > to this.
> > 
> > 	Sam
> > 
> >  drivers/gpu/drm/panel/panel-simple.c | 32 ++++++++++++++++++++++++++--
> >  1 file changed, 30 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> > index 2aff93accad5..025a7ccdfcb3 100644
> > --- a/drivers/gpu/drm/panel/panel-simple.c
> > +++ b/drivers/gpu/drm/panel/panel-simple.c
> > @@ -549,8 +549,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> >  			panel_simple_parse_panel_timing_node(dev, panel, &dt);
> >  	}
> >  
> > -	if (desc->connector_type == DRM_MODE_CONNECTOR_LVDS) {
> > -		/* Catch common mistakes for LVDS panels. */
> > +	/* Catch common mistakes for panels. */
> > +	switch (desc->connector_type) {
> > +	case 0:
> > +		WARN(desc->connector_type == 0, "specify missing connector_type\n");
> > +		break;
> > +	case DRM_MODE_CONNECTOR_LVDS:
> >  		WARN_ON(desc->bus_flags &
> >  			~(DRM_BUS_FLAG_DE_LOW |
> >  			  DRM_BUS_FLAG_DE_HIGH |
> > @@ -564,6 +568,30 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> >  		WARN_ON((desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ||
> >  			 desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) &&
> >  			desc->bpc != 8);
> > +		break;
> > +	case DRM_MODE_CONNECTOR_eDP:
> > +		WARN_ON(desc->bus_format == 0);
> > +		WARN_ON(desc->bpc != 6 && desc->bpc != 8);
> > +		break;
> > +	case DRM_MODE_CONNECTOR_DSI:
> > +		WARN_ON(desc->bpc != 6 && desc->bpc != 8);
> > +		break;
> > +	case DRM_MODE_CONNECTOR_DPI:
> > +		WARN_ON(desc->bus_flags &
> > +			~(DRM_BUS_FLAG_DE_LOW |
> > +			  DRM_BUS_FLAG_DE_HIGH |
> > +			  DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE |
> > +			  DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
> > +			  DRM_BUS_FLAG_DATA_MSB_TO_LSB |
> > +			  DRM_BUS_FLAG_DATA_LSB_TO_MSB |
> > +			  DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE |
> > +			  DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE));
> > +		WARN_ON(desc->bus_format == 0);
> > +		WARN_ON(desc->bpc != 6 && desc->bpc != 8);
> > +		break;
> > +	default:
> > +		WARN(true, "panel has unknown connector_type: %d\n", desc->connector_type);
> > +		break;
> >  	}
> 
> The checks look sane to me. For LVDS we've added the WARN_ON after
> checking all LVDS panels [1], so the warning will only get displayed for
> new panel drivers. For other types of panel, this will cause lots of
> WARN_ON to trigger. On one hand it gets the issues noticed, which should
> help fixing them, but on the other hand it will also scare lots of users
> and developers. I'm not sure if we should downgrade that to a dev_warn()
> for some time until we get at least the majority of the issues fixed.
> Daniel, any opinion ?

We should be noisy, but not too noisy.
dev_warn() is fine, maybe only dev_info()?

Unless I get other feedback I will convert to dev_info() in the
next version of the patch.
Fixing all panels before we add the checks, is not feasible.
Access to datasheet is not easy/possible for many panels.

	Sam


> 
> [1] Actually not quite, I've just sent "[PATCH] drm: panel: simple: Fix
> bpc for LG LB070WV8 panel" to fix one bpc issue.
> 
> >  	drm_panel_init(&panel->base, dev, &panel_simple_funcs,
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-07-12 10:58 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-03 19:23 [PATCH v3 0/21] drm/bridge: support chained bridges + panel updates Sam Ravnborg
2020-07-03 19:23 ` [PATCH v3 01/21] drm/panel: add connector type to boe, hv070wsa-100 panel Sam Ravnborg
2020-07-10 21:32   ` [PATCH v3 01/21] drm/panel: add connector type to boe,hv070wsa-100 panel Laurent Pinchart
2020-07-03 19:23 ` [PATCH v3 02/21] drm/panel: panel-simple: add default connector_type Sam Ravnborg
2020-07-10 22:11   ` Laurent Pinchart
2020-07-11  7:48     ` Sam Ravnborg
2020-07-11  9:47       ` [PATCH] drm/panel: panel-simple: validate panel description Sam Ravnborg
2020-07-11 22:56         ` Laurent Pinchart
2020-07-12 10:58           ` Sam Ravnborg [this message]
2020-07-12 15:39             ` Laurent Pinchart
2020-07-03 19:23 ` [PATCH v3 03/21] drm/bridge: tc358764: drop drm_connector_(un)register Sam Ravnborg
2020-07-03 19:24 ` [PATCH v3 04/21] drm/bridge: tc358764: add drm_panel_bridge support Sam Ravnborg
2020-07-03 19:24 ` [PATCH v3 05/21] drm/bridge: tc358764: make connector creation optional Sam Ravnborg
2020-07-03 19:24 ` [PATCH v3 06/21] drm/bridge: tc358767: add drm_panel_bridge support Sam Ravnborg
2020-07-10 22:19   ` Laurent Pinchart
2020-07-19 13:06     ` Sam Ravnborg
2020-07-22 12:40       ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 07/21] drm/bridge: tc358767: add detect bridge operation Sam Ravnborg
2020-07-10 22:21   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 08/21] drm/bridge: tc358767: add get_edid bride operation Sam Ravnborg
2020-07-10 22:24   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 09/21] drm/bridge: tc358767: make connector creation optional Sam Ravnborg
2020-07-10 22:24   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 10/21] drm/bridge: ti-tpd12s015: " Sam Ravnborg
2020-07-10 22:26   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 11/21] drm/bridge: parade-ps8622: add drm_panel_bridge support Sam Ravnborg
2020-07-10 22:30   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 12/21] drm/bridge: parade-ps8622: make connector creation optional Sam Ravnborg
2020-07-10 22:31   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 13/21] drm/bridge: megachips: add helper to create connector Sam Ravnborg
2020-07-10 22:34   ` Laurent Pinchart
2020-07-26 19:57     ` Sam Ravnborg
2020-07-03 19:24 ` [PATCH v3 14/21] drm/bridge: megachips: get drm_device from bridge Sam Ravnborg
2020-07-10 22:35   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 15/21] drm/bridge: megachips: enable detect bridge operation Sam Ravnborg
2020-07-10 22:36   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 16/21] drm/bridge: megachips: add get_edid " Sam Ravnborg
2020-07-10 22:37   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 17/21] drm/bridge: megachips: make connector creation optional Sam Ravnborg
2020-07-10 22:38   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 18/21] drm/bridge: nxp-ptn3460: add drm_panel_bridge support Sam Ravnborg
2020-07-10 22:39   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 19/21] drm/bridge: nxp-ptn3460: add get_modes bridge operation Sam Ravnborg
2020-07-10 22:42   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 20/21] drm/bridge: nxp-ptn3460: make connector creation optional Sam Ravnborg
2020-07-10 22:43   ` Laurent Pinchart
2020-07-03 19:24 ` [PATCH v3 21/21] drm/bridge: ti-sn65dsi86: add drm_panel_bridge support Sam Ravnborg
2020-07-10 22:46   ` Laurent Pinchart

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=20200712105819.GA1079176@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=lkp@intel.com \
    --cc=martyn.welch@collabora.co.uk \
    --cc=narmstrong@baylibre.com \
    --cc=peter.senna@gmail.com \
    --cc=thierry.reding@gmail.com \
    /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