dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	dri-devel@lists.freedesktop.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Chris Healy <Chris.Healy@zii.aero>,
	kernel@collabora.com, Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH RFC 17/19] drm/bridge: lvds-encoder: Implement bus format negotiation for sn75lvds83
Date: Thu, 22 Aug 2019 10:12:50 +0200	[thread overview]
Message-ID: <20190822101250.4b5ed374@collabora.com> (raw)
In-Reply-To: <20190822003210.GA16242@pendragon.ideasonboard.com>

On Thu, 22 Aug 2019 03:32:10 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:

> Hi Boris,
> 
> Thank you for the patch.
> 
> On Thu, Aug 08, 2019 at 05:11:48PM +0200, Boris Brezillon wrote:
> > The SN75LVDS83 bridge support several input formats except the input
> > format is directly related to the expected output format. Let's express
> > that constraint by setting the bridge_state->output_bus_cfg.fmt field
> > to the appropriate value.
> > 
> > The previous element in the chain might be able to use this information
> > to pick the appropriate output bus format.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>  
> 
> This driver is supposed to only support LVDS encoders that require no
> special configuration, and thus not contain device-specific code. I'm
> not sure I like departing from this :-S
> 
> Would there be a way to make this more generic ? Do you think the code
> below could be generalized, or is it really device-specific ?

The list of supported formats is likely to differ, so you'd at least
need to attach that to the compat. Also not sure the RGB -> LVDS format
conversion always follow the same logic, hence the decision to let
bridges implement ->atomic_check() if they want/need to.

Should I create a new driver for this bridge?

