<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/base/power/runtime.c, branch v3.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v3.0</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v3.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2011-04-28T22:35:50Z</updated>
<entry>
<title>PM: Make power domain callbacks take precedence over subsystem ones</title>
<updated>2011-04-28T22:35:50Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2011-04-28T22:35:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d27e9dcff00a6425d779b065ec8892e4f391661'/>
<id>urn:sha1:4d27e9dcff00a6425d779b065ec8892e4f391661</id>
<content type='text'>
Change the PM core's behavior related to power domains in such a way
that, if a power domain is defined for a given device, its callbacks
will be executed instead of and not in addition to the device
subsystem's PM callbacks.

The idea behind the initial implementation of power domains handling
by the PM core was that power domain callbacks would be executed in
addition to subsystem callbacks, so that it would be possible to
extend the subsystem callbacks by using power domains.  It turns out,
however, that this wouldn't be really convenient in some important
situations.

For example, there are systems in which power can only be removed
from entire power domains.  On those systems it is not desirable to
execute device drivers' PM callbacks until it is known that power is
going to be removed from the devices in question, which means that
they should be executed by power domain callbacks rather then by
subsystem (e.g. bus type) PM callbacks, because subsystems generally
have no information about what devices belong to which power domain.
Thus, for instance, if the bus type in question is the platform bus
type, its PM callbacks generally should not be called in addition to
power domain callbacks, because they run device drivers' callbacks
unconditionally if defined.

While in principle the default subsystem PM callbacks, or a subset of
them, may be replaced with different functions, it doesn't seem
correct to do so, because that would change the subsystem's behavior
with respect to all devices in the system, regardless of whether or
not they belong to any power domains.  Thus, the only remaining
option is to make power domain callbacks take precedence over
subsystem callbacks.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
Acked-by: Kevin Hilman &lt;khilman@ti.com&gt;
</content>
</entry>
<entry>
<title>Fix common misspellings</title>
<updated>2011-03-31T14:26:23Z</updated>
<author>
<name>Lucas De Marchi</name>
<email>lucas.demarchi@profusion.mobi</email>
</author>
<published>2011-03-31T01:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=25985edcedea6396277003854657b5f3cb31a628'/>
<id>urn:sha1:25985edcedea6396277003854657b5f3cb31a628</id>
<content type='text'>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
</entry>
<entry>
<title>PM: Make system-wide PM and runtime PM treat subsystems consistently</title>
<updated>2011-03-14T23:43:17Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2011-02-18T22:20:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9659cc0678b954f187290c6e8b247a673c5d37e1'/>
<id>urn:sha1:9659cc0678b954f187290c6e8b247a673c5d37e1</id>
<content type='text'>
The code handling system-wide power transitions (eg. suspend-to-RAM)
can in theory execute callbacks provided by the device's bus type,
device type and class in each phase of the power transition.  In
turn, the runtime PM core code only calls one of those callbacks at
a time, preferring bus type callbacks to device type or class
callbacks and device type callbacks to class callbacks.

It seems reasonable to make them both behave in the same way in that
respect.  Moreover, even though a device may belong to two subsystems
(eg. bus type and device class) simultaneously, in practice power
management callbacks for system-wide power transitions are always
provided by only one of them (ie. if the bus type callbacks are
defined, the device class ones are not and vice versa).  Thus it is
possible to modify the code handling system-wide power transitions
so that it follows the core runtime PM code (ie. treats the
subsystem callbacks as mutually exclusive).

On the other hand, the core runtime PM code will choose to execute,
for example, a runtime suspend callback provided by the device type
even if the bus type's struct dev_pm_ops object exists, but the
runtime_suspend pointer in it happens to be NULL.  This is confusing,
because it may lead to the execution of callbacks from different
subsystems during different operations (eg. the bus type suspend
callback may be executed during runtime suspend of the device, while
the device type callback will be executed during system suspend).

