All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Kevin Hilman <khilman@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linux PM list <linux-pm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Alan Stern <stern@rowland.harvard.edu>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Simon Horman <horms@verge.net.au>,
	Magnus Damm <magnus.damm@gmail.com>,
	Ben Dooks <ben-linux@fluff.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Philipp Zabel <philipp.zabel@g>
Subject: Re: [PATCH v5 00/11] PM / Domains: Generic OF-based support
Date: Fri, 26 Sep 2014 11:56:48 +0200	[thread overview]
Message-ID: <20140926095647.GI31106@ulmo> (raw)
In-Reply-To: <CAMuHMdWq9ZySdt8sQpBFq=X7LR5a=vZkowNZoB8NHztTisG+NQ@mail.gmail.com>

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

On Fri, Sep 26, 2014 at 10:06:24AM +0200, Geert Uytterhoeven wrote:
> Hi Thierry,
> 
> On Fri, Sep 26, 2014 at 9:31 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > On Thu, Sep 25, 2014 at 03:45:11PM -0700, Kevin Hilman wrote:
> >> Thierry Reding <thierry.reding@gmail.com> writes:
> >> > I just noticed these patches because they conflicted with some of the
> >> > local patches I had to add a very similar framework. One of the reasons
> >> > why I hadn't posted these publicly yet is because the platform where I
> >> > want to use this (Tegra) is somewhat quirky when it comes to power
> >> > domains.
> >> >
> >> > On Tegra these domains are called power gates and they currently have
> >> > their own API. We've been looking at migrating things over to some
> >> > generic framework for some time and PM domains do seem like a good fit.
> >> > However one of the quirks regarding these domains on Tegra is that a
> >> > fixed sequence exists that needs to be respected when enabling or
> >> > disabling a power partition. The exact sequence can be found in the
> >> > drivers/soc/tegra/pmc.c driver's tegra_powergate_sequence_power_up()
> >> > function. Essentially we need to call into the clock and reset drivers
> >> > at very specific moments during the operations that the PMC does.
> >> >
> >> > One solution to this would be to make the needed clocks and resets
> >> > available to the power domain driver via DT, but then we have the
> >> > problem that two drivers would be controlling the same resources. For
> >> > example drivers could still want to disable the clock for more fine-
> >> > grained power management.
> >>
> >> I think you're on the right path here.  You can get rid of this conflict
> >> by removing the direct/manual clock management from the drivers, and
> >> using runtime PM instead: s/clk_enable/pm_runtime_get_sync/,
> >> s/clk_disable/pm_runtime_put_sync/.  When using runtime PM, those calls
> >> trickle down through the power domain driver, which can manage the
> >> device clocks, as well as any additional clocks and resets needed for
> >> power gating.
> >
> > Okay. The DT part of it is going to be pretty nasty (as usual) because
> > we currently have the clocks and resets within the device's device tree
> > node (which I think is where they really belong).
> >
> > So one possibility would be to move the clocks and resets to the power
> > domain controller's node, like so:
> >
> >         pmc@... {
> >                 power-domains {
> >                         ...
> >
> >                         sata@... {
> >                                 clocks = <&tegra_car 124>;
> >                                 resets = <&tegra_car 124>;
> >                         };
> >                 };
> >         };
> >
> > An alternative would be to make the power-domain controller look up the
> > clock within the user's device tree node. That could be problematic,
> > because while the module clock is always the first clock in current
> > device trees, there aren't ordering guarantees, so we'd have to rely on
> > the clock name.
> 
> Or on some other way.
> Do you have a separate hardware block that controls all (and only) the
> module clocks?

No, the "clock and reset controller" controls all clocks (and resets) on
the SoC.

> On shmobile SoCs, all module clocks are controlled using the MSTP
> (Module SToP) clocks.
> 
> In my old RFC series "[PATCH/RFC 0/4] of: Register clocks for Runtime PM
> with PM core" (https://lkml.org/lkml/2014/4/24/1118) the MSTP clock driver
> advertised using a new CLK_RUNTIME_PM flag that its clocks are module
> clocks and thus suitable for runtime PM.
> 
> There were some issues with that series, but the general idea of letting a
> clock driver advertise that all its clocks are module clocks could still be
> useful. Then the power domain driver knows which clocks to manage.

That sounds interesting. Although it would still mean that we need a way
to associate a clock with the correct power domain. I guess the driver
could do that by iterating over all available clocks in the device's
clocks property and grab only those that are marked CLK_RUNTIME_PM.

Thierry

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

WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 00/11] PM / Domains: Generic OF-based support
Date: Fri, 26 Sep 2014 11:56:48 +0200	[thread overview]
Message-ID: <20140926095647.GI31106@ulmo> (raw)
In-Reply-To: <CAMuHMdWq9ZySdt8sQpBFq=X7LR5a=vZkowNZoB8NHztTisG+NQ@mail.gmail.com>

On Fri, Sep 26, 2014 at 10:06:24AM +0200, Geert Uytterhoeven wrote:
> Hi Thierry,
> 
> On Fri, Sep 26, 2014 at 9:31 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > On Thu, Sep 25, 2014 at 03:45:11PM -0700, Kevin Hilman wrote:
> >> Thierry Reding <thierry.reding@gmail.com> writes:
> >> > I just noticed these patches because they conflicted with some of the
> >> > local patches I had to add a very similar framework. One of the reasons
> >> > why I hadn't posted these publicly yet is because the platform where I
> >> > want to use this (Tegra) is somewhat quirky when it comes to power
> >> > domains.
> >> >
> >> > On Tegra these domains are called power gates and they currently have
> >> > their own API. We've been looking at migrating things over to some
> >> > generic framework for some time and PM domains do seem like a good fit.
> >> > However one of the quirks regarding these domains on Tegra is that a
> >> > fixed sequence exists that needs to be respected when enabling or
> >> > disabling a power partition. The exact sequence can be found in the
> >> > drivers/soc/tegra/pmc.c driver's tegra_powergate_sequence_power_up()
> >> > function. Essentially we need to call into the clock and reset drivers
> >> > at very specific moments during the operations that the PMC does.
> >> >
> >> > One solution to this would be to make the needed clocks and resets
> >> > available to the power domain driver via DT, but then we have the
> >> > problem that two drivers would be controlling the same resources. For
> >> > example drivers could still want to disable the clock for more fine-
> >> > grained power management.
> >>
> >> I think you're on the right path here.  You can get rid of this conflict
> >> by removing the direct/manual clock management from the drivers, and
> >> using runtime PM instead: s/clk_enable/pm_runtime_get_sync/,
> >> s/clk_disable/pm_runtime_put_sync/.  When using runtime PM, those calls
> >> trickle down through the power domain driver, which can manage the
> >> device clocks, as well as any additional clocks and resets needed for
> >> power gating.
> >
> > Okay. The DT part of it is going to be pretty nasty (as usual) because
> > we currently have the clocks and resets within the device's device tree
> > node (which I think is where they really belong).
> >
> > So one possibility would be to move the clocks and resets to the power
> > domain controller's node, like so:
> >
> >         pmc at ... {
> >                 power-domains {
> >                         ...
> >
> >                         sata at ... {
> >                                 clocks = <&tegra_car 124>;
> >                                 resets = <&tegra_car 124>;
> >                         };
> >                 };
> >         };
> >
> > An alternative would be to make the power-domain controller look up the
> > clock within the user's device tree node. That could be problematic,
> > because while the module clock is always the first clock in current
> > device trees, there aren't ordering guarantees, so we'd have to rely on
> > the clock name.
> 
> Or on some other way.
> Do you have a separate hardware block that controls all (and only) the
> module clocks?

No, the "clock and reset controller" controls all clocks (and resets) on
the SoC.

> On shmobile SoCs, all module clocks are controlled using the MSTP
> (Module SToP) clocks.
> 
> In my old RFC series "[PATCH/RFC 0/4] of: Register clocks for Runtime PM
> with PM core" (https://lkml.org/lkml/2014/4/24/1118) the MSTP clock driver
> advertised using a new CLK_RUNTIME_PM flag that its clocks are module
> clocks and thus suitable for runtime PM.
> 
> There were some issues with that series, but the general idea of letting a
> clock driver advertise that all its clocks are module clocks could still be
> useful. Then the power domain driver knows which clocks to manage.

That sounds interesting. Although it would still mean that we need a way
to associate a clock with the correct power domain. I guess the driver
could do that by iterating over all available clocks in the device's
clocks property and grab only those that are marked CLK_RUNTIME_PM.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140926/d1fe5e49/attachment.sig>

  reply	other threads:[~2014-09-26  9:56 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-19 18:27 [PATCH v5 00/11] PM / Domains: Generic OF-based support Ulf Hansson
2014-09-19 18:27 ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 01/11] PM / Domains: Add a detach callback to the struct dev_pm_domain Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-22 11:15   ` Geert Uytterhoeven
2014-09-22 11:15     ` Geert Uytterhoeven
2014-09-19 18:27 ` [PATCH v5 02/11] ACPI / PM: Assign the ->detach() callback when attaching the PM domain Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 03/11] PM / Domains: Add generic OF-based PM domain look-up Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 04/11] PM / Domains: Add APIs to attach/detach a PM domain for a device Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-22 11:12   ` Geert Uytterhoeven
2014-09-22 11:12     ` Geert Uytterhoeven
2014-09-19 18:27 ` [PATCH v5 05/11] drivercore / platform: Convert to dev_pm_domain_attach|detach() Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
     [not found] ` <1411151264-16245-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-19 18:27   ` [PATCH v5 06/11] i2c: core: " Ulf Hansson
