All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: linux-arm-kernel@lists.infradead.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org,
	Saravana Kannan <skannan@codeaurora.org>,
	David Brownell <david-b@pacbell.net>
Subject: Re: Meaning of clk_round_rate()?
Date: Wed, 14 Jul 2010 21:03:24 +0100	[thread overview]
Message-ID: <20100714200324.GA18138@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4C3DFC7A.8020002@codeaurora.org>

On Wed, Jul 14, 2010 at 11:05:46AM -0700, Stephen Boyd wrote:
>  What is the meaning of clk_round_rate() in the clk API  
> (include/linux/clk.h)? The function documentation says "adjust a rate to  
> the exact rate a clock can provide". That seems pretty vague. I'm lead  
> to believe that it rounds the rate to the closest rate supported. Is  
> that correct? Is there some sort of error margin where beyond that it's  
> no longer possible to be rounded? 0.5%? 1%?

clk_round_rate() returns the clock rate which will be set if you ask
clk_set_rate() to set that rate.  It provides a way to query from
the implementation exactly what rate you'll get if you use clk_set_rate()
with that same argument.

So essentially, clk_set_rate() should be:

static int clk_set_rate(struct clk *clk, unsigned long rate)
{
	rate = clk_round_rate(clk, rate);
	return set_actual_rate(clk, rate);
}

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Meaning of clk_round_rate()?
Date: Wed, 14 Jul 2010 21:03:24 +0100	[thread overview]
Message-ID: <20100714200324.GA18138@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4C3DFC7A.8020002@codeaurora.org>

On Wed, Jul 14, 2010 at 11:05:46AM -0700, Stephen Boyd wrote:
>  What is the meaning of clk_round_rate() in the clk API  
> (include/linux/clk.h)? The function documentation says "adjust a rate to  
> the exact rate a clock can provide". That seems pretty vague. I'm lead  
> to believe that it rounds the rate to the closest rate supported. Is  
> that correct? Is there some sort of error margin where beyond that it's  
> no longer possible to be rounded? 0.5%? 1%?

clk_round_rate() returns the clock rate which will be set if you ask
clk_set_rate() to set that rate.  It provides a way to query from
the implementation exactly what rate you'll get if you use clk_set_rate()
with that same argument.

So essentially, clk_set_rate() should be:

static int clk_set_rate(struct clk *clk, unsigned long rate)
{
	rate = clk_round_rate(clk, rate);
	return set_actual_rate(clk, rate);
}

  reply	other threads:[~2010-07-14 20:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14 18:05 Meaning of clk_round_rate()? Stephen Boyd
2010-07-14 18:05 ` Stephen Boyd
2010-07-14 20:03 ` Russell King - ARM Linux [this message]
2010-07-14 20:03   ` Russell King - ARM Linux
2010-07-15  3:37   ` Stephen Boyd
2010-07-15  3:37     ` Stephen Boyd
2010-07-15  6:27   ` Saravana Kannan
2010-07-15  6:27     ` Saravana Kannan

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=20100714200324.GA18138@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=david-b@pacbell.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=skannan@codeaurora.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.