Make all of the power management code treat subsystem callbacks in
a consistent way, such that:
(1) If the device's type is defined (eg. dev-&gt;type is not NULL)
    and its pm pointer is not NULL, the callbacks from dev-&gt;type-&gt;pm
    will be used.
(2) If dev-&gt;type is NULL or dev-&gt;type-&gt;pm is NULL, but the device's
    class is defined (eg. dev-&gt;class is not NULL) and its pm pointer
    is not NULL, the callbacks from dev-&gt;class-&gt;pm will be used.
(3) If dev-&gt;type is NULL or dev-&gt;type-&gt;pm is NULL and dev-&gt;class is
    NULL or dev-&gt;class-&gt;pm is NULL, the callbacks from dev-&gt;bus-&gt;pm
    will be used provided that both dev-&gt;bus and dev-&gt;bus-&gt;pm are
    not NULL.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Kevin Hilman &lt;khilman@ti.com&gt;
Reasoning-sounds-sane-to: Grant Likely &lt;grant.likely@secretlab.ca&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>PM: Add support for device power domains</title>
<updated>2011-03-14T23:43:16Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2011-02-16T20:53:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7538e3db6e015e890825fbd9f8659952896ddd5b'/>
<id>urn:sha1:7538e3db6e015e890825fbd9f8659952896ddd5b</id>
<content type='text'>
The platform bus type is often used to handle Systems-on-a-Chip (SoC)
where all devices are represented by objects of type struct
platform_device.  In those cases the same "platform" device driver
may be used with multiple different system configurations, but the
actions needed to put the devices it handles into a low-power state
and back into the full-power state may depend on the design of the
given SoC.  The driver, however, cannot possibly include all the
information necessary for the power management of its device on all
the systems it is used with.  Moreover, the device hierarchy in its
current form also is not suitable for representing this kind of
information.

The patch below attempts to address this problem by introducing
objects of type struct dev_power_domain that can be used for
representing power domains within a SoC.  Every struct
dev_power_domain object provides a sets of device power
management callbacks that can be used to perform what's needed for
device power management in addition to the operations carried out by
the device's driver and subsystem.

Namely, if a struct dev_power_domain object is pointed to by the
pwr_domain field in a struct device, the callbacks provided by its
ops member will be executed in addition to the corresponding
callbacks provided by the device's subsystem and driver during all
power transitions.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Tested-and-acked-by: Kevin Hilman &lt;khilman@ti.com&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Don't enable interrupts while running in_interrupt</title>
<updated>2011-01-25T19:50:07Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2011-01-25T19:50:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c3810c88788d505d4ffd786addd111b745e42161'/>
<id>urn:sha1:c3810c88788d505d4ffd786addd111b745e42161</id>
<content type='text'>
This patch (as1445) fixes a bug in the runtime PM core left over from
the addition of the no_callbacks flag.  If this flag is set then it is
possible for rpm_suspend() to be called in_interrupt, so when
releasing spinlocks it's important not to re-enable interrupts.

To avoid an unnecessary save-and-restore of the interrupt flag, the
patch also inlines a pm_request_idle() call.

This fixes Bugzilla #27482.

(The offending code was added in 2.6.37, so it's not necessary to apply
this to any earlier stable kernels.)

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: tim blechmann &lt;tim@klingt.org&gt;
CC: &lt;stable@kernel.org&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Add synchronous runtime interface for interrupt handlers (v3)</title>
<updated>2010-12-24T14:02:41Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2010-11-30T23:14:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=c7b61de5b7b17f0df34dc7d2f8b9576f8bd36fce'/>
<id>urn:sha1:c7b61de5b7b17f0df34dc7d2f8b9576f8bd36fce</id>
<content type='text'>
This patch (as1431c) makes the synchronous runtime-PM interface
suitable for use in interrupt handlers.  Subsystems can call the new
pm_runtime_irq_safe() function to tell the PM core that a device's
runtime_suspend and runtime_resume callbacks should be invoked with
interrupts disabled and the spinlock held.  This permits the
pm_runtime_get_sync() and the new pm_runtime_put_sync_suspend()
routines to be called from within interrupt handlers.

