aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/generic_ops.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-10-14PM / PCI / ACPI: Kick devices that might have been reset by firmwareRafael J. Wysocki1-0/+23
There is a concern that if the platform firmware was involved in the system resume that's being completed, some devices might have been reset by it and if those devices had the power.direct_complete flag set during the preceding suspend transition, they may stay in a reset-power-on state indefinitely (until they are runtime-resumed and then suspended again). That may not be a big deal from the individual device's perspective, but if the system is an SoC, it may be prevented from entering deep SoC-wide low-power states on idle because of that. The devices that are most likely to be affected by this issue are PCI devices and ACPI-enumerated devices using the general ACPI PM domain, so to prevent it from happening for those devices, force a runtime resume for them if they have their power.direct_complete flags set and the platform firmware was involved in the resume transition currently in progress. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-14PM / sleep: Drop pm_request_idle() from pm_generic_complete()Rafael J. Wysocki1-6/+0
The pm_request_idle() in pm_generic_complete() is pointless as it is called with the runtime PM usage counter different from zero (bumped up by the core during the prepare phase of system suspend) and the core calls pm_runtime_put() for all devices after executing their complete callbacks, so drop it. This allows the PCI PM layer to use pm_generic_complete() too. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-03-26PM / Runtime: Spelling s/competing/completing/Geert Uytterhoeven1-1/+1
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-12-22PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PMUlf Hansson1-2/+2
The pm_generic_runtime_suspend|resume functions were implemented within CONFIG_PM_RUNTIME. As we also may use runtime PM callbacks during system suspend, to put devices into low power state, we need to move the implementation of pm_generic_runtime_suspend|resume to CONFIG_PM. This change gives a power domain provision to invoke a platform driver's runtime PM callback from a power domain's system PM callback. This were earlier prevented by the platform bus, since it uses the pm_generic_runtime_suspend|resume functions as runtime PM callbacks. Cc: Kevin Hilman <khilman@linaro.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-06-03PM / Runtime: Rework the "runtime idle" helper routineRafael J. Wysocki1-23/+0
The "runtime idle" helper routine, rpm_idle(), currently ignores return values from .runtime_idle() callbacks executed by it. However, it turns out that many subsystems use pm_generic_runtime_idle() which checks the return value of the driver's callback and executes pm_runtime_suspend() for the device unless that value is not 0. If that logic is moved to rpm_idle() instead, pm_generic_runtime_idle() can be dropped and its users will not need any .runtime_idle() callbacks any more. Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle() routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and ata_port_runtime_idle(), respectively, as well as a few drivers' ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has been returned by the .runtime_idle() callback executed by it. To reduce overall code bloat, make the changes described above. Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Kevin Hilman <khilman@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Alan Stern <stern@rowland.harvard.edu>
2013-04-12PM / Runtime: Asyncronous idle|suspend devices at system resumeUlf Hansson1-1/+1
Use the asyncronous runtime PM API when returning the runtime reference for the device after the system resume is completed. By using the asyncronous runtime PM API we don't have to wait for each an every device to become idle|suspended. Instead we can move on and handle the next device in queue. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-01-29PM / Sleep: Introduce generic callbacks for new device PM phasesRafael J. Wysocki1-53/+104
Introduce generic subsystem callbacks for the new phases of device suspend/resume during system power transitions: "late suspend", "early resume", "late freeze", "early thaw", "late poweroff", "early restore". Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-12-21PM: Drop generic_subsys_pm_opsRafael J. Wysocki1-25/+0
Since the PM core is now going to execute driver callbacks directly if the corresponding subsystem callbacks are not present, forward-only subsystem callbacks (i.e. such that only execute the corresponding driver callbacks) are not necessary any more. Thus it is possible to remove generic_subsys_pm_ops, because the only callback in there that is not forward-only, .runtime_idle, is not really used by the only user of generic_subsys_pm_ops, which is vio_bus_type. However, the generic callback routines themselves cannot be removed from generic_ops.c, because they are used individually by a number of subsystems. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-12-18PM / Sleep: Merge internal functions in generic_ops.cRafael J. Wysocki1-37/+11
After the change that removed the code related to runtime PM from __pm_generic_call() and __pm_generic_resume() these two functions need not be separate any more, so merge them. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-12-18PM / Sleep: Simplify generic system suspend callbacksRafael J. Wysocki1-18/+6
The pm_runtime_suspended() check in __pm_generic_call() doesn't really help and may cause problems to happen, because in some cases the system suspend callbacks need to be called even if the given device has been suspended by runtime PM. For example, if the device generally supports remote wakeup and is not enabled to wake up the system from sleep, it should be prevented from generating wakeup signals during system suspend and that has to be done by the suspend callbacks that the pm_runtime_suspended() check prevents from being executed. Similarly, it may not be a good idea to unconditionally change the runtime PM status of the device to 'active' in __pm_generic_resume(), because the driver may want to leave the device in the 'suspended' state, depending on what happened to it before the system suspend and whether or not it is enabled to wake up the system. For the above reasons, remove the pm_runtime_suspended() check from __pm_generic_call() and remove the code changing the device's runtime PM status from __pm_generic_resume(). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-10-31drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required.Paul Gortmaker1-0/+1
Most of these files were implicitly getting EXPORT_SYMBOL via device.h which was including module.h, but that path will be broken soon. [ with input from Stephen Rothwell <sfr@canb.auug.org.au> ] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-07-02PM: Introduce generic "noirq" callback routines for subsystems (v2)Rafael J. Wysocki1-15/+83
Introduce generic "noirq" power management callback routines for subsystems in addition to the "regular" generic PM callback routines. The new routines will be used, among other things, for implementing system-wide PM transitions support for generic PM domains. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-05-17PM: Introduce generic prepare and complete callbacks for subsystemsRafael J. Wysocki1-0/+39
Introduce generic .prepare() and .complete() power management callbacks, currently missing, that can be used by subsystems and power domains and export them. Provide NULL definitions of all the generic system sleep callbacks for CONFIG_PM_SLEEP unset. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2010-12-24PM / Runtime: Generic resume shouldn't set RPM_ACTIVE unconditionallyRafael J. Wysocki1-1/+1
The __pm_generic_resume() function changes the given device's runtime PM status to RPM_ACTIVE if its driver's callback returns 0, but it only should do that if the rumtime PM is enabled for the device. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2010-12-24PM / Runtime: Fix comments to match runtime callback codeAaro Koskinen1-2/+2
Commit 05aa55dddb9ee4045c320661068bea78dad6a6e5 changed routines to succeed if the driver handler is not defined. Comments were not updated. Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2010-10-17PM / Runtime: Lenient generic runtime pm callbacksOhad Ben-Cohen1-2/+2
Allow drivers, that belong to subsystems which use the generic runtime pm callbacks, not to define runtime pm suspend/resume handlers, by implicitly assuming success in such cases. This is needed to eliminate nop handlers that would otherwise be necessary by drivers which enable runtime pm, but don't need to do anything when their devices are runtime-suspended/resumed. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2010-03-06PM: Provide generic subsystem-level callbacksRafael J. Wysocki1-0/+233
There are subsystems whose power management callbacks only need to invoke the callbacks provided by device drivers. Still, their system sleep PM callbacks should play well with the runtime PM callbacks, so that devices suspended at run time can be left in that state for a system sleep transition. Provide a set of generic PM callbacks for such subsystems and define convenience macros for populating dev_pm_ops structures. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>