public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Marek Vasut <marex@denx.de>
Cc: dri-devel@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Subject: Re: [PATCH] drm: bridge: ldb: add support for using channel 1 only
Date: Wed, 5 Apr 2023 09:30:17 +0200	[thread overview]
Message-ID: <20230405093017.62ccb4f6@booty> (raw)
In-Reply-To: <5b514970-cfc8-41de-7ae6-f608f5187860@denx.de>

Hi Marek,

thanks for the quick and detailed review!

On Wed, 5 Apr 2023 05:28:16 +0200
Marek Vasut <marex@denx.de> wrote:

> On 4/4/23 09:37, Luca Ceresoli wrote:
> 
> [...]
> 
> > @@ -177,28 +183,25 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,
> >   	clk_prepare_enable(fsl_ldb->clk);
> >   
> >   	/* Program LDB_CTRL */
> > -	reg = LDB_CTRL_CH0_ENABLE;
> > -
> > -	if (fsl_ldb->lvds_dual_link)
> > -		reg |= LDB_CTRL_CH1_ENABLE | LDB_CTRL_SPLIT_MODE;
> > -
> > -	if (lvds_format_24bpp) {
> > -		reg |= LDB_CTRL_CH0_DATA_WIDTH;
> > -		if (fsl_ldb->lvds_dual_link)
> > -			reg |= LDB_CTRL_CH1_DATA_WIDTH;
> > -	}
> > -
> > -	if (lvds_format_jeida) {
> > -		reg |= LDB_CTRL_CH0_BIT_MAPPING;
> > -		if (fsl_ldb->lvds_dual_link)
> > -			reg |= LDB_CTRL_CH1_BIT_MAPPING;
> > -	}
> > -
> > -	if (mode->flags & DRM_MODE_FLAG_PVSYNC) {
> > -		reg |= LDB_CTRL_DI0_VSYNC_POLARITY;
> > -		if (fsl_ldb->lvds_dual_link)
> > -			reg |= LDB_CTRL_DI1_VSYNC_POLARITY;
> > -	}
> > +	reg =  
> 
> Cosmetic nit, do we need the newline here , can't we just move the first 
> '(fsl_ldb->ch0_enabled ? LDB_CTRL_CH0_ENABLE : 0) |' on the same line as 
> 'reg =' ? It might need a bit of indent with spaces, but that should be OK.

Sure. Maybe 'reg =<tab>(fsl...' would be even better, it checkpatch
allows.

> > @@ -311,10 +314,23 @@ static int fsl_ldb_probe(struct platform_device *pdev)
> >   	if (IS_ERR(fsl_ldb->regmap))
> >   		return PTR_ERR(fsl_ldb->regmap);
> >   
> > -	/* Locate the panel DT node. */
> > -	panel_node = of_graph_get_remote_node(dev->of_node, 1, 0);
> > -	if (!panel_node)
> > -		return -ENXIO;
> > +	/* Locate the remote ports and the panel node */
> > +	remote1 = of_graph_get_remote_node(dev->of_node, 1, 0);
> > +	remote2 = of_graph_get_remote_node(dev->of_node, 2, 0);
> > +	fsl_ldb->ch0_enabled = (remote1 != NULL);
> > +	fsl_ldb->ch1_enabled = (remote2 != NULL);
> > +	panel_node = of_node_get(remote1 ? remote1 : remote2);  
> 
> You can even do this without the middle 'remote1' I think:
> 
> panel_node = of_node_get(remote1 ? : remote2);

Apparently, but honestly with such short expressions clearly having no
side effects I think it's not helping readability.

> > +	of_node_put(remote1);
> > +	of_node_put(remote2);
> > +
> > +	if (!fsl_ldb->ch0_enabled && !fsl_ldb->ch1_enabled) {
> > +		of_node_put(panel_node);
> > +		return dev_err_probe(dev, -ENXIO, "No panel node found");
> > +	}
> > +
> > +	dev_dbg(dev, "Using %s\n",
> > +		fsl_ldb_is_dual(fsl_ldb) ? "dual mode" :  
> 
> I think this is called "dual-link mode" , maybe update the string .

I was using the terms from the NXP docs, but indeed in the kernel it
seems that "dual-link" is the common name. Updating that.

> > @@ -325,20 +341,26 @@ static int fsl_ldb_probe(struct platform_device *pdev)
> >   	if (IS_ERR(fsl_ldb->panel_bridge))
> >   		return PTR_ERR(fsl_ldb->panel_bridge);
> >   
> > -	/* Determine whether this is dual-link configuration */
> > -	port1 = of_graph_get_port_by_id(dev->of_node, 1);
> > -	port2 = of_graph_get_port_by_id(dev->of_node, 2);
> > -	dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2);
> > -	of_node_put(port1);
> > -	of_node_put(port2);
> >   
> > -	if (dual_link == DRM_LVDS_DUAL_LINK_EVEN_ODD_PIXELS) {
> > -		dev_err(dev, "LVDS channel pixel swap not supported.\n");
> > -		return -EINVAL;
> > -	}
> > +	if (fsl_ldb_is_dual(fsl_ldb)) {
> > +		struct device_node *port1, *port2;
> > +
> > +		port1 = of_graph_get_port_by_id(dev->of_node, 1);
> > +		port2 = of_graph_get_port_by_id(dev->of_node, 2);
> > +		dual_link = drm_of_lvds_get_dual_link_pixel_order(port1, port2);
> > +		of_node_put(port1);
> > +		of_node_put(port2);
> >   
> > -	if (dual_link == DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS)
> > -		fsl_ldb->lvds_dual_link = true;
> > +		if (dual_link < 0)
> > +			return dev_err_probe(dev, dual_link,
> > +					     "Error getting dual link configuration");  
> 
> Does this need a trailing '\n' in the formatting string or not ? I think 
> yes.

Oops, good catch.

> The rest looks good, with the few details fixed:
> 
> Reviewed-by: Marek Vasut <marex@denx.de>

Thanks!

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2023-04-05  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  7:37 [PATCH] drm: bridge: ldb: add support for using channel 1 only Luca Ceresoli
2023-04-05  3:28 ` Marek Vasut
2023-04-05  7:30   ` Luca Ceresoli [this message]
2023-04-05 12:31     ` Marek Vasut

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=20230405093017.62ccb4f6@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=neil.armstrong@linaro.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=rfoss@kernel.org \
    --cc=thomas.petazzoni@bootlin.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