linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: Meaning of clk_round_rate()?
Date: Wed, 14 Jul 2010 11:05:46 -0700	[thread overview]
Message-ID: <4C3DFC7A.8020002@codeaurora.org> (raw)

  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%?

Assuming it's doing closest matching, I don't see how it's very useful 
in practice. Some users of clk_round_rate() are blindly searching up and 
down in the frequency space until they find a suitable rate (see 
sound/atmel/abdac.c and sound/spi/at73c213.c). These drivers might be 
better served by something like a clk_round_rate_up() and a 
clk_round_rate_down() which would round the rate to the nearest higher 
and lower frequency respectively without requiring complex loops around 
clk_round_rate().

In addition, an up/down rounding approach would make it simpler for 
drivers to find a min/max rate (for example display panels have a max 
frequency they can support).

A similar approach was suggested by David Brownell [1] but nothing came 
of it.

[1] http://article.gmane.org/gmane.linux.ports.arm.kernel/38076

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

             reply	other threads:[~2010-07-14 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-14 18:05 Stephen Boyd [this message]
2010-07-14 20:03 ` Meaning of clk_round_rate()? Russell King - ARM Linux
2010-07-15  3:37   ` Stephen Boyd
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=4C3DFC7A.8020002@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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 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).