2014-09-19 18:27     ` Ulf Hansson
     [not found]     ` <1411151264-16245-7-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-20 12:23       ` Wolfram Sang
2014-09-20 12:23         ` Wolfram Sang
2014-09-20 23:48         ` Rafael J. Wysocki
2014-09-20 23:48           ` Rafael J. Wysocki
2014-09-22  9:52         ` Mika Westerberg
2014-09-22  9:52           ` Mika Westerberg
2014-09-22 10:00           ` Wolfram Sang
2014-09-22 10:00             ` Wolfram Sang
2014-09-19 18:27   ` [PATCH v5 07/11] mmc: sdio: " Ulf Hansson
2014-09-19 18:27     ` Ulf Hansson
2014-10-02  0:27     ` Dmitry Torokhov
2014-10-02  0:27       ` Dmitry Torokhov
2014-10-13  2:48       ` Aaron Lu
2014-10-13  2:48         ` Aaron Lu
2014-10-13 11:44         ` Ulf Hansson
2014-10-13 11:44           ` Ulf Hansson
2014-09-19 18:27   ` [PATCH v5 10/11] ARM: exynos: Move to generic PM domain DT bindings Ulf Hansson
2014-09-19 18:27     ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 08/11] spi: core: Convert to dev_pm_domain_attach|detach() Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 09/11] amba: Add support for attach/detach of PM domains Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-19 18:27 ` [PATCH v5 11/11] ACPI / PM: Convert acpi_dev_pm_detach() into a static function Ulf Hansson
2014-09-19 18:27   ` Ulf Hansson
2014-09-19 18:48 ` [PATCH v5 00/11] PM / Domains: Generic OF-based support Dmitry Torokhov
2014-09-19 18:48   ` Dmitry Torokhov
2014-09-22 14:19   ` Rafael J. Wysocki
2014-09-22 14:19     ` Rafael J. Wysocki
2014-09-22 19:04     ` Ulf Hansson
2014-09-22 19:04       ` Ulf Hansson
2014-09-23  1:42     ` Mark Brown
2014-09-23  1:42       ` Mark Brown
2014-09-24 12:44     ` Grygorii Strashko
2014-09-24 12:44       ` Grygorii Strashko
2014-09-24 13:51       ` Rafael J. Wysocki
2014-09-24 13:51         ` Rafael J. Wysocki
2014-09-24 13:59         ` Grygorii Strashko
2014-09-24 13:59           ` Grygorii Strashko
2014-09-25 11:21 ` Thierry Reding
2014-09-25 11:21   ` Thierry Reding
2014-09-25 15:29   ` Ulf Hansson
2014-09-25 15:29     ` Ulf Hansson
2014-09-25 16:56     ` Thierry Reding
2014-09-25 16:56       ` Thierry Reding
2014-09-26  0:27       ` Stephen Boyd
2014-09-26  0:27         ` Stephen Boyd
2014-09-26  5:08         ` Kevin Hilman
2014-09-26  5:08           ` Kevin Hilman
2014-09-26  7:44         ` Thierry Reding
2014-09-26  7:44           ` Thierry Reding
2014-09-25 22:45   ` Kevin Hilman
2014-09-25 22:45     ` Kevin Hilman
2014-09-26  7:31     ` Thierry Reding
2014-09-26  7:31       ` Thierry Reding
2014-09-26  8:06       ` Geert Uytterhoeven
2014-09-26  8:06         ` Geert Uytterhoeven
2014-09-26  9:56         ` Thierry Reding [this message]
2014-09-26  9:56           ` Thierry Reding
2014-09-26 10:01           ` Geert Uytterhoeven
2014-09-26 10:01             ` Geert Uytterhoeven
2014-09-26 10:04             ` Thierry Reding
2014-09-26 10:04               ` Thierry Reding
2014-09-26 14:50       ` Kevin Hilman
2014-09-26 14:50         ` Kevin Hilman

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=20140926095647.GI31106@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=ben-linux@fluff.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=horms@verge.net.au \
    --cc=kgene.kim@samsung.com \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=philipp.zabel@g \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@codeaurora.org \
    --cc=stern@rowland.harvard.edu \
    --cc=tomasz.figa@gmail.com \
    --cc=ulf.hansson@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 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.