Linux clock framework development
 help / color / mirror / Atom feed
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: tomm.merciai@gmail.com, geert@linux-m68k.org,
	linux-renesas-soc@vger.kernel.org, biju.das.jz@bp.renesas.com,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v5 14/20] drm: renesas: rz-du: Add RZ/G3E support
Date: Thu, 11 Jun 2026 16:48:32 +0200	[thread overview]
Message-ID: <airKwNu_PMrkpHjj@tom-desktop> (raw)
In-Reply-To: <20260610212234.GA1632628@killaraus.ideasonboard.com>

Hi Laurent,
Thanks for your review.


On Thu, Jun 11, 2026 at 12:22:34AM +0300, Laurent Pinchart wrote:
> Hi Tommaso,
> 
> On Wed, Mar 18, 2026 at 03:45:54PM +0100, Tommaso Merciai wrote:
> > On Fri, Feb 13, 2026 at 05:27:40PM +0100, Tommaso Merciai wrote:
> > > The RZ/G3E Soc has 2 LCD controller (LCDC), contain a Frame Compression
> > > Processor (FCPVD), a Video Signal Processor (VSPD), Video Signal
> > > Processor (VSPD), and Display Unit (DU).
> > > 
> > > LCDC0 supports DSI and LVDS (single or dual-channel) outputs.
> > > LCDC1 supports DSI, LVDS (single-channel), and RGB outputs.
> > > 
> > > Depending on the selected output, the correct SMUX2 clock parent must be
> > > chosen based on the requested duty cycle:
> > > 
> > >  - Index 0 for LVDS -> CDIV7_DSIx_CLK (DUTY H/L=4/3, 4/7 duty cycle)
> > >  - Index 1 for DSI/DPAD -> CSDIV_2to16_PLLDSIx (symmetric 50% duty cycle)
> > > 
> > > To support this behavior, introduce the `RZG2L_DU_FEATURE_SMUX2_DSI_CLK`
> > > feature flag and extend the `rzg2l_du_device_info` structure to include a
> > > features field. Also, add a new helper function `rzg2l_du_has()` to check
> > > for feature flags.
> > > 
> > > Add support for the RZ/G3E SoC by introducing:
> > >  - `rzg2l_du_r9a09g047_du_info` structure
> > >  - The `renesas,r9a09g047-du` compatible string
> > > 
> > > Additionally, introduce the missing output definitions
> > > `RZG2L_DU_OUTPUT_LVDS{0,1}`.
> > > 
> > > Introduce `rzg2l_du_crtc_atomic_check()` helper to store the routes from
> > > the CRTC output to the DU outputs.
> > > 
> > > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > > ---
> > > v4->v5:
> > >  - Fixed RG2L_DU_FEATURE_SMUX2_DSI_CLK to RZG2L_DU_FEATURE_SMUX2_DSI_CLK,
> > >    update commit body accordingly.
> > >  - Added features field documentation.
> > > 
> > > v3->v4:
> > >  - No changes.
> > > 
> > > v2->v3:
> > >  - No changes.
> > > 
> > > v1->v2:
> > >  - Instead of using clk-provider API to select the right parent clock,
> > >    based on the outputs. Just set the correct duty cycle based on the
> > >    output, this reflects at CPG lvl to select the right parent.
> > >  - Updated commit message accordingly.
> > > 
> > >  drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c | 48 +++++++++++++++++++
> > >  drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c  | 26 ++++++++++
> > >  drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h  | 12 +++++
> > >  3 files changed, 86 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c
> > > index 6e7aac6219be..cc35dd409e3e 100644
> > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c
> > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_crtc.c
> > > @@ -64,11 +64,32 @@
> > >  static void rzg2l_du_crtc_set_display_timing(struct rzg2l_du_crtc *rcrtc)
> > >  {
> > >  	const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
> > > +	struct rzg2l_du_crtc_state *rstate =
> > > +		to_rzg2l_crtc_state(rcrtc->crtc.state);
> > >  	unsigned long mode_clock = mode->clock * 1000;
> > >  	u32 ditr0, ditr1, ditr2, ditr3, ditr4, pbcr0;
> > >  	struct rzg2l_du_device *rcdu = rcrtc->dev;
> > >  
> > >  	clk_prepare_enable(rcrtc->rzg2l_clocks.dclk);
> > > +
> > > +	if (rzg2l_du_has(rcdu, RZG2L_DU_FEATURE_SMUX2_DSI_CLK)) {
> > > +		struct clk *clk_parent;
> > > +
> > > +		clk_parent = clk_get_parent(rcrtc->rzg2l_clocks.dclk);
> > > +
> > > +		/*
> > > +		 * Request appropriate duty cycle to let clock driver select
> > > +		 * the correct parent:
> > > +		 * - CDIV7_DSIx_CLK (LVDS path) has DUTY H/L=4/3, 4/7 duty cycle.
> > > +		 * - CSDIV_2to16_PLLDSIx (DSI/RGB path) has symmetric 50% duty cycle.
> > > +		 */
> > > +		if (rstate->outputs == BIT(RZG2L_DU_OUTPUT_LVDS0) ||
> > > +		    rstate->outputs == BIT(RZG2L_DU_OUTPUT_LVDS1))
> > > +			clk_set_duty_cycle(clk_parent, 4, 7);
> > > +		else
> > > +			clk_set_duty_cycle(clk_parent, 1, 2);
> > > +	}
> > > +
> > 
> > I’d appreciate any feedback/suggestions regarding this.
> > Thank you in advance for your time.
> 
> Sorry for the very late reply.

No worries, thanks for your time.

> 
> I've taken time to analyse the clock tree, and I think the way you model
> it makes sense. As the SMUX2_DSI[01]_CLK clocks are used by the LCD,
> LVDS and DSI blocks, I may have selected the duty cycle in the LVDS and
> DSI drivers personally. I wonder if it would lead to simpler code (you
> wouldn't need to implement rzg2l_du_crtc_atomic_check()) here for
> instance. In any case, it does not affect the DT bindings, so it could
> be changed later too.

Agreed, we can change this later.

> 
> Do you need further feedback on this ?

Right now the bottleneck of the series is the DT bindings design [1].
As discussed in our previous conversation, I've provided a clear explanation
of why we are using a single-DU DT design in [1]; let me know if I'm missing
something. Thanks.

[1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/ff8e401a0667970a42a55420dcb071e34730a923.1778141145.git.tommaso.merciai.xr@bp.renesas.com/

Kind Regards,
Tommaso

> 
> > FYI this commit is related to [0]
> > 
> > [0] https://patchwork.kernel.org/project/linux-renesas-soc/patch/53c8d9e7fde7b176e05503a72af81e74c7a8a1c1.1770996493.git.tommaso.merciai.xr@bp.renesas.com/
> > 
> > Kind Regards,
> > Tommaso
> > 
> > >  	clk_set_rate(rcrtc->rzg2l_clocks.dclk, mode_clock);
> > >  
> > >  	ditr0 = (DU_DITR0_DEMD_HIGH
> > > @@ -248,6 +269,32 @@ static void rzg2l_du_crtc_stop(struct rzg2l_du_crtc *rcrtc)
> > >   * CRTC Functions
> > >   */
> > >  
> > > +static int rzg2l_du_crtc_atomic_check(struct drm_crtc *crtc,
> > > +				      struct drm_atomic_state *state)
> > > +{
> > > +	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
> > > +									  crtc);
> > > +	struct rzg2l_du_crtc_state *rstate = to_rzg2l_crtc_state(crtc_state);
> > > +	struct drm_encoder *encoder;
> > > +
> > > +	/* Store the routes from the CRTC output to the DU outputs. */
> > > +	rstate->outputs = 0;
> > > +
> > > +	drm_for_each_encoder_mask(encoder, crtc->dev,
> > > +				  crtc_state->encoder_mask) {
> > > +		struct rzg2l_du_encoder *renc;
> > > +
> > > +		/* Skip the writeback encoder. */
> > > +		if (encoder->encoder_type == DRM_MODE_ENCODER_VIRTUAL)
> > > +			continue;
> > > +
> > > +		renc = to_rzg2l_encoder(encoder);
> > > +		rstate->outputs |= BIT(renc->output);
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > >  static void rzg2l_du_crtc_atomic_enable(struct drm_crtc *crtc,
> > >  					struct drm_atomic_state *state)
> > >  {
> > > @@ -296,6 +343,7 @@ static void rzg2l_du_crtc_atomic_flush(struct drm_crtc *crtc,
> > >  }
> > >  
> > >  static const struct drm_crtc_helper_funcs crtc_helper_funcs = {
> > > +	.atomic_check = rzg2l_du_crtc_atomic_check,
> > >  	.atomic_flush = rzg2l_du_crtc_atomic_flush,
> > >  	.atomic_enable = rzg2l_du_crtc_atomic_enable,
> > >  	.atomic_disable = rzg2l_du_crtc_atomic_disable,
> > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > index 0fef33a5a089..3c20471fdbea 100644
> > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> > > @@ -51,6 +51,29 @@ static const struct rzg2l_du_device_info rzg2l_du_r9a07g044_info = {
> > >  	}
> > >  };
> > >  
> > > +static const struct rzg2l_du_device_info rzg2l_du_r9a09g047_du_info = {
> > > +	.features = RZG2L_DU_FEATURE_SMUX2_DSI_CLK,
> > > +	.channels_mask = BIT(0),
> > > +	.routes = {
> > > +		[RZG2L_DU_OUTPUT_DSI0] = {
> > > +			.possible_outputs = BIT(0),
> > > +			.port = 0,
> > > +		},
> > > +		[RZG2L_DU_OUTPUT_LVDS0] = {
> > > +			.possible_outputs = BIT(0),
> > > +			.port = 1,
> > > +		},
> > > +		[RZG2L_DU_OUTPUT_LVDS1] = {
> > > +			.possible_outputs = BIT(0),
> > > +			.port = 2,
> > > +		},
> > > +		[RZG2L_DU_OUTPUT_DPAD0] = {
> > > +			.possible_outputs = BIT(0),
> > > +			.port = 3,
> > > +		},
> > > +	},
> > > +};
> > > +
> > >  static const struct rzg2l_du_device_info rzg2l_du_r9a09g057_info = {
> > >  	.channels_mask = BIT(0),
> > >  	.routes = {
> > > @@ -64,6 +87,7 @@ static const struct rzg2l_du_device_info rzg2l_du_r9a09g057_info = {
> > >  static const struct of_device_id rzg2l_du_of_table[] = {
> > >  	{ .compatible = "renesas,r9a07g043u-du", .data = &rzg2l_du_r9a07g043u_info },
> > >  	{ .compatible = "renesas,r9a07g044-du", .data = &rzg2l_du_r9a07g044_info },
> > > +	{ .compatible = "renesas,r9a09g047-du", .data = &rzg2l_du_r9a09g047_du_info },
> > >  	{ .compatible = "renesas,r9a09g057-du", .data = &rzg2l_du_r9a09g057_info },
> > >  	{ /* sentinel */ }
> > >  };
> > > @@ -74,6 +98,8 @@ const char *rzg2l_du_output_name(enum rzg2l_du_output output)
> > >  {
> > >  	static const char * const names[] = {
> > >  		[RZG2L_DU_OUTPUT_DSI0] = "DSI0",
> > > +		[RZG2L_DU_OUTPUT_LVDS0] = "LVDS0",
> > > +		[RZG2L_DU_OUTPUT_LVDS1] = "LVDS1",
> > >  		[RZG2L_DU_OUTPUT_DPAD0] = "DPAD0"
> > >  	};
> > >  
> > > diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
> > > index 58806c2a8f2b..480a7bdfcd66 100644
> > > --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
> > > +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.h
> > > @@ -20,8 +20,12 @@
> > >  struct device;
> > >  struct drm_property;
> > >  
> > > +#define RZG2L_DU_FEATURE_SMUX2_DSI_CLK	BIT(0)	/* Per output mux */
> > > +
> > >  enum rzg2l_du_output {
> > >  	RZG2L_DU_OUTPUT_DSI0,
> > > +	RZG2L_DU_OUTPUT_LVDS0,
> > > +	RZG2L_DU_OUTPUT_LVDS1,
> > >  	RZG2L_DU_OUTPUT_DPAD0,
> > >  	RZG2L_DU_OUTPUT_MAX,
> > >  };
> > > @@ -42,10 +46,12 @@ struct rzg2l_du_output_routing {
> > >  
> > >  /*
> > >   * struct rzg2l_du_device_info - DU model-specific information
> > > + * @features: device features (RZG2L_DU_FEATURE_*)
> > >   * @channels_mask: bit mask of available DU channels
> > >   * @routes: array of CRTC to output routes, indexed by output (RZG2L_DU_OUTPUT_*)
> > >   */
> > >  struct rzg2l_du_device_info {
> > > +	unsigned int features;
> > >  	unsigned int channels_mask;
> > >  	struct rzg2l_du_output_routing routes[RZG2L_DU_OUTPUT_MAX];
> > >  };
> > > @@ -73,6 +79,12 @@ static inline struct rzg2l_du_device *to_rzg2l_du_device(struct drm_device *dev)
> > >  	return container_of(dev, struct rzg2l_du_device, ddev);
> > >  }
> > >  
> > > +static inline bool rzg2l_du_has(struct rzg2l_du_device *rcdu,
> > > +				unsigned int feature)
> > > +{
> > > +	return rcdu->info->features & feature;
> > > +}
> > > +
> > >  const char *rzg2l_du_output_name(enum rzg2l_du_output output);
> > >  
> > >  #endif /* __RZG2L_DU_DRV_H__ */
> 
> -- 
> Regards,
> 
> Laurent Pinchart

  reply	other threads:[~2026-06-11 14:48 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-13 16:27 [PATCH v5 00/20] Add support for DU and DSI on the Renesas RZ/G3E SoC Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 01/20] clk: renesas: rzv2h: Add PLLDSI clk mux support Tommaso Merciai
2026-02-27 10:47   ` Geert Uytterhoeven
2026-02-27 17:24     ` Tommaso Merciai
2026-02-27 18:29       ` Geert Uytterhoeven
2026-02-13 16:27 ` [PATCH v5 02/20] clk: renesas: r9a09g047: Add CLK_PLLETH_LPCLK support Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 03/20] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1} clocks Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 04/20] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_DIV7 clocks Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 05/20] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_CSDIV clocks Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 06/20] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0,1}_CLK Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 07/20] clk: renesas: r9a09g047: Add support for DSI clocks and resets Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 08/20] clk: renesas: r9a09g047: Add support for LCDC{0,1} " Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 09/20] dt-bindings: display: renesas,rzg2l-du: Add support for RZ/G3E SoC Tommaso Merciai
2026-02-15  8:11   ` Biju Das
2026-02-24  8:17     ` Tommaso Merciai
2026-03-17 17:10     ` Tommaso Merciai
2026-03-17 17:14       ` Biju Das
2026-02-23 17:47   ` Rob Herring (Arm)
2026-02-13 16:27 ` [PATCH v5 10/20] dt-bindings: display: bridge: renesas,dsi: " Tommaso Merciai
2026-03-17 12:46   ` Biju Das
2026-02-13 16:27 ` [PATCH v5 11/20] drm: renesas: rz-du: mipi_dsi: Add out_port to OF data Tommaso Merciai
2026-03-17 12:50   ` Biju Das
2026-03-17 17:30     ` Tommaso Merciai
2026-03-18  8:06       ` Biju Das
2026-02-13 16:27 ` [PATCH v5 12/20] drm: renesas: rz-du: mipi_dsi: Add RZ_MIPI_DSI_FEATURE_GPO0R feature Tommaso Merciai
2026-03-17 13:03   ` Biju Das
2026-03-17 18:01     ` Tommaso Merciai
2026-03-18  7:50       ` Biju Das
2026-02-13 16:27 ` [PATCH v5 13/20] drm: renesas: rz-du: mipi_dsi: Add support for RZ/G3E Tommaso Merciai
2026-03-17 13:15   ` Biju Das
2026-02-13 16:27 ` [PATCH v5 14/20] drm: renesas: rz-du: Add RZ/G3E support Tommaso Merciai
2026-03-17 13:35   ` Biju Das
2026-03-17 17:36     ` Tommaso Merciai
2026-03-17 18:24     ` Tommaso Merciai
2026-03-18 14:45   ` Tommaso Merciai
2026-06-10 21:22     ` Laurent Pinchart
2026-06-11 14:48       ` Tommaso Merciai [this message]
2026-02-13 16:27 ` [PATCH v5 15/20] media: dt-bindings: media: renesas,vsp1: Document RZ/G3E Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 16/20] media: dt-bindings: media: renesas,fcp: Document RZ/G3E SoC Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 17/20] arm64: dts: renesas: r9a09g047: Add fcpvd{0,1} nodes Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 18/20] arm64: dts: renesas: r9a09g047: Add vspd{0,1} nodes Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 19/20] arm64: dts: renesas: r9a09g047: Add DU{0,1} and DSI nodes Tommaso Merciai
2026-02-13 16:27 ` [PATCH v5 20/20] arm64: dts: renesas: r9a09g047e57-smarc: Enable DU0 and DSI support Tommaso Merciai

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=airKwNu_PMrkpHjj@tom-desktop \
    --to=tommaso.merciai.xr@bp.renesas.com \
    --cc=airlied@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=krzk+dt@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=magnus.damm@gmail.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomm.merciai@gmail.com \
    --cc=tzimmermann@suse.de \
    /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