All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: RE: [PATCH v2 3/9] clk: renesas: rzg2l: Add DSI divider clk support
Date: Fri, 29 Apr 2022 09:50:08 +0000	[thread overview]
Message-ID: <OS0PR01MB5922F0C5A80F26109A27BC5D86FC9@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAMuHMdUo6J7_hfsoDYprMc7Tk79D4FxQiXJ7hFH8s_6nzptsUw@mail.gmail.com>

Hi Geert,

Thanks for the feedback.

> Subject: Re: [PATCH v2 3/9] clk: renesas: rzg2l: Add DSI divider clk
> support
> 
> Hi Biju,
> 
> On Wed, Apr 27, 2022 at 11:48 AM Biju Das <biju.das.jz@bp.renesas.com>
> wrote:
> > M3 clock is sourced from DSI Divider (DSIDIVA * DSIDIVB)
> >
> > This patch add support for DSI divider clk by combining DSIDIVA and
> > DSIDIVB .
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > V1->V2:
> >  * Replaced round_rate with determine_rate
> >  * Update rate variable during set_rate
> >  * Added get_vclk_parent_rate helper function
> >  * Replaced pll5_params with mux_dsi_div_params for dsi div values.
> 
> Thanks for the update!
> 
> > --- a/drivers/clk/renesas/rzg2l-cpg.c
> > +++ b/drivers/clk/renesas/rzg2l-cpg.c
> 
> > +static unsigned long rzg2l_cpg_get_vclk_parent_rate(struct clk_hw *hw,
> > +                                                   unsigned long
> > +rate) {
> > +       unsigned long parent_rate;
> 
> Please drop the blank line.
OK.

> 
> > +
> > +       struct dsi_div_hw_data *dsi_div = to_dsi_div_hw_data(hw);
> > +       struct rzg2l_cpg_priv *priv = dsi_div->priv;
> > +       struct rzg2l_pll5_param params;
> 
> Reverse Xmas tree order?
OK.
> 
> > +
> > +       parent_rate = rzg2l_cpg_get_foutpostdiv_rate(&params, rate);
> > +
> > +       if (priv->mux_dsi_div_params.clksrc)
> > +               parent_rate /= 2;
> > +
> > +       return parent_rate;
> > +}
> > +
> > +static int rzg2l_cpg_dsi_div_determine_rate(struct clk_hw *hw,
> > +                                           struct clk_rate_request
> > +*req) {
> > +       req->best_parent_rate = rzg2l_cpg_get_vclk_parent_rate(hw,
> > +req->rate);
> > +
> > +       return 0;
> 
> So any value of req->rate passed is supported, and req->rate never needs
> to be updated?

Yes, We can add a check for freq greater than 148.5MHz and if it is greater,
Assign req->rate to 148.5MHz.

> 
> > +}
> > +
> > +static int rzg2l_cpg_dsi_div_set_rate(struct clk_hw *hw,
> > +                                     unsigned long rate,
> > +                                     unsigned long parent_rate) {
> > +       struct dsi_div_hw_data *dsi_div = to_dsi_div_hw_data(hw);
> > +       struct rzg2l_cpg_priv *priv = dsi_div->priv;
> > +
> > +       /*
> > +        * MUX -->DIV_DSI_{A,B} -->M3 -->VCLK
> > +        *
> > +        * Based on the dot clock, the DSI divider clock sets the
> divider value,
> > +        * calculates the pll parameters for generating FOUTPOSTDIV and
> the clk
> > +        * source for the MUX and propagates that info to the parents.
> > +        */
> > +
> > +       if (!rate)
> > +               return -EINVAL;
> > +
> > +       dsi_div->rate = rate;
> 
> So any non-zero value of rate is supported?

Currently yes, But If we add a check for > 148.5Mhz in determine_rate, it will allow only upto 148.5Mhz.

Regards,
Biju

> 
> > +       writel(CPG_PL5_SDIV_DIV_DSI_A_WEN | CPG_PL5_SDIV_DIV_DSI_B_WEN |
> > +              (priv->mux_dsi_div_params.dsi_div_a << 0) |
> > +              (priv->mux_dsi_div_params.dsi_div_b << 8),
> > +              priv->base + CPG_PL5_SDIV);
> > +
> > +       return 0;
> > +}
> 
> 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:[~2022-04-29  9:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  9:48 [PATCH v2 0/9] Add RZ/G2L Display clock support Biju Das
2022-04-27  9:48 ` [PATCH v2 1/9] clk: renesas: rzg2l: Add FOUTPOSTDIV clk support Biju Das
2022-04-29  9:33   ` Geert Uytterhoeven
2022-04-27  9:48 ` [PATCH v2 2/9] clk: renesas: rzg2l: Add PLL5_4 clk mux support Biju Das
2022-04-27  9:48 ` [PATCH v2 3/9] clk: renesas: rzg2l: Add DSI divider clk support Biju Das
2022-04-29  9:38   ` Geert Uytterhoeven
2022-04-29  9:50     ` Biju Das [this message]
2022-04-29  9:55       ` Geert Uytterhoeven
2022-04-29  9:59         ` Biju Das
2022-04-27  9:48 ` [PATCH v2 4/9] clk: renesas: r9a07g044: Add M1 clock support Biju Das
2022-04-27  9:48 ` [PATCH v2 5/9] clk: renesas: r9a07g044: Add {M2, M2_DIV2} Clocks support Biju Das
2022-04-27  9:48 ` [PATCH v2 6/9] clk: renesas: r9a07g044: Add M3 Clock support Biju Das
2022-04-27  9:48 ` [PATCH v2 7/9] clk: renesas: r9a07g044: Add M4 " Biju Das
2022-04-27  9:48 ` [PATCH v2 8/9] clk: renesas: r9a07g044: Add LCDC clock and reset entries Biju Das
2022-04-27  9:48 ` [PATCH v2 9/9] clk: renesas: r9a07g044: Add DSI " 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=OS0PR01MB5922F0C5A80F26109A27BC5D86FC9@OS0PR01MB5922.jpnprd01.prod.outlook.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sboyd@kernel.org \
    /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.