> 
> > ---
> >  drivers/gpu/drm/bridge/lvds-encoder.c | 48 +++++++++++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/bridge/lvds-encoder.c b/drivers/gpu/drm/bridge/lvds-encoder.c
> > index da7013c5faf1..8d399d1828b0 100644
> > --- a/drivers/gpu/drm/bridge/lvds-encoder.c
> > +++ b/drivers/gpu/drm/bridge/lvds-encoder.c
> > @@ -159,9 +159,57 @@ static int lvds_encoder_remove(struct platform_device *pdev)
> >  	return 0;
> >  }
> >  
> > +static int sn75lvds83_atomic_check(struct drm_bridge *bridge,
> > +				   struct drm_bridge_state *bridge_state,
> > +				   struct drm_crtc_state *crtc_state,
> > +				   struct drm_connector_state *conn_state)
> > +{
> > +	int ret;
> > +
> > +	ret = drm_atomic_bridge_choose_output_bus_cfg(bridge_state, crtc_state,
> > +						      conn_state);
> > +	if (ret)
> > +		return ret;
> > +
> > +	/*
> > +	 * The output bus format has a direct impact on the expected input bus
> > +	 * format.
> > +	 */
> > +	switch (bridge_state->output_bus_cfg.fmt) {
> > +	case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
> > +	case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
> > +		/*
> > +		 * JEIDA and SPWG variants theoretically require different pin
> > +		 * mapping, but MEDIA_BUS_FMT_ definitions do not allow
> > +		 * fined-grained pin placement definition, and this is
> > +		 * something we expect to be taken care of at board design
> > +		 * time, so let's ignore this for now.
> > +		 * If it becomes a problem, we can always add a way to override
> > +		 * the bus format with a FW property.
> > +		 */
> > +		bridge_state->input_bus_cfg.fmt = MEDIA_BUS_FMT_RGB888_1X24;
> > +		break;
> > +	case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
> > +		bridge_state->input_bus_cfg.fmt = MEDIA_BUS_FMT_RGB666_1X18;
> > +		break;
> > +	default:
> > +		bridge_state->input_bus_cfg.fmt = 0;
> > +		break;
> > +	}  
> 
> These seems a bit fragile. The SN75LVDS83 has a 28-bit input data bus,
> and maps those bits to 3x8 RGB data + 1x4 control signals. It serialises
> the data and outputs them on 4 LVDS pairs. When a panel uses
> MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA or MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, the
> 4 LVDS pairs are used, and MEDIA_BUS_FMT_RGB888_1X24 is required. When
> outputting MEDIA_BUS_FMT_RGB666_1X7X3_SPWG, the fourth LVDS pair is
> ignored, but the 3x8 RGB input bus can still receive
> MEDIA_BUS_FMT_RGB888_1X24, the 2 LSBs of each component will just be
> discarded. The source can thus ignore those 3x2 LSBs, but it still has
> to map the 3x6 MSBs to the high order bits of the 3x8 signals.
> *However*, if the hardware designs wires the 3x6 MSBs of the SN75LVDS83
> to the 3x6 LSBs of the source, then the source will have to produce
> MEDIA_BUS_FMT_RGB666_1X18. Hardcoding the mapping as done here thus
> seems to be system-specific. I think you need to check how signals are
> connected (through DT properties, bus-width and data-shift come to
> mind).

True, I just wanted to keep it simple until the need for the other
case arises. Should we make the bus-width/data-shift mandatory for that
bridge, or can we have a default behavior (like the one proposed here)
when the props are missing?

> 
> > +
> > +	/* Propagate the bus_flags. */
> > +	bridge_state->input_bus_cfg.flags = bridge_state->output_bus_cfg.flags;
> > +	return 0;
> > +}
> > +
> > +static const struct lvds_encoder_ops sn75lvds83_ops = {
> > +	.atomic_check = sn75lvds83_atomic_check,
> > +};
> > +
> >  static const struct of_device_id lvds_encoder_match[] = {
> >  	{ .compatible = "lvds-encoder" },
> >  	{ .compatible = "thine,thc63lvdm83d" },
> > +	{ .compatible = "ti,sn75lvds83", .data = &sn75lvds83_ops },
> >  	{},
> >  };
> >  MODULE_DEVICE_TABLE(of, lvds_encoder_match);  
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-08-22  8:12 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 15:11 [PATCH RFC 00/19] drm: Add support for bus-format negotiation Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 01/19] drm: Stop including drm_bridge.h from drm_crtc.h Boris Brezillon
2019-08-08 18:05   ` Sam Ravnborg
2019-08-20 18:53   ` Laurent Pinchart
2019-08-21 15:44     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 02/19] drm: Support custom encoder/bridge enable/disable sequences officially Boris Brezillon
2019-08-20 19:05   ` Laurent Pinchart
2019-08-21  8:21     ` Daniel Vetter
2019-08-21 13:57       ` Laurent Pinchart
2019-08-21 15:39       ` Boris Brezillon
2019-08-21 15:30     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 03/19] drm/vc4: Get rid of the dsi->bridge field Boris Brezillon
2019-08-08 20:31   ` Eric Anholt
2019-08-08 15:11 ` [PATCH RFC 04/19] drm/exynos: Get rid of exynos_dsi->out_bridge Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 05/19] drm/exynos: Don't reset bridge->next Boris Brezillon
2019-08-08 21:04   ` Boris Brezillon
2019-08-21 14:01   ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 06/19] drm/bridge: Create drm_bridge_chain_xx() wrappers Boris Brezillon
2019-08-21 14:45   ` Laurent Pinchart
2019-08-21 15:53     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 07/19] drm/msm: Use drm_attach_bridge() to attach a bridge to an encoder Boris Brezillon
2019-08-19 17:19   ` Sam Ravnborg
2019-08-21 14:46     ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 08/19] drm/bridge: Introduce drm_bridge_chain_get_{first, last, next}_bridge() Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 09/19] drm/bridge: Make the bridge chain a double-linked list Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 10/19] drm/bridge: Add a drm_bridge_state object Boris Brezillon
2019-08-21 20:14   ` Laurent Pinchart
2019-08-22  9:00     ` Boris Brezillon
2019-12-02 15:52       ` Laurent Pinchart
2019-08-08 15:11 ` [PATCH RFC 11/19] drm/bridge: Patch atomic hooks to take a drm_bridge_state Boris Brezillon
2019-08-22  0:02   ` Laurent Pinchart
2019-08-22  8:25     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 12/19] drm/bridge: Add an ->atomic_check() hook Boris Brezillon
2019-08-22  0:12   ` Laurent Pinchart
2019-08-22  7:58     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 13/19] drm/bridge: Add the drm_bridge_chain_get_prev_bridge() helper Boris Brezillon
2019-08-22  0:17   ` Laurent Pinchart
2019-08-22  8:04     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 14/19] drm/bridge: Add the necessary bits to support bus format negotiation Boris Brezillon
2019-08-14  7:51   ` Neil Armstrong
2019-08-21 18:31     ` Boris Brezillon
2019-08-22  0:55   ` Laurent Pinchart
2019-08-22  7:48     ` Boris Brezillon
2019-08-22  9:29       ` Neil Armstrong
2019-08-22 10:09         ` Boris Brezillon
2019-08-22 10:22           ` Neil Armstrong
2019-08-22 10:34             ` Boris Brezillon
2019-08-22 11:30               ` Neil Armstrong
2019-08-08 15:11 ` [PATCH RFC 15/19] drm/imx: pd: Use bus format/flags provided by the bridge when available Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 16/19] drm/bridge: lvds-encoder: Add a way to support custom ->atomic_check() implem Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 17/19] drm/bridge: lvds-encoder: Implement bus format negotiation for sn75lvds83 Boris Brezillon
2019-08-22  0:32   ` Laurent Pinchart
2019-08-22  8:12     ` Boris Brezillon [this message]
2019-08-08 15:11 ` [PATCH RFC 18/19] drm/panel: simple: Add support for Toshiba LTA089AC29000 panel Boris Brezillon
2019-08-22  0:36   ` Laurent Pinchart
2019-08-22  8:15     ` Boris Brezillon
2019-08-08 15:11 ` [PATCH RFC 19/19] ARM: dts: imx: imx51-zii-rdu1: Fix the display pipeline definition Boris Brezillon
2019-08-09  6:58 ` [PATCH RFC 00/19] drm: Add support for bus-format negotiation Neil Armstrong

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=20190822101250.4b5ed374@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=Chris.Healy@zii.aero \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=kernel@collabora.com \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=narmstrong@baylibre.com \
    --cc=sam@ravnborg.org \
    --cc=sw0312.kim@samsung.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