linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tomi.valkeinen@ti.com (Tomi Valkeinen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/11] OMAPDSS: add clk_prepare and clk_unprepare
Date: Mon, 25 Jun 2012 16:14:50 +0300	[thread overview]
Message-ID: <1340630090.3395.85.camel@deskari> (raw)
In-Reply-To: <4FE85005.4090303@ti.com>

On Mon, 2012-06-25 at 17:18 +0530, Rajendra Nayak wrote:
> On Monday 25 June 2012 01:28 PM, Tomi Valkeinen wrote:
> > On Mon, 2012-06-25 at 12:29 +0530, Rajendra Nayak wrote:
> >> On Monday 25 June 2012 11:37 AM, Tomi Valkeinen wrote:
> >>> Hi,
> >>>
> >>> On Fri, 2012-06-22 at 19:18 +0530, Rajendra Nayak wrote:
> >>>> In preparation of OMAP moving to Common Clk Framework(CCF) add clk_prepare()
> >>>> and clk_unprepare() for the omapdss clocks.
> >>>
> >>> You used clk_prepare and clk_unprepare instead of clk_prepare_enable and
> >>> clk_disable_unprepare. I didn't check the dss driver yet, but my hunch
> >>> is that the clocks are normally not enabled/disabled from atomic
> >>> context.
> >>>
> >>> What does the prepare/unprepare actually do? Is there any benefit in
> >>> delaying preparing, i.e. is there a difference between prepare right
> >>> after clk_get, or prepare right before clk_enable? (And similarly for
> >>> unprepare)
> >>
> >> clk_prepare/unprepare are useful for clocks which need the 'enable'
> >> logic to be implemented as a slow part (which can sleep) and a fast part
> >> (which does not sleep). For all the dss clocks in question we don't need
> >> a slow part and hence they do not have a .clk_prepare/unprepare
> >> platform hook.
> >>
> >> The framework however still does prepare usecounting (it has a prepare
> >> count and an enable count, and prepare count is expected to be non-zero
> >> while the clock is being enabled) and uses a mutex around to guard it.
> >> So while the dss driver would do multiple clk_enable/disable while its
> >> active, it seems fair to just prepare/unprepare the clocks once just
> >> after clk_get() and before clk_put() in this particular case.
> >
> > But the driver should not presume anything special about the clocks. In
> > this case the dss driver would presume that the clocks it uses do not
> > have prepare and unprepare hooks.
> >
> > If the generally proper way to use prepare/unprepare is in combination
> > of enable/disable, then I think we should try to do that.
> 
> makes sense. Lets see if any of the clk_enable/disable happen in  atomic
> context, if not it would be just a matter of replacing all with a
> clk_prepare_enable/disable_unprepare. Else we might have to find a safe
> place sometime before clk_enable to prepare the clk and after
> clk_disable to unprepare it.
> 
> >
> > I'll check if any of the dss clocks are enabled or disabled in atomic
> > context.

venc and hdmi use clk_enable/disable in runtime PM callbacks (suspend &
resume). If I understand correctly, the callbacks are not called in
atomic context if pm_runtime_irq_safe() has not been used. And it is not
used in omapdss.

dsi uses clk_enable/disable in a different manner, but not in atomic
context.

So as far as I see, clocks are never handled in atomic context. Is
everything related to the base clk stuff already in mainline? Can I take
the clk_prepare/unprepare patch into my omapdss tree?


A question about clk_prepare/unprepare, not directly related: let's say
I have a driver for some HW block. The driver doesn't use clk functions,
but uses runtime PM. The driver also sets pm_runtime_irq_safe().

Now, the driver can call pm_runtime_get_sync() in an atomic context, and
this would lead to the underlying framework (hwmod, omap_device, I don't
know who =) enabling the func clock for that HW. But this would happen
in atomic context, so the underlying framework can't use clk_prepare.

