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>
Cc: tomm.merciai@gmail.com, laurent.pinchart@ideasonboard.com,
	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>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org
Subject: Re: [PATCH v5 01/20] clk: renesas: rzv2h: Add PLLDSI clk mux support
Date: Fri, 27 Feb 2026 18:24:00 +0100	[thread overview]
Message-ID: <aaHTMGQHZwutlBIv@tom-desktop> (raw)
In-Reply-To: <CAMuHMdVAf=GyDR95BFD0Q3Wbjo5n5vnqSsfue=7fRWxs6=Hdgg@mail.gmail.com>

Hi Geert,
Thanks for your review!

On Fri, Feb 27, 2026 at 11:47:58AM +0100, Geert Uytterhoeven wrote:
> Hi Tommaso,
> 
> On Fri, 13 Feb 2026 at 17:28, 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().
> >
> > The CLK_SMUX2_DSI{0,1}_CLK clock multiplexers select between two paths
> > with different duty cycles:
> >
> > - CDIV7_DSIx_CLK (LVDS path, parent index 0): asymmetric H/L=4/3 duty (4/7)
> > - CSDIV_DSIx (DSI/RGB path, parent index 1): symmetric 50% duty (1/2)
> >
> > Implement rzv2h_cpg_plldsi_smux_{get,set}_duty_cycle clock operations to
> > allow the DRM driver to query and configure the appropriate clock path
> > based on the required output duty cycle.
> >
> > 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 struct clk * __init
> > +rzv2h_cpg_plldsi_smux_clk_register(const struct cpg_core_clk *core,
> > +                                  struct rzv2h_cpg_priv *priv)
> > +{
> > +       struct rzv2h_plldsi_mux_clk *clk_hw_data;
> > +       struct clk_init_data init;
> > +       struct clk_hw *clk_hw;
> > +       struct smuxed smux;
> > +       u8 width, mask;
> > +       int ret;
> > +
> > +       smux = core->cfg.smux;
> > +       mask = smux.width;
> > +       width = fls(mask) - ffs(mask) + 1;
> > +
> > +       if (width + smux.width > 16) {
> > +               dev_err(priv->dev, "mux value exceeds LOWORD field\n");
> > +               return ERR_PTR(-EINVAL);
> > +       }
> 
> I am totally confused by this: smux.width is not a mask, but the size
> of a register bitifield.
> Perhaps:
> 
>     if (smux.shift + smux.width > 16) { ... }
> 
> ?

Ouch, you are right.
Should be:

	if (smux.shift + smux.width > 16) {
		dev_err(priv->dev, "mux value exceeds LOWORD field\n");
		return ERR_PTR(-EINVAL);
	}

Will fix this in v6.

> 
> > +
> > +       clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL);
> > +       if (!clk_hw_data)
> > +               return ERR_PTR(-ENOMEM);
> > +
> > +       clk_hw_data->priv = priv;
> > +
> > +       init.name = core->name;
> > +       init.ops = &rzv2h_cpg_plldsi_smux_ops;
> > +       init.flags = core->flag;
> > +       init.parent_names = core->parent_names;
> > +       init.num_parents = core->num_parents;
> > +
> > +       clk_hw_data->mux.reg = priv->base + smux.offset;
> > +
> > +       clk_hw_data->mux.shift = smux.shift;
> > +       clk_hw_data->mux.mask = smux.width;
> 
> Again, smux.width is not a mask.
> Perhaps GENMASK_U16(smux.shift - 1, 0)?

Or maybe we can use:

	clk_hw_data->mux.mask = clk_div_mask(smux.width);
?

I'll fix this in v6.
Thanks.

Kind Regards,
Tommaso

> 
> > +       clk_hw_data->mux.flags = core->mux_flags;
> > +       clk_hw_data->mux.lock = &priv->rmw_lock;
> > +
> > +       clk_hw = &clk_hw_data->mux.hw;
> > +       clk_hw->init = &init;
> > +
> > +       ret = devm_clk_hw_register(priv->dev, clk_hw);
> > +       if (ret)
> > +               return ERR_PTR(ret);
> > +
> > +       return clk_hw->clk;
> > +}
> 
> 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-02-27 17:24 UTC|newest]

Thread overview: 51+ 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 [this message]
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 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 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 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 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-13 16:27   ` [PATCH v5 09/20] dt-bindings: display: renesas, rzg2l-du: " Tommaso Merciai
2026-02-15  8:11   ` [PATCH v5 09/20] dt-bindings: display: renesas,rzg2l-du: " 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-02-13 16:27   ` [PATCH v5 10/20] dt-bindings: display: bridge: renesas, dsi: " Tommaso Merciai
2026-03-17 12:46   ` [PATCH v5 10/20] dt-bindings: display: bridge: renesas,dsi: " 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-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 15/20] media: dt-bindings: media: renesas, vsp1: " 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 16/20] media: dt-bindings: media: renesas, fcp: " 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 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 19/20] arm64: dts: renesas: r9a09g047: Add DU{0, 1} " 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=aaHTMGQHZwutlBIv@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+renesas@ideasonboard.com \
    --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 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.