All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: tomm.merciai@gmail.com, linux-renesas-soc@vger.kernel.org,
	biju.das.jz@bp.renesas.com,
	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>, 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>,
	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 01/22] clk: renesas: rzv2h: Add PLLDSI clk mux support
Date: Fri, 23 Jan 2026 16:52:08 +0100	[thread overview]
Message-ID: <aXOZKK7alxiHJRUk@tom-desktop> (raw)
In-Reply-To: <CAMuHMdV9G4an1nhPoHvXa5RtrAw+-tP=VrEz4YFNnE7-MD-Vrw@mail.gmail.com>

Hi Geert,
Thanks for your comment.

On Wed, Jan 14, 2026 at 02:07:49PM +0100, Geert Uytterhoeven wrote:
> Hi Tommaso,
> 
> On Mon, 12 Jan 2026 at 09:13, Tommaso Merciai
> <tommaso.merciai.xr@bp.renesas.com> wrote:
> > On Fri, Jan 09, 2026 at 07:27:04PM +0100, Geert Uytterhoeven wrote:
> > > On Wed, 26 Nov 2025 at 15:08, Tommaso Merciai
> > > <tommaso.merciai.xr@bp.renesas.com> wrote:
> > > > Add PLLDSI clk mux support to select PLLDSI clock from different clock
> > > > sources.
> > > >
> > > > Introduce the DEF_PLLDSI_SMUX() macro to define these muxes and register
> > > > them in the clock driver.
> > > >
> > > > Extend the determine_rate callback to calculate and propagate PLL
> > > > parameters via rzv2h_get_pll_dtable_pars() when LVDS output is selected,
> > > > using a new helper function rzv2h_cpg_plldsi_smux_lvds_determine_rate().
> > > >
> > > > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/drivers/clk/renesas/rzv2h-cpg.c
> > > > +++ b/drivers/clk/renesas/rzv2h-cpg.c
> > >
> > > [...]
> > >
> > > >  static int rzv2h_cpg_pll_clk_is_enabled(struct clk_hw *hw)
> > > >  {
> > > >         struct pll_clk *pll_clk = to_pll(hw);
> > > > @@ -1085,6 +1213,9 @@ rzv2h_cpg_register_core_clk(const struct cpg_core_clk *core,
> > > >         case CLK_TYPE_PLLDSI_DIV:
> > > >                 clk = rzv2h_cpg_plldsi_div_clk_register(core, priv);
> > > >                 break;
> > > > +       case CLK_TYPE_PLLDSI_SMUX:
> > > > +               clk = rzv2h_cpg_plldsi_smux_clk_register(core, priv);
> > > > +               break;
> > > >         default:
> > > >                 goto fail;
> > > >         }
> > > > diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h
> > > > index dc957bdaf5e9..5f6e775612e7 100644
> > > > --- a/drivers/clk/renesas/rzv2h-cpg.h
> > > > +++ b/drivers/clk/renesas/rzv2h-cpg.h
> > > > @@ -203,6 +203,7 @@ enum clk_types {
> > > >         CLK_TYPE_SMUX,          /* Static Mux */
> > > >         CLK_TYPE_PLLDSI,        /* PLLDSI */
> > > >         CLK_TYPE_PLLDSI_DIV,    /* PLLDSI divider */
> > > > +       CLK_TYPE_PLLDSI_SMUX,   /* PLLDSI Static Mux */
> > > >  };
> > > >
> > > >  #define DEF_TYPE(_name, _id, _type...) \
> > > > @@ -241,6 +242,13 @@ enum clk_types {
> > > >                  .dtable = _dtable, \
> > > >                  .parent = _parent, \
> > > >                  .flag = CLK_SET_RATE_PARENT)
> > > > +#define DEF_PLLDSI_SMUX(_name, _id, _smux_packed, _parent_names) \
> > > > +       DEF_TYPE(_name, _id, CLK_TYPE_PLLDSI_SMUX, \
> > > > +                .cfg.smux = _smux_packed, \
> > > > +                .parent_names = _parent_names, \
> > > > +                .num_parents = ARRAY_SIZE(_parent_names), \
> > > > +                .flag = CLK_SET_RATE_PARENT | CLK_SET_RATE_NO_REPARENT, \
> > > > +                .mux_flags = CLK_MUX_HIWORD_MASK)
> > > >
> > > >  /**
> > > >   * struct rzv2h_mod_clk - Module Clocks definitions
> > >
> > > Why do you need a completely new clock type, and can't you just use
> > > the existing CLK_TYPE_SMUX?
> >
> > From reference manual (Table 4.4-10 Specifications of the CPG_SSELm
> > Registers)
> >
> > We have the following:
> >
> >  - SMUX2_DSI0_CLK*2
> >         0b: CDIV7_DSI0_CLK (default)
> >         1b: CSDIV_2to16_PLLDSI0
> >
> >  - SMUX2_DSI1_CLK*2
> >         0b: CDIV7_DSI1_CLK (default)
> >         1b: CSDIV_2to16_PLLDSI1
> >
> > Note 2.If LVDS0 / LVDS1 is used, be sure to set 0b.
> >
> > For this reason these clocks needs an ad hoc determine_rate function:
> >         - rzv2h_cpg_plldsi_smux_determine_rate()
> >
> > For that CLK_TYPE_PLLDSI_SMUX has been introduced.
> > What do you think?
> 
> OK, your solution sounds good to me.  Still, as this is used from the
> DRM driver, I would like to get some feedback from the DRM people, too.
> 
> BTW, I just noticed in the RZ/G3E clock system diagram that
> CDIV7_DSI0_CLK has a duty cycle "DUTY H/L=4/3", while all other clocks
> use the symmetrical 50%.  Perhaps the DRM driver can request a duty
> cycle of 4/7 when using LVDS? Currently the DRM driver communicates
> its requirements by explicitly setting the parent.

Based on your idea we can add at cpg lvl:

	.get_duty_cycle = rzv2h_cpg_plldsi_smux_get_duty_cycle,
	.set_duty_cycle = rzv2h_cpg_plldsi_smux_set_duty_cycle,

That select parent based on requested duty cycle:

  - If duty > 50% (num/den > 1/2), select LVDS path (parent 0)
  - Otherwise, select DSI/RGB path (parent 1)

Then at DRM lvl we can go for:

	if (rzg2l_du_has(rcdu, RG2L_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);
	  }

What do you think? Please correct me if I'm wrong.
Glad to hear from Laurent's input too.

Thank you both in advance.

Kind Regards,
Tommaso


> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 

  reply	other threads:[~2026-01-23 15:52 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 14:07 [PATCH 00/22] Add support for DU and DSI on the Renesas RZ/G3E SoC Tommaso Merciai
2025-11-26 14:07 ` [PATCH 01/22] clk: renesas: rzv2h: Add PLLDSI clk mux support Tommaso Merciai
2026-01-09 18:27   ` Geert Uytterhoeven
2026-01-12  8:12     ` Tommaso Merciai
2026-01-14 13:07       ` Geert Uytterhoeven
2026-01-23 15:52         ` Tommaso Merciai [this message]
2026-01-14 12:59   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 02/22] clk: renesas: r9a09g047: Add CLK_PLLETH_LPCLK support Tommaso Merciai
2026-01-09 18:27   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 03/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1} clocks Tommaso Merciai
2026-01-09 18:35   ` Geert Uytterhoeven
2026-01-09 18:35     ` [PATCH 03/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0, 1} clocks Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 04/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_DIV7 clocks Tommaso Merciai
2025-11-26 14:07   ` [PATCH 04/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0, 1}_DIV7 clocks Tommaso Merciai
2026-01-09 18:36   ` [PATCH 04/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_DIV7 clocks Geert Uytterhoeven
2026-01-09 18:36     ` [PATCH 04/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0, 1}_DIV7 clocks Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 05/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_CSDIV clocks Tommaso Merciai
2025-11-26 14:07   ` [PATCH 05/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0, 1}_CSDIV clocks Tommaso Merciai
2026-01-09 18:37   ` [PATCH 05/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0,1}_CSDIV clocks Geert Uytterhoeven
2026-01-09 18:37     ` [PATCH 05/22] clk: renesas: r9a09g047: Add CLK_PLLDSI{0, 1}_CSDIV clocks Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 06/22] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0,1}_CLK Tommaso Merciai
2025-11-26 14:07   ` [PATCH 06/22] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0, 1}_CLK Tommaso Merciai
2026-01-09 18:38   ` [PATCH 06/22] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0,1}_CLK Geert Uytterhoeven
2026-01-09 18:38     ` [PATCH 06/22] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0, 1}_CLK Geert Uytterhoeven
2026-01-13 13:51     ` [PATCH 06/22] clk: renesas: r9a09g047: Add support for SMUX2_DSI{0,1}_CLK Tommaso Merciai
2025-11-26 14:07 ` [PATCH 07/22] clk: renesas: r9a09g047: Add support for DSI clocks and resets Tommaso Merciai
2026-01-09 18:39   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 08/22] clk: renesas: r9a09g047: Add support for LCDC{0,1} " Tommaso Merciai
2025-11-26 14:07   ` [PATCH 08/22] clk: renesas: r9a09g047: Add support for LCDC{0, 1} " Tommaso Merciai
2026-01-09 18:39   ` [PATCH 08/22] clk: renesas: r9a09g047: Add support for LCDC{0,1} " Geert Uytterhoeven
2026-01-09 18:39     ` [PATCH 08/22] clk: renesas: r9a09g047: Add support for LCDC{0, 1} " Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 09/22] dt-bindings: display: bridge: renesas,dsi: Add support for RZ/G3E SoC Tommaso Merciai
2025-11-26 14:07   ` [PATCH 09/22] dt-bindings: display: bridge: renesas, dsi: " Tommaso Merciai
2025-11-30  8:24   ` [PATCH 09/22] dt-bindings: display: bridge: renesas,dsi: " Krzysztof Kozlowski
2026-01-09 16:06     ` Tommaso Merciai
2026-01-09 16:22       ` Geert Uytterhoeven
2026-01-09 17:36         ` Tommaso Merciai
2026-01-09 17:59           ` Geert Uytterhoeven
2026-01-12 11:17             ` Tommaso Merciai
2026-01-12 11:35               ` Geert Uytterhoeven
2026-01-12 11:59                 ` Tommaso Merciai
2026-01-12 13:33                   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Tommaso Merciai
2025-11-26 14:07   ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Tommaso Merciai
2025-12-03  8:23   ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Krzysztof Kozlowski
2025-12-03 13:41     ` Tommaso Merciai
2026-01-14 12:37       ` Geert Uytterhoeven
2026-01-14 12:37         ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Geert Uytterhoeven
2026-01-15  7:48         ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Biju Das
2026-01-15  7:48           ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Biju Das
2026-01-15  8:24           ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Geert Uytterhoeven
2026-01-15  8:24             ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Geert Uytterhoeven
2026-01-15 10:10             ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Biju Das
2026-01-15 10:10               ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Biju Das
2026-01-15 10:22               ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Geert Uytterhoeven
2026-01-15 10:22                 ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Geert Uytterhoeven
2026-01-15 10:34                 ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Biju Das
2026-01-15 10:34                   ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Biju Das
2026-01-15 10:51                   ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Geert Uytterhoeven
2026-01-15 10:51                     ` [PATCH 10/22] dt-bindings: display: renesas, rzg2l-du: " Geert Uytterhoeven
2026-01-09 15:59   ` [PATCH 10/22] dt-bindings: display: renesas,rzg2l-du: " Tommaso Merciai
2025-11-26 14:07 ` [PATCH 11/22] drm: renesas: rz-du: mipi_dsi: Add out_port to OF data Tommaso Merciai
2025-11-26 14:07 ` [PATCH 12/22] drm: renesas: rz-du: mipi_dsi: Add RZ_MIPI_DSI_FEATURE_GPO0R feature Tommaso Merciai
2025-11-26 14:07 ` [PATCH 13/22] drm: renesas: rz-du: mipi_dsi: Add support for RZ/G3E Tommaso Merciai
2025-11-26 14:07 ` [PATCH 14/22] drm: renesas: rz-du: Add RZ/G3E support Tommaso Merciai
2026-01-14  9:58   ` Tommaso Merciai
2025-11-26 14:07 ` [PATCH 15/22] media: dt-bindings: media: renesas,vsp1: Document RZ/G3E Tommaso Merciai
2025-11-26 14:07   ` [PATCH 15/22] media: dt-bindings: media: renesas, vsp1: " Tommaso Merciai
2025-12-03  8:25   ` [PATCH 15/22] media: dt-bindings: media: renesas,vsp1: " Krzysztof Kozlowski
2026-01-14 15:10   ` Geert Uytterhoeven
2026-01-14 15:10     ` [PATCH 15/22] media: dt-bindings: media: renesas, vsp1: " Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 16/22] media: dt-bindings: media: renesas,fcp: Document RZ/G3E SoC Tommaso Merciai
2025-11-26 14:07   ` [PATCH 16/22] media: dt-bindings: media: renesas, fcp: " Tommaso Merciai
2025-12-03  8:26   ` [PATCH 16/22] media: dt-bindings: media: renesas,fcp: " Krzysztof Kozlowski
2026-01-14 15:11   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 17/22] arm64: dts: renesas: r9a09g047: Add fcpvd0 node Tommaso Merciai
2026-01-14 15:12   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 18/22] arm64: dts: renesas: r9a09g047: Add vspd0 node Tommaso Merciai
2026-01-14 15:15   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 19/22] arm64: dts: renesas: r9a09g047: Add fcpvd1 node Tommaso Merciai
2026-01-14 15:14   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 20/22] arm64: dts: renesas: r9a09g047: Add vspd1 node Tommaso Merciai
2026-01-14 15:16   ` Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 21/22] arm64: dts: renesas: r9a09g047: Add DU{0,1} and DSI nodes Tommaso Merciai
2025-11-26 14:07   ` [PATCH 21/22] arm64: dts: renesas: r9a09g047: Add DU{0, 1} " Tommaso Merciai
2026-01-14 15:23   ` [PATCH 21/22] arm64: dts: renesas: r9a09g047: Add DU{0,1} " Geert Uytterhoeven
2026-01-14 15:23     ` [PATCH 21/22] arm64: dts: renesas: r9a09g047: Add DU{0, 1} " Geert Uytterhoeven
2025-11-26 14:07 ` [PATCH 22/22] arm64: dts: renesas: r9a09g047e57-smarc: Enable DU1 and DSI support Tommaso Merciai
2025-11-29 15:33 ` [PATCH 00/22] Add support for DU and DSI on the Renesas RZ/G3E SoC Biju Das

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=aXOZKK7alxiHJRUk@tom-desktop \
    --to=tommaso.merciai.xr@bp.renesas.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.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@linux-m68k.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=krzk+dt@kernel.org \
    --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=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.