mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Zhao <linuxzsc@gmail.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: "Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	"Ben Dooks" <ben-linux@fluff.org>,
	"Lorenzo Pieralisi" <Lorenzo.Pieralisi@arm.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	linux-sh <linux-sh@vger.kernel.org>,
	"Ben Herrenschmidt" <benh@kernel.crashing.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Jeremy Kerr" <jeremy.kerr@canonical.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: Locking in the clk API
Date: Sat, 22 Jan 2011 12:08:00 +0800	[thread overview]
Message-ID: <20110122040757.GA2094@richard-laptop> (raw)
In-Reply-To: <AANLkTikJjkJvr2J-9eq2-Jj8L=JvwUQS+QNj9gWFX-TL@mail.gmail.com>

On Fri, Jan 21, 2011 at 01:47:29PM +0900, Jassi Brar wrote:
> On Fri, Jan 21, 2011 at 9:09 AM, Jassi Brar <jassisinghbrar@gmail.com> wrote:
> > On Fri, Jan 21, 2011 at 4:08 AM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> >> On Thu, Jan 20, 2011 at 05:02:55PM +0000, Ben Dooks wrote:
> >>> If you want to make it so that each low-power mode has to work
> >>> out what PLLs need to be disabled and then re-enabled makes me
> >>> want to be sick. Hiding this stuff behind specific implementations
> >>> is a recipe for disaster.
> >>
> >> Why should systems which don't suffer from such problems be prevented
> >> from gaining power saving from turning off their clocks when devices
> >> are not being used (eg, the console serial port.)
> >>
> >> One solution to your root PLL issue would be to have a separate set of
> >> enable/disable API calls which get called at setup/release time (or
> >> whatever you'd like to call it) which can only be called from non-atomic
> >> context.  Maybe clk_prepare() and clk_unprepare().  These functions
> >> should perform whatever is necessary to ensure that the clock source
> >> is available for use atomically when clk_enable() is called.
> >>
> >> So, in your case, clk_prepare() ensures that the root PLL is enabled,
> >> clk_unprepare() allows it to be turned off.
> >>
> >> In the case of a console driver, clk_prepare() can be called when we
> >> know the port will be used as a console.  clk_enable() is then called
> >> before writing out the string, and clk_disable() after we've completely
> >> sent the last character.
> >>
> >> This allows the best of both worlds.  We now have a clk_enable() which
> >> can be used to turn the clocks off through the clock tree up to the first
> >> non-atomic clock, and we also have a way to deal with those which need
> >> to sleep.  So not only do "sleeping clock" implementations become possible
> >> but these "sleeping clock" implementations also get the opportunity to
> >> shutdown some of their clock tree with minimal latency for doing so.
> >
> > This is exactly what I suggested in my last post, except the console example.
> > Only to be a part of common clock api because it's not very safe to assume
> > future SoCs will have the same simple clock topologies that they have today.
> >
> > Not to mean to teach, but I hope you realize with more and more
> > device controller being crammed into ever shrinking SoCs,
> > clock would eventually have to be flexible in functionality
> > and complicated in hierarchy. Ben already gave examples
> > of Audio, MFC and Video controllers of latest Samsung SoCs.
> 
> plus
> 
> a) If only Samsung bsp implements the api, it would be impossible to
> share drivers, those that can be, with other platforms without nasty ifdef's.
> b) If the task of unification starts with only a particular platform made to
> implement a new api, the attempt kills its own purpose.
I'm not clear. Why does Samsung SoC go against clk_prepare/unprepare?
If its clock tree has many plls and device clock is not far away from plls and
may sleep, we may use prepare/unprepare to do actually clock enable/disable.

