linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Michael Turquette <mturquette@baylibre.com>
Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	sboyd@codeaurora.org, lee.jones@linaro.org,
	s.hauer@pengutronix.de, geert@linux-m68k.org
Subject: Re: [PATCH RFC RFT 0/3] clk: detect per-user enable imbalances and implement hand-off
Date: Thu, 1 Oct 2015 21:56:53 +0200	[thread overview]
Message-ID: <20151001195653.GL7104@lukather> (raw)
In-Reply-To: <20150930123649.3201.75689@quantum>

[-- Attachment #1: Type: text/plain, Size: 4028 bytes --]

On Wed, Sep 30, 2015 at 05:36:49AM -0700, Michael Turquette wrote:
> Quoting Maxime Ripard (2015-08-28 20:55:57)
> > Hi Mike,
> > 
> > On Tue, Aug 25, 2015 at 02:50:51PM -0700, Michael Turquette wrote:
> > > Quoting Maxime Ripard (2015-08-20 08:15:10)
> > > > On Tue, Aug 18, 2015 at 09:43:56AM -0700, Michael Turquette wrote:
> > > > > Quoting Maxime Ripard (2015-08-18 08:45:52)
> > > > > > Hi Mike,
> > > > > > 
> > > > > > On Fri, Aug 07, 2015 at 12:09:27PM -0700, Michael Turquette wrote:
> > > > > > > All of the other kitchen sink stuff (DT binding, passing the flag back
> > > > > > > to the framework when the clock consumer driver calls clk_put) was left
> > > > > > > out because I do not see a real use case for it. If one can demonstrate
> > > > > > > a real use case (and not a hypothetical one) then this patch series can
> > > > > > > be expanded further.
> > > > > > 
> > > > > > I think there is a very trivial use case for passing back the
> > > > > > reference to the framework, if during the probed, we have something
> > > > > > like:
> > > > > > 
> > > > > > clk = clk_get()
> > > > > > clk_prepare_enable(clk)
> > > > > > foo_framework_register()
> > > > > > 
> > > > > > if foo_framework_register fails, the sensible thing to do would be to
> > > > > > call clk_disable_unprepare. If the clock was a critical clock, you
> > > > > > just gated it.
> > > > > 
> > > > > Hmm, a good point. Creating the "pass the reference back" call is not
> > > > > hard technically. But how to keep from abusing it? E.g. I do not want
> > > > > that call to become an alternative to correct use of clk_enable.
> > > > > 
> > > > > Maybe I'll need a Coccinelle script or just some regular sed to
> > > > > occasionally search for new users of this api and audit them?
> > > > > 
> > > > > I was hoping to not add any new consumer api at all :-/
> > > > 
> > > > I don't think there's any abuse that can be done with the current API,
> > > > nor do I think you need to have new functions either.
> > > > 
> > > > If the clock is critical, when the customer calls
> > > > clk_unprepare_disable on it, simply take back the reference you gave
> > > > in the framework, and you're done. Or am I missing something?
> > > 
> > > Maybe I am the one missing something? My goal was to allow the consumer
> > > driver to gate the critical clock. So we need clk_disable_unused to
> > > actually disable the clock for that to work.
> > 
> > Yeah, but I guess the consumer driver clock gating is not the default
> > mode of operations.
> > 
> > Under normal circumstances, it should just always leave the clock
> > enabled, all the time.
> > 
> > > I think you are suggesting that clk_disable_unused should *not* disable
> > > the clock if it is critical. Can you confirm that?
> > 
> > By default, yes.
> > 
> > Now, we also have the knowledgeable driver case wanting to force the
> > clock gating. I think it's an orthogonal issue, we might have the same
> > use case for non-critical clocks, and since it's hard to get that done
> > with the current API, and that we don't really know what a
> > knowledgeable driver will look like at this point, maybe we can just
> > delay this entirely until we actually have one in front of us?
> 
> Yes. I discussed this face to face with Lee last week at Linaro Connect.
> I proposed the following:
> 
> 1) support an always-on clk, which is enabled by the framework at
> registration-time and can never be claimed and gated
> 
> 2) support a hand-off clk, which is enabled by the framework at
> registration-time and whose reference counts are handed off to the first
> driver to get, prepare and enable this clk
> 
> 3) forget about knowledgeable drivers because nobody needs this (yet)
> 
> Lee was happy with this. Does it sound OK to you?

