Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
To: chaoyi.chen@rock-chips.com
Cc: Laurent.pinchart@ideasonboard.com, airlied@gmail.com,
	conor+dt@kernel.org, devicetree@vger.kernel.org,
	dri-devel@lists.freedesktop.org, gianfranco.mariotti94@gmail.com,
	heiko@sntech.de, hero.huang@rock-chips.com,
	jernej.skrabec@gmail.com, krzk+dt@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	luca.ceresoli@bootlin.com, lumag@kernel.org,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	neil.armstrong@linaro.org, rfoss@kernel.org, robh@kernel.org,
	simona@ffwll.ch, tzimmermann@suse.de,
	zhibin.huang@rock-chips.com
Subject: Re: [PATCH 2/2] drm/bridge: Add Rockchip RK628 HDMI to LVDS bridge driver
Date: Thu,  3 Dec 2026 15:46:40 +0100	[thread overview]
Message-ID: <20261203144640.22758-1-gianfranco.mariotti94@gmail.com> (raw)
In-Reply-To: <438f9a5e-b962-44d4-9618-349c5933bc49@rock-chips.com>

Hi Chaoyi,

Thanks for the review.

On Thu, Dec 03, 2026 at 04:17:52PM +0800, Chaoyi Chen wrote:
> > +	regmap_write(rk628->regmap, CRU_GPLL_CON0, 0xffff701d);
> > +	usleep_range(1000, 1500);
> > +	regmap_write(rk628->regmap, CRU_MODE_CON00, 0xffff0004);
> > +	usleep_range(1000, 1500);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0080);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0083);
> > +	regmap_write(rk628->regmap, CRU_CPLL_CON0, 0xffff3063);
> > +	usleep_range(1000, 1500);
> > +	regmap_write(rk628->regmap, CRU_MODE_CON00, 0xffff0005);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0003);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff000b);
> > +	regmap_write(rk628->regmap, CRU_GPLL_CON0, 0xffff1028);
> > +	usleep_range(1000, 1500);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff008b);
> > +	regmap_write(rk628->regmap, CRU_CPLL_CON0, 0xffff1063);
> > +	usleep_range(1000, 1500);
> > +	regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff000b);
> > +}
>
> Add some comment for these config?
>
> https://github.com/rockchip-linux/kernel/blob/develop-6.12/drivers/misc/rk628/rk628_cru.c

Will do in v2, thank you for the develop-6.12 pointer, I will document
the glitch-free GPLL/CPLL/pclk_logic ramp sequence (and add the 1 ms
settle delay after switching CPLL to normal mode).

> > +	regmap_read_poll_timeout(rk628->regmap, CRU_CPLL_CON1, val,
> > +				 val & PLL_LOCK, 200, 10000);
> > +}
>
> It would be better to check this return value and print a message if
> it fails.

Agreed, I will check the return value and log an error via dev_err() on
timeout in v2.

> > +static void rk628_post_process_csc(struct rk628 *rk628)
> > +{
> > +	/* BT.709 limited-range YCbCr -> full-range RGB (10-bit fixed point) */
> > +	static const s16 y2r_bt709[3][3] = {
> > +		{ 1196,    0, 1841 },
> > +		{ 1196, -219, -547 },
> > +		{ 1196, 2169,    0 },
> > +	};
>
> Isn't 13-bit used here?
>
> https://github.com/rockchip-linux/kernel/blob/develop-6.12/drivers/misc/rk628/rk628_post_process.c#L1556

Fair point, the comment was referring to the 10 fractional bits (1.0 =
1024), whereas the RK628F CSC coefficients themselves are 13-bit signed
Q3.10 (CSC_13BIT_DEPTH / CSC_BT709L_13BIT). Re-checking
rockchip_calc_post_csc() also caught a small rounding difference in the
DC offset vector ({ -995, 308, -1159 }); I will update both the comment
and y2r_bt709_dc[] in v2.

> > +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 3, -1);
> > +	if (ep) {
> > +		of_node_put(ep);
> > +		return dev_err_probe(dev, -EOPNOTSUPP,
> > +				     "HDMI TX output on port@3 is not supported\n");
> > +	}
>
> Missing of_node_put(ep) here.
>
> > +
> > +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 4, -1);
> > +	if (ep) {
> > +		of_node_put(ep);
> > +		return dev_err_probe(dev, -EOPNOTSUPP,
> > +				     "parallel RGB/BT.1120 on port@4 is not supported\n");
> > +	}
> > +
>
> Ditto.
>
> > +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
> > +	if (ep) {
> > +		bool has_data_lanes = of_property_present(ep, "data-lanes");
> > +
> > +		of_node_put(ep);
> > +		if (has_data_lanes)
> > +			return dev_err_probe(dev, -EOPNOTSUPP,
> > +					     "only LVDS output is supported on port@1\n");
> > +	}
>
> Ditto.
>
> > +
> > +	ep = of_graph_get_endpoint_by_regs(dev->of_node, 2, -1);
> > +	if (ep) {
> > +		bool has_data_lanes = of_property_present(ep, "data-lanes");
> > +
> > +		of_node_put(ep);
> > +		if (has_data_lanes)
> > +			return dev_err_probe(dev, -EOPNOTSUPP,
> > +					     "only LVDS output is supported on port@2\n");
> > +	}
> > +
>
> Ditto.

In those four blocks of_node_put(ep) was already called inside the
if (ep) branch (so when execution continues past the brace, ep is either
NULL or already released), unlike port@0 above which used if (!ep). To
make this much cleaner and less error-prone to read, I will switch
rk628_parse_dt() to scoped __free(device_node) cleanup in v2.

Best regards,
Gianfranco


  reply	other threads:[~2026-12-03 14:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  1:33 [PATCH 0/2] drm/bridge: Add Rockchip RK628 video interface bridge support Gianfranco Mariotti
2026-12-03  1:33 ` [PATCH 1/2] dt-bindings: display: bridge: Add Rockchip RK628 video interface bridge Gianfranco Mariotti
2026-12-03  1:33 ` [PATCH 2/2] drm/bridge: Add Rockchip RK628 HDMI to LVDS bridge driver Gianfranco Mariotti
2026-12-03  8:17   ` Chaoyi Chen
2026-12-03 14:46     ` Gianfranco Mariotti [this message]
2026-12-03  8:39   ` Uwe Kleine-König
2026-12-03 14:49     ` Gianfranco Mariotti

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=20261203144640.22758-1-gianfranco.mariotti94@gmail.com \
    --to=gianfranco.mariotti94@gmail.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=chaoyi.chen@rock-chips.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hero.huang@rock-chips.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=zhibin.huang@rock-chips.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