When a device is declared irq-safe in this way, the PM core increments
the parent's usage count, so the parent will never be runtime
suspended.  This prevents difficult situations in which an irq-safe
device can't resume because it is forced to wait for its non-irq-safe
parent.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Fix typo in status comparison causing warning</title>
<updated>2010-10-29T13:29:55Z</updated>
<author>
<name>Kevin Winchester</name>
<email>kjwinchester@gmail.com</email>
</author>
<published>2010-10-29T13:29:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=78ca7c37efaa541006269aa3d3e560ea7926e245'/>
<id>urn:sha1:78ca7c37efaa541006269aa3d3e560ea7926e245</id>
<content type='text'>
GCC version 4.5.1 gives the following warning:

drivers/base/power/runtime.c: In function ‘rpm_check_suspend_allowed’:
drivers/base/power/runtime.c:146:25: warning: comparison between ‘enum dpm_state’ and ‘enum rpm_status’

which seems to be a typo in that dev-&gt;power.runtime_status
should be compared instead of dev-&gt;power.status.

Signed-off-by: Kevin Winchester &lt;kjwinchester@gmail.com&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: fix recursive locking warning of lockdep from rpm_resume()</title>
<updated>2010-10-22T21:48:14Z</updated>
<author>
<name>Ming Lei</name>
<email>tom.leiming@gmail.com</email>
</author>
<published>2010-10-22T21:48:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d63be5f924cf054e7ac18bb2761f9533039fb076'/>
<id>urn:sha1:d63be5f924cf054e7ac18bb2761f9533039fb076</id>
<content type='text'>
For device with no_callbacks flag set, its power lock and its parent's
power lock may be held nestedly in rpm_resume, so we should take
spin_lock_nested(lock, SINGLE_DEPTH_NESTING) to acquire parent power lock
to avoid lockdep warning.

Signed-off-by: Ming Lei &lt;tom.leiming@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Remove idle notification after failing suspend</title>
<updated>2010-10-16T23:57:49Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2010-10-10T23:02:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f71648d73c1650b8b4aceb3856bebbde6daa3b86'/>
<id>urn:sha1:f71648d73c1650b8b4aceb3856bebbde6daa3b86</id>
<content type='text'>
If runtime suspend of a device fails returning -EAGAIN or -EBUSY,
which means that it's safe to try to suspend it again, the PM core
runs the runtime idle helper function for it.  Unfortunately this may
lead to problems, for example for PCI devices whose drivers don't
implement the -&gt;runtime_idle() callback, because in that case the
PCI bus type's -&gt;runtime_idle() always calls pm_runtime_suspend()
for the given device.  Then, if there's an automatic idle
notification after the driver's -&gt;runtime_suspend() returning -EAGAIN
or -EBUSY, it will make the suspend happen again possibly causing a
busy loop to appear.  To avoid that, remove the idle notification
after failing runtime suspend of a device altogether and let the
callers of pm_runtime_suspend() repeat the operation if need be.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
</content>
</entry>
<entry>
<title>PM / Runtime: Reduce code duplication in core helper functions</title>
<updated>2010-10-16T23:57:49Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rjw@sisk.pl</email>
</author>
<published>2010-10-04T20:08:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=71c63122c4609a917f14a79c32067a68909fc487'/>
<id>urn:sha1:71c63122c4609a917f14a79c32067a68909fc487</id>
<content type='text'>
Reduce code duplication in rpm_idle(), rpm_suspend() and rpm_resume()
by using local pointers to store callback addresses and moving some
duplicated code into a separate function.

Signed-off-by: Rafael J. Wysocki &lt;rjw@sisk.pl&gt;
Reviewed-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
</content>
</entry>
</feed>
