From: Kevin Hilman <khilman@linaro.org>
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>,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Alan Stern <stern@rowland.harvard.edu>,
Mark Brown <broonie@kernel.org>,
Russell King <linux@arm.linux.org.uk>,
Linus Walleij <linus.walleij@linaro.org>,
Wolfram Sang <wsa@the-dreams.de>,
Alessandro Rubini <rubini@unipv.it>
Subject: Re: [PATCH 0/8] PM / Sleep / Runtime: Fixup some driver's system suspend
Date: Wed, 26 Feb 2014 08:30:07 -0800 [thread overview]
Message-ID: <7htxblx2eo.fsf@paris.lan> (raw)
In-Reply-To: 1392910280-12891-1-git-send-email-ulf.hansson@linaro.org
Ulf Hansson <ulf.hansson@linaro.org> writes:
> Patch 1 -> 2:
> These patches provides two new runtime PM helper functions which intend to be
> used from system suspend/resume callbacks, to make sure devices are put into low
> power state during system suspend and brought back to full power at system
> resume.
>
> The prerequisite is to have all levels of a device's runtime PM callbacks to be
> defined through the SET_PM_RUNTIME_PM_OPS macro, which means these are available
> for CONFIG_PM.
>
> By using the new runtime PM helper functions especially the two scenarios below
> will be addressed.
>
> 1) The PM core prevents .runtime_suspend callbacks from being invoked during
> system suspend. That means even for a runtime PM centric subsystem and driver,
> the device needs to be put into low power state from a system suspend callback.
> Otherwise it may very well be left in full power state (runtime resumed) while
> the system is suspended. By using the new helper functions, we make sure to walk
> the hierarchy of a device's power domain, subsystem and driver.
I thought it was the case that runtime PM was only disabled during the
'late' phase now. Isn't that enough to allow runtime callbacks in the
normal suspend/resume hooks now? /me looks.
oh, wait. Ee still have the _get_noresume() in device_prepare(). hmm
Either way, I'm not not a big fan of new functions. Personally, I think
subsystems/busses/pm_domains should be able to opt out of the PM core
behavior that blocks runtime PM transitions during system suspend.
Something like the (untested) hack below. That way, we could avoid the
need for new helper functions.
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 1b41fca3d65a..e0770009ba8e 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -832,7 +832,8 @@ static void device_complete(struct device *dev, pm_message_t state)
device_unlock(dev);
- pm_runtime_put(dev);
+ if (dev->power.block_rpm_during_suspend)
+ pm_runtime_put(dev);
}
/**
@@ -1318,7 +1319,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
* block runtime suspend here, during the prepare phase, and allow
* it again during the complete phase.
*/
- pm_runtime_get_noresume(dev);
+ if (dev->power.block_rpm_during_suspend)
+ pm_runtime_get_noresume(dev);
device_lock(dev);
@@ -1350,7 +1352,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
device_unlock(dev);
- if (error)
+ if (error && dev->power.block_rpm_during_suspend)
pm_runtime_put(dev);
return error;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8c6583a53a06..692cd543b71d 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -551,6 +551,7 @@ struct dev_pm_info {
struct wakeup_source *wakeup;
bool wakeup_path:1;
bool syscore:1;
+ unsigned int block_rpm_during_suspend:1;
#else
unsigned int should_wakeup:1;
#endif
Kevin
WARNING: multiple messages have this Message-ID (diff)
From: khilman@linaro.org (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/8] PM / Sleep / Runtime: Fixup some driver's system suspend
Date: Wed, 26 Feb 2014 08:30:07 -0800 [thread overview]
Message-ID: <7htxblx2eo.fsf@paris.lan> (raw)
In-Reply-To: 1392910280-12891-1-git-send-email-ulf.hansson@linaro.org
Ulf Hansson <ulf.hansson@linaro.org> writes:
> Patch 1 -> 2:
> These patches provides two new runtime PM helper functions which intend to be
> used from system suspend/resume callbacks, to make sure devices are put into low
> power state during system suspend and brought back to full power at system
> resume.
>
> The prerequisite is to have all levels of a device's runtime PM callbacks to be
> defined through the SET_PM_RUNTIME_PM_OPS macro, which means these are available
> for CONFIG_PM.
>
> By using the new runtime PM helper functions especially the two scenarios below
> will be addressed.
>
> 1) The PM core prevents .runtime_suspend callbacks from being invoked during
> system suspend. That means even for a runtime PM centric subsystem and driver,
> the device needs to be put into low power state from a system suspend callback.
> Otherwise it may very well be left in full power state (runtime resumed) while
> the system is suspended. By using the new helper functions, we make sure to walk
> the hierarchy of a device's power domain, subsystem and driver.
I thought it was the case that runtime PM was only disabled during the
'late' phase now. Isn't that enough to allow runtime callbacks in the
normal suspend/resume hooks now? /me looks.
oh, wait. Ee still have the _get_noresume() in device_prepare(). hmm
Either way, I'm not not a big fan of new functions. Personally, I think
subsystems/busses/pm_domains should be able to opt out of the PM core
behavior that blocks runtime PM transitions during system suspend.
Something like the (untested) hack below. That way, we could avoid the
need for new helper functions.
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 1b41fca3d65a..e0770009ba8e 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -832,7 +832,8 @@ static void device_complete(struct device *dev, pm_message_t state)
device_unlock(dev);
- pm_runtime_put(dev);
+ if (dev->power.block_rpm_during_suspend)
+ pm_runtime_put(dev);
}
/**
@@ -1318,7 +1319,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
* block runtime suspend here, during the prepare phase, and allow
* it again during the complete phase.
*/
- pm_runtime_get_noresume(dev);
+ if (dev->power.block_rpm_during_suspend)
+ pm_runtime_get_noresume(dev);
device_lock(dev);
@@ -1350,7 +1352,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
device_unlock(dev);
- if (error)
+ if (error && dev->power.block_rpm_during_suspend)
pm_runtime_put(dev);
return error;
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 8c6583a53a06..692cd543b71d 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -551,6 +551,7 @@ struct dev_pm_info {
struct wakeup_source *wakeup;
bool wakeup_path:1;
bool syscore:1;
+ unsigned int block_rpm_during_suspend:1;
#else
unsigned int should_wakeup:1;
#endif
Kevin
next prev parent reply other threads:[~2014-02-26 16:30 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 15:31 [PATCH 0/8] PM / Sleep / Runtime: Fixup some driver's system suspend Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 1/8] PM / Runtime: Fetch runtime PM callbacks using a macro Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 16:28 ` Josh Cartwright
2014-02-20 16:28 ` Josh Cartwright
2014-02-26 15:50 ` Kevin Hilman
2014-02-26 15:50 ` Kevin Hilman
2014-02-26 22:02 ` Ulf Hansson
2014-02-26 22:02 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 2/8] PM / Sleep / Runtime: Add pm_runtime_suspend|resume_force functions Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 3/8] spi: pl022: Let runtime PM callbacks be available for CONFIG_PM Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 17:25 ` Josh Cartwright
2014-02-20 17:25 ` Josh Cartwright
2014-02-20 15:31 ` [PATCH 4/8] spi: pl022: Don't ignore power domain and amba bus at system suspend Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 5/8] i2c: nomadik: Fixup " Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 6/8] mmc: mmci: Mask IRQs for all variants during runtime suspend Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 7/8] mmc: mmci: Let runtime PM callbacks be available for CONFIG_PM Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-20 15:31 ` [PATCH 8/8] mmc: mmci: Put the device into low power state at system suspend Ulf Hansson
2014-02-20 15:31 ` Ulf Hansson
2014-02-26 16:30 ` Kevin Hilman [this message]
2014-02-26 16:30 ` [PATCH 0/8] PM / Sleep / Runtime: Fixup some driver's " Kevin Hilman
2014-02-26 22:30 ` Ulf Hansson
2014-02-26 22:30 ` Ulf Hansson
2014-02-27 1:22 ` Rafael J. Wysocki
2014-02-27 1:22 ` Rafael J. Wysocki
2014-02-27 8:18 ` Ulf Hansson
2014-02-27 8:18 ` Ulf Hansson
2014-02-28 17:21 ` Kevin Hilman
2014-02-28 17:21 ` 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=7htxblx2eo.fsf@paris.lan \
--to=khilman@linaro.org \
--cc=broonie@kernel.org \
--cc=len.brown@intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=rubini@unipv.it \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
--cc=wsa@the-dreams.de \
/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.