From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Jonathan Corbet <corbet@lwn.net>,
Russell King <linux@arm.linux.org.uk>,
Dan Williams <dan.j.williams@intel.com>,
Vinod Koul <vinod.koul@intel.com>,
Alan Stern <stern@rowland.harvard.edu>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dmaengine@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>,
Michal Simek <michal.simek@xilinx.com>,
Kevin Hilman <khilman@kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v9 2/4] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM
Date: Wed, 05 Nov 2014 09:48:56 +0100 [thread overview]
Message-ID: <1415177336.15850.14.camel@AMDC1943> (raw)
In-Reply-To: <CAPDyKFo6o8v9u6+MdGSRMmHeMcODqCcdToHXoJqVGcsRVgQwdA@mail.gmail.com>
On wto, 2014-11-04 at 20:06 +0100, Ulf Hansson wrote:
> On 4 November 2014 13:52, Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> > The AMBA bus driver defines runtime Power Management functions which
> > disable and unprepare AMBA bus clock. This is problematic for runtime PM
> > because unpreparing a clock might sleep so it is not interrupt safe.
> >
> > However some drivers may want to implement runtime PM functions in
> > interrupt-safe way (see pm_runtime_irq_safe()). In such case the AMBA
> > bus driver should only disable/enable the clock in runtime suspend and
> > resume callbacks.
> >
> > Detect the device driver behavior during runtime suspend. During runtime
> > resume deal with clocks according to stored value.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > ---
> > drivers/amba/bus.c | 24 ++++++++++++++++++++----
> > include/linux/amba/bus.h | 1 +
> > 2 files changed, 21 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> > index 47bbdc1b5be3..27ec8882ec8e 100644
> > --- a/drivers/amba/bus.c
> > +++ b/drivers/amba/bus.c
> > @@ -85,6 +85,13 @@ static struct device_attribute amba_dev_attrs[] = {
> > };
> >
> > #ifdef CONFIG_PM
> > +
> > +#ifdef CONFIG_PM_RUNTIME
> > +#define get_pm_runtime_irq_safe(dev) ((dev)->power.irq_safe)
> > +#else
> > +#define get_pm_runtime_irq_safe(dev) 1
>
> No, this doesn't work for those drivers that isn't configured as
> irq_safe. The pm_runtime_force_suspend() invoked from the driver's
> system PM suspend callback, will expect clocks to be unprepared when
> CONFIG_PM_RUNTIME is unset.
D'oh! You're right...
> To address this issue, in principle we need to know whether the driver
> has invoked pm_runtime_irq_safe(), even when CONFIG_PM_RUNTIME is
> unset.
>
> This may be solved by the help of PM core:
> 1) Move the irq_safe member in the struct dev_pm_info, outside the
> #ifdef CONFIG_PM_RUNTIME.
> 2) Let the pm_runtime_irq_safe() function be implemented for CONFIG_PM
> instead of CONFIG_PM_RUNTIME.
Before I'll start implementing this - could PM maintainers share their
opinion on such change?
Best regards,
Krzysztof
> If the PM core maintainers don't like that approach we can always add
> an amba specific wrapper function for pm_runtime_irq_safe() and store
> the information needed in the struct amba_device.
>
> Kind regards
> Uffe
next prev parent reply other threads:[~2014-11-05 8:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 12:52 [PATCH v9 0/4] amba/dma: pl330: add Power Management support Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 1/4] amba: Add helpers for (un)preparing AMBA clock Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 2/4] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Krzysztof Kozlowski
2014-11-04 19:06 ` Ulf Hansson
2014-11-05 8:48 ` Krzysztof Kozlowski [this message]
2014-11-04 20:18 ` Pavel Machek
2014-11-05 8:42 ` Krzysztof Kozlowski
2014-11-07 12:13 ` Pavel Machek
2014-11-07 12:18 ` Krzysztof Kozlowski
2014-11-07 12:28 ` Pavel Machek
2014-11-07 13:21 ` Krzysztof Kozlowski
2014-11-04 12:52 ` [PATCH v9 3/4] dma: pl330: add Power Management support Krzysztof Kozlowski
2014-11-05 14:01 ` Vinod Koul
2014-11-05 14:21 ` Krzysztof Kozlowski
2014-11-05 16:46 ` Vinod Koul
2014-11-04 12:52 ` [PATCH v9 4/4] amba: Remove unused amba_pclk_enable/disable macros Krzysztof Kozlowski
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=1415177336.15850.14.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=khilman@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=michal.simek@xilinx.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
--cc=vinod.koul@intel.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.