linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Etienne CARRIERE - foss <etienne.carriere@foss.st.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	Cristian Marussi <cristian.marussi@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	"arm-scmi@vger.kernel.org" <arm-scmi@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] firmware: arm_scmi: round rate bisecting in discrete rates
Date: Mon, 9 Dec 2024 08:16:24 +0000	[thread overview]
Message-ID: <4c39a5a437fa42d483d1f704ec7ab4ac@foss.st.com> (raw)
In-Reply-To: <7fe840af-d56d-4cb6-8d82-d42631409b2a@stanley.mountain>

Hello Dan,

Thanks for looking at this change.

On Friday, December 6, 2024, Dan Carpenter wrote:
> 
> On Tue, Dec 03, 2024 at 06:39:08PM +0100, Etienne Carriere wrote:
> > diff --git a/drivers/clk/clk-scmi.c b/drivers/clk/clk-scmi.c
> > index 09ccd6cea7f2..7bbb2ee55f4f 100644
> > --- a/drivers/clk/clk-scmi.c
> > +++ b/drivers/clk/clk-scmi.c
> > @@ -61,13 +61,20 @@ static long scmi_clk_round_rate(struct clk_hw *hw, unsigned long rate,
> >       struct scmi_clk *clk = to_scmi_clk(hw);
> >
> >       /*
> > -      * We can't figure out what rate it will be, so just return the
> > +      * In case we can't figure out what rate it will be when the clock
> > +      * describes a list of discrete rates, then just return the
> >        * rate back to the caller. scmi_clk_recalc_rate() will be called
> >        * after the rate is set and we'll know what rate the clock is
> >        * running at then.
> >        */
> > -     if (clk->info->rate_discrete)
> > +     if (clk->info->rate_discrete) {
> > +             ftmp = rate;
> 
> No need for this assignment.

It is needed. The round_rate handler in scmi clock protocol driver 
I added in drivers/firmware/arm_scmi/clock.c expects the argument
to carry the target rate as input value and provide the closest reachable
rate as output value, hence initializing @ftmp above. I needed to preserve
the value @rate since used if this round_rate handle is not available
or returns with an error.

Note that I could have changed scmi_proto_clk_ops->round_rate() 
function ABI to split input target rate and output rounded rate into
2 separated explicit arguments.

Regards,
Etienne

> 
> > +             if (scmi_proto_clk_ops->round_rate &&
> > +                 !scmi_proto_clk_ops->round_rate(clk->ph, clk->id, &ftmp))
> > +                     return ftmp;
> > +
> >               return rate;
> > +     }
> >
> >       fmin = clk->info->range.min_rate;
> >       fmax = clk->info->range.max_rate;
> 
> regards,
> dan carpenter
> 

  reply	other threads:[~2024-12-09  8:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 17:39 [PATCH v2 0/2] firmware: arm_scmi: unbound discrete rates, support round rate Etienne Carriere
2024-12-03 17:39 ` [PATCH v2 1/2] firmware: arm_scmi: get only min/max clock rates Etienne Carriere
2024-12-09 10:33   ` Sudeep Holla
2024-12-09 13:48     ` Etienne CARRIERE - foss
2024-12-09 18:01       ` Cristian Marussi
2024-12-10 10:58         ` Etienne CARRIERE - foss
2024-12-03 17:39 ` [PATCH v2 2/2] firmware: arm_scmi: round rate bisecting in discrete rates Etienne Carriere
2024-12-06 20:28   ` Dan Carpenter
2024-12-09  8:16     ` Etienne CARRIERE - foss [this message]
2024-12-09  9:12       ` Dan Carpenter
2024-12-09 10:46   ` Sudeep Holla
2024-12-09 12:59     ` Etienne CARRIERE - foss
2024-12-09 17:12       ` Sudeep Holla
2024-12-10 10:52         ` Etienne CARRIERE - foss
2024-12-13 11:24           ` Etienne CARRIERE - foss

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=4c39a5a437fa42d483d1f704ec7ab4ac@foss.st.com \
    --to=etienne.carriere@foss.st.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=sudeep.holla@arm.com \
    /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;
as well as URLs for NNTP newsgroup(s).