Thanks
Richard

  parent reply	other threads:[~2011-01-22  4:08 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11  2:16 Jeremy Kerr
2011-01-11  3:15 ` Paul Mundt
2011-01-11  4:11   ` Jeremy Kerr
2011-01-11  4:54     ` Paul Mundt
2011-01-20 16:32       ` Ben Dooks
2011-01-20 18:57         ` Russell King - ARM Linux
2011-01-21  3:43           ` Saravana Kannan
2011-01-21  9:31             ` Russell King - ARM Linux
2011-01-11  9:03     ` Sascha Hauer
2011-01-11  9:28       ` Russell King - ARM Linux
2011-01-11 14:34         ` Pavel Machek
2011-01-20 16:29   ` Ben Dooks
2011-01-20 18:56     ` Russell King - ARM Linux
2011-01-20 21:30       ` Nicolas Pitre
2011-01-21  2:06         ` Dima Zavin
2011-01-21  4:12           ` Saravana Kannan
2011-01-21  9:32             ` Russell King - ARM Linux
2011-01-21 21:03             ` Dima Zavin
2011-01-21 21:53               ` Nicolas Pitre
2011-01-21 22:02                 ` Russell King - ARM Linux
2011-01-21 22:28                   ` Colin Cross
2011-01-21 23:21                     ` Benjamin Herrenschmidt
2011-01-21 23:50                     ` Nicolas Pitre
2011-01-22  1:35                     ` Saravana Kannan
2011-01-22  2:22                       ` Colin Cross
2011-01-21 22:29                   ` Nicolas Pitre
2011-01-21 23:28                 ` Bryan Huntsman
2011-01-11  9:16 ` Russell King - ARM Linux
2011-01-11  9:44   ` Jeremy Kerr
2011-01-11 10:13     ` Paul Mundt
2011-01-11 10:30       ` Jeremy Kerr
2011-01-11 12:18         ` Paul Mundt
2011-01-11 13:52           ` Uwe Kleine-König
2011-01-11 14:35           ` Jeremy Kerr
2011-01-12  3:25             ` Saravana Kannan
2011-01-12  7:40               ` Uwe Kleine-König
2011-01-12  1:54           ` Saravana Kannan
2011-01-12  2:25             ` Paul Mundt
2011-01-20 16:57               ` Ben Dooks
2011-01-20 16:53           ` Ben Dooks
2011-01-20 16:40       ` Ben Dooks
2011-01-11 10:39     ` Uwe Kleine-König
2011-01-11 10:47       ` Russell King - ARM Linux
2011-01-11 10:56         ` Uwe Kleine-König
2011-01-11 11:15       ` Richard Zhao
2011-01-20 17:02         ` Ben Dooks
2011-01-20 19:08           ` Russell King - ARM Linux
2011-01-21  0:09             ` Jassi Brar
2011-01-21  4:47               ` Jassi Brar
2011-01-21  9:39                 ` Russell King - ARM Linux
2011-01-21 10:11                   ` Jassi Brar
2011-01-22  4:08                 ` Richard Zhao [this message]
2011-01-22  5:30                   ` Jassi Brar
2011-01-21  7:16             ` Saravana Kannan
2011-01-21  9:40               ` Russell King - ARM Linux
2011-01-27  4:34                 ` Saravana Kannan
2011-01-27  8:54                   ` Russell King - ARM Linux
2011-01-27 20:30                     ` Saravana Kannan
2011-01-27 20:43                       ` Russell King - ARM Linux
2011-01-27 21:07                         ` Alan Cox
2011-01-27 21:11                           ` Russell King - ARM Linux
2011-01-27 21:15                           ` Russell King - ARM Linux
2011-01-28  3:29                           ` Saravana Kannan
2011-01-28  3:27                         ` Saravana Kannan
2011-01-11 12:11   ` Jassi Brar
2011-01-12  2:56   ` Saravana Kannan
2011-01-12  9:03     ` Russell King - ARM Linux
2011-01-15 14:02       ` Christer Weinigel
2011-01-15 14:53         ` Russell King - ARM Linux
2011-01-15 15:03           ` Uwe Kleine-König
2011-01-15 15:15             ` Russell King - ARM Linux
2011-01-15 16:03               ` Uwe Kleine-König
2011-01-15 16:21                 ` Russell King - ARM Linux
2011-01-15 16:31                   ` Uwe Kleine-König
2011-01-16  6:59               ` Grant Likely
2011-01-15 17:07           ` Christer Weinigel
2011-01-15 17:20             ` Russell King - ARM Linux
2011-01-15 17:44               ` Christer Weinigel
2011-01-15 20:30                 ` Russell King - ARM Linux
2011-01-17  1:19 ` Jeremy Kerr
2011-01-17  1:27 Jeremy Kerr

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=20110122040757.GA2094@richard-laptop \
    --to=linuxzsc@gmail.com \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=ben-linux@fluff.org \
    --cc=benh@kernel.crashing.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=jeremy.kerr@canonical.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=s.hauer@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vincent.guittot@linaro.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

all inboxes | Powered by JetHome®