Re: [PATCH v2 5/9] clk: renesas: rzg2l: Add support for LVDS fixed-factor divider with 4:7 duty cycle

Geert Uytterhoeven <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.linux-clk,org.kernel.vger.linux-kernel
Message-ID <CAMuHMdV115FmUP6tiNi1YjEfOevuDvuLib7pLd1da=7JwnsNdg@mail.gmail.com>
Hi Biju,

On Tue, 11 Aug 2026 at 20:27, Biju <[email protected]> wrote:
>
> From: Biju Das <[email protected]>
>
> Add a new CLK_TYPE_G3L_LVDS_DIV clock type and register function for
> a fixed-factor divider used by the LVDS clock, which cannot produce a
> 50% duty cycle for odd divider values. Implement a custom
> get_duty_cycle() callback that reports the actual (div + 1) / 2 : div
> duty cycle, and add the DEF_G3L_LVDS_DIV() macro to define such
> clocks.
>
> Signed-off-by: Biju Das <[email protected]>

Thanks for your patch!

> +static int rzg3l_cpg_lvds_div_get_duty_cycle(struct clk_hw *hw,
> +                                            struct clk_duty *duty)
> +{
> +       struct clk_fixed_factor *fix = to_clk_fixed_factor(hw);
> +
> +       /*
> +        * An odd divider cannot generate a 50% duty cycle: the output stays
> +        * high for (div + 1) / 2 input clock cycles out of div, e.g. a divider
> +        * of 7 gives a duty cycle of 4/7.
> +        */
> +       duty->num = (fix->div + 1) / 2;

DIV_ROUND_UP()

Reviewed-by: Geert Uytterhoeven <[email protected]>
i.e. will queue in renesas-clk for v7.4, with the above fixed.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.