How does the underlying framework handle that case? (sorry if that's a
stupid question =).

 Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120625/b57df7a5/attachment.sig>

  reply	other threads:[~2012-06-25 13:14 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 13:47 [PATCH 00/11] Prepare for OMAP2+ movement to Common Clk Rajendra Nayak
2012-06-22 13:48 ` [PATCH 01/11] ARM: omap: clk: add clk_prepare and clk_unprepare Rajendra Nayak
2012-06-22 17:42   ` Pankaj Jangra
2012-06-25  5:36     ` Rajendra Nayak
2012-06-22 13:48 ` [PATCH 02/11] mmc: omap: " Rajendra Nayak
2012-06-22 18:23   ` S, Venkatraman
2012-06-22 18:34     ` Paul Walmsley
2012-06-25  5:25       ` Rajendra Nayak
2012-06-25  6:18         ` Paul Walmsley
2012-06-25  7:13           ` Rajendra Nayak
2012-06-25  5:32     ` Rajendra Nayak
2012-06-22 13:48 ` [PATCH 03/11] hwrng: " Rajendra Nayak
2012-06-22 13:48 ` [PATCH 04/11] mfd: omap-usb: " Rajendra Nayak
2012-06-22 19:04   ` Paul Walmsley
2012-06-25  8:55     ` Munegowda, Keshava
2012-06-22 13:48 ` [PATCH 05/11] OMAPDSS: " Rajendra Nayak
2012-06-25  6:07   ` Tomi Valkeinen
2012-06-25  6:59     ` Rajendra Nayak
2012-06-25  7:58       ` Tomi Valkeinen
2012-06-25 11:48         ` Rajendra Nayak
2012-06-25 13:14           ` Tomi Valkeinen [this message]
2012-06-26  5:00             ` Rajendra Nayak
2012-06-26  6:55               ` Tomi Valkeinen
2012-06-26  7:36                 ` Rajendra Nayak
2012-06-27  0:47             ` Mike Turquette
2012-06-27  4:19               ` Tomi Valkeinen
2012-06-27  5:19                 ` Rajendra Nayak
2012-06-25 11:22     ` Russell King - ARM Linux
2012-06-22 13:48 ` [PATCH 06/11] gpio/omap: " Rajendra Nayak
2012-06-22 15:57   ` Pankaj Jangra
2012-06-22 19:17   ` Paul Walmsley
2012-06-25  5:30     ` Rajendra Nayak
2012-06-25  6:11       ` DebBarma, Tarun Kanti
2012-06-25  7:02         ` Rajendra Nayak
2012-06-25 10:22           ` DebBarma, Tarun Kanti
2012-06-22 13:48 ` [PATCH 07/11] w1: omap_hdq: " Rajendra Nayak
2012-06-22 18:35   ` Paul Walmsley
2012-06-25  5:25     ` Rajendra Nayak
2012-06-22 13:48 ` [PATCH 08/11] crypto: omap: " Rajendra Nayak
2012-06-22 18:58   ` Paul Walmsley
2012-06-25  5:29     ` Rajendra Nayak
2012-06-26 10:39       ` Paul Walmsley
2012-06-26 10:58         ` Rajendra Nayak
2012-06-22 13:48 ` [PATCH 09/11] iommu: " Rajendra Nayak
2012-06-22 13:48 ` [PATCH 10/11] ARM: omap: hwmod: get rid of all omap_clk_get_by_name usage Rajendra Nayak
2012-06-22 13:48 ` [PATCH 11/11] ARM: omap: clk: Remove all direct dereferencing of struct clk Rajendra Nayak
2012-06-27 12:50 ` [PATCH 00/11] Prepare for OMAP2+ movement to Common Clk Laurent Pinchart
2012-06-27 16:36   ` Paul Walmsley
2012-06-27 18:05     ` Laurent Pinchart
2012-06-27 18:45       ` Laurent Pinchart
2012-06-27 19:56         ` Laurent Pinchart
2012-06-27 19:59         ` Paul Walmsley
2012-06-27 20:25           ` Laurent Pinchart

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=1340630090.3395.85.camel@deskari \
    --to=tomi.valkeinen@ti.com \
    --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).