Yep, it sounds good!

See you in Dublin,

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-10-01 20:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 19:09 [PATCH RFC RFT 0/3] clk: detect per-user enable imbalances and implement hand-off Michael Turquette
2015-08-07 19:09 ` [PATCH RFC RFT 1/3] clk: per-user clk prepare & enable ref counts Michael Turquette
2015-08-10 13:47   ` Maxime Coquelin
2015-08-10 19:31     ` Michael Turquette
2015-08-07 19:09 ` [PATCH RFC RFT 2/3] clk: clk_put WARNs if user has not disabled clk Michael Turquette
2015-09-30 15:38   ` Geert Uytterhoeven
     [not found]     ` <20151020124000.20687.60752@quantum>
2015-10-20 12:52       ` Russell King - ARM Linux
2015-10-21  9:50       ` Geert Uytterhoeven
2015-10-21 10:59         ` Russell King - ARM Linux
2015-10-21 15:50           ` Michael Turquette
2015-10-21 16:46             ` Geert Uytterhoeven
2015-08-07 19:09 ` [PATCH RFC RFT 3/3] clk: introduce CLK_ENABLE_HAND_OFF flag Michael Turquette
2015-08-10 14:48   ` Lee Jones
     [not found]     ` <20150810185516.2416.32293@quantum>
2015-08-11  8:43       ` Lee Jones
2015-08-11 10:02         ` Maxime Coquelin
2015-08-11 10:11           ` Geert Uytterhoeven
2015-08-11 11:36             ` Maxime Coquelin
2015-08-11 11:41               ` Maxime Coquelin
2015-08-11 11:49                 ` Geert Uytterhoeven
2015-08-11 12:03                   ` Maxime Coquelin
2015-08-11 12:34                     ` Geert Uytterhoeven
2015-08-11 12:03                   ` Lee Jones
2015-08-11 17:09             ` Michael Turquette
2015-08-11 18:17               ` Lee Jones
2015-08-12  7:27                 ` Geert Uytterhoeven
2015-08-12  7:51                   ` Lee Jones
2015-08-11 17:09           ` Michael Turquette
2015-08-11 18:20             ` Lee Jones
     [not found]         ` <20150811170904.2416.43354@quantum>
2015-08-11 18:33           ` Lee Jones
     [not found]             ` <20150811185827.31346.68194@quantum>
2015-08-18 15:52               ` Maxime Ripard
     [not found]                 ` <20150818163356.31346.15075@quantum>
2015-08-20 15:11                   ` Maxime Ripard
2015-08-18 15:58   ` Maxime Ripard
     [not found]     ` <20150818163931.31346.78267@quantum>
2015-08-20 15:39       ` Maxime Ripard
2015-08-10 15:36 ` [PATCH RFC RFT 0/3] clk: detect per-user enable imbalances and implement hand-off Lee Jones
     [not found]   ` <20150810192810.2416.25672@quantum>
2015-08-11  9:11     ` Lee Jones
2015-08-11  9:20 ` Geert Uytterhoeven
     [not found]   ` <20150811164151.2416.33353@quantum>
2015-08-11 17:42     ` Geert Uytterhoeven
2015-08-18 15:45 ` Maxime Ripard
     [not found]   ` <20150818164356.31346.80341@quantum>
2015-08-20 15:15     ` Maxime Ripard
     [not found]       ` <20150825215051.31346.56261@quantum>
2015-08-26  6:54         ` Lee Jones
2015-08-26  8:42           ` Maxime Coquelin
2015-08-26  9:09             ` Lee Jones
2015-08-26  9:37               ` Maxime Coquelin
2015-08-26 20:41                 ` Lee Jones
2015-08-29  3:49           ` Maxime Ripard
2015-08-29  3:55         ` Maxime Ripard
     [not found]           ` <20150930123649.3201.75689@quantum>
2015-10-01 19:56             ` Maxime Ripard [this message]
2015-11-24  9:48 ` Heiko Stübner
2015-12-05  0:46   ` Michael Turquette
2016-02-11 21:33     ` Michael Turquette

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=20151001195653.GL7104@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=geert@linux-m68k.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@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 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).