linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH/RFC 3/3] ARM: mach-shmobile: implement parent clock optimization for HDMI
Date: Thu, 28 Oct 2010 06:53:04 +0000	[thread overview]
Message-ID: <20101028065304.GB16806@linux-sh.org> (raw)
In-Reply-To: <Pine.LNX.4.64.1010271821580.11687@axis700.grange>

On Thu, Oct 28, 2010 at 08:29:54AM +0200, Guennadi Liakhovetski wrote:
> On Thu, 28 Oct 2010, Paul Mundt wrote:
> 
> > On Wed, Oct 27, 2010 at 06:24:26PM +0200, Guennadi Liakhovetski wrote:
> > > On ap4evb PLLC2 is used as a parent clock for the HDMI clock. To configure the
> > > HDMI clock with the highest precision this patch scans all available PLLC2
> > > frequencies and picks up the best one.
> > > 
> > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > 
> > So, what exactly does ap4evb_clk_optimize() do that you can't already do
> > with either clk_rate_table_round() or clk_rate_div_range_round()?
> 
> No, it does something pretty different: it selects the best _parent_ 
> frequency to optimize that of the _child_. So, it actually tells you "to 
> configure your clock as close as possible to frequency X you have to 
> reconfigure its parent with frequency Y." Which I don't think any of the 
> aforementioned functions does.
> 
Ok, that sounds fine.

> Well, there is a reason, why this is marked an "RFC":-) I also don't like 
> very much touching clock internals in platform code, but in a way it is 
> specific for each case. This implementation only works for clocks, whose 
> divisors are integer numbers in a certain range (without holes). Ok, with 
> clk_get_parent() the other two callbacks .clk_set_rate_parent() and 
> .clk_get_rate_parent() are automatically not needed, which is good! And I 
> would be happy to try to convert the ap4evb_clk_optimize() function into a 
> generic helper too, if we reach such an agreement.
> 
I wonder if this is something you can use/adapt clk_rate_round_helper()
for? In any event, the best place for this is in drivers/sh/clk/core.c
along with the other helpers. The ranged div iterator already takes the
parent frequency in to account, so you might be able to use a similar
approach for an iterator here, too (albeit probably inverted). If you
introduce a generic clk_rate_parent_round() or whatever then that's
pretty easy to support without any of the nasty layering violations.

I don't like having this sort of knowledge in the platform code because
there is really nothing platform specific about it. If a platform happens
to be the first to exhibit a certain type of clock topology interactivity,
then that's something the clock framework needs to expand to accomodate.
Most of these things will invariably show up on other platforms in the
future, and by then the same algorithm will have been copied all over the
place, mangled, and probably broken in a dozen different hard to debug
ways. Keeping all of the rounders centrally managed will help prevent
this, regardless of what sort of obscure topology perversion the hardware
folks come up with :-)

      parent reply	other threads:[~2010-10-28  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 16:24 [PATCH/RFC 3/3] ARM: mach-shmobile: implement parent clock optimization Guennadi Liakhovetski
2010-10-28  0:28 ` [PATCH/RFC 3/3] ARM: mach-shmobile: implement parent clock optimization for HDMI Paul Mundt
2010-10-28  6:29 ` [PATCH/RFC 3/3] ARM: mach-shmobile: implement parent clock Guennadi Liakhovetski
2010-10-28  6:53 ` Paul Mundt [this message]

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=20101028065304.GB16806@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-fbdev@vger.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 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).