All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] clk: Don't show the incorrect clock phase
Date: Thu, 08 Mar 2018 12:39:50 +0100	[thread overview]
Message-ID: <1520509190.4264.28.camel@baylibre.com> (raw)
In-Reply-To: <1520509048.4264.26.camel@baylibre.com>

On Thu, 2018-03-08 at 12:37 +0100, Jerome Brunet wrote:
> On Thu, 2018-03-08 at 19:28 +0800, Shawn Lin wrote:
> > > > +    if (core->phase < 0 && core->ops->get_phase)
> > > 
> > > Why bother with core->phase < 0 ?
> > > if core->ops->get_phase is available, why not call it anyway ?
> > > 
> > > The phase may have changed since it was cached.
> > > 
> > > A typical example would be phases based on adding fixed delays:
> > > 
> > > * Take a 200MHz clock and set phase to 180 => a 2.5ns delay is set
> > > * Clock rate change to 100MHz but delay is still 2.5ns
> > >     -> cached phase = 180
> > >     -> actual phase = 90
> > 
> > Good point!
> > 
> > (1)So either we should update phase once its rate is updated, for
> > instance, doing it in clk_change_rate, or
> 
> I don't think this would be a good option. The phase depending on the rate is
> just one example. I'm pretty sure one could come up with another example 
> 
> > 
> > (2)we should always try to get the actual phase here.
> 
> If the callback is available, lets use it. I prefer this second option
> 
> > 
> > If we do anyway call ->get_phase, we should never need core->phase since
> > it doesn't reflect the actual phase maybe.
> 
> The cached value is used by debugfs so it is still a valuable information. I
> would keep it around for now.

Oh ! and let's not forget that a clock driver is allowed to implement
set_phase() w/o implementing get_phase() ... so you definitively want to keep
the cached value around

> 
> > 
> > Am I right? If yes, which option is more reasonable?
> 
> 

  reply	other threads:[~2018-03-08 11:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08  7:54 [PATCH] clk: Don't show the incorrect clock phase Shawn Lin
2018-03-08  9:40 ` Geert Uytterhoeven
2018-03-08 11:15   ` Shawn Lin
2018-03-08 10:04 ` Jerome Brunet
2018-03-08 11:28   ` Shawn Lin
2018-03-08 11:37     ` Jerome Brunet
2018-03-08 11:39       ` Jerome Brunet [this message]
2018-03-08 11:46         ` Shawn Lin
2018-03-08 12:03           ` Jerome Brunet
2018-03-08 12:11             ` Shawn Lin

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=1520509190.4264.28.camel@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=geert@linux-m68k.org \
    --cc=heiko@sntech.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=shawn.lin@rock-chips.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 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.