linux/drivers/base/power
Rafael J. Wysocki 08810a4119 PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags
The motivation for this change is to provide a way to work around
a problem with the direct-complete mechanism used for avoiding
system suspend/resume handling for devices in runtime suspend.

The problem is that some middle layer code (the PCI bus type and
the ACPI PM domain in particular) returns positive values from its
system suspend ->prepare callbacks regardless of whether the driver's
->prepare returns a positive value or 0, which effectively prevents
drivers from being able to control the direct-complete feature.
Some drivers need that control, however, and the PCI bus type has
grown its own flag to deal with this issue, but since it is not
limited to PCI, it is better to address it by adding driver flags at
the core level.

To that end, add a driver_flags field to struct dev_pm_info for flags
that can be set by device drivers at the probe time to inform the PM
core and/or bus types, PM domains and so on on the capabilities and/or
preferences of device drivers.  Also add two static inline helpers
for setting that field and testing it against a given set of flags
and make the driver core clear it automatically on driver remove
and probe failures.

Define and document two PM driver flags related to the direct-
complete feature: NEVER_SKIP and SMART_PREPARE that can be used,
respectively, to indicate to the PM core that the direct-complete
mechanism should never be used for the device and to inform the
middle layer code (bus types, PM domains etc) that it can only
request the PM core to use the direct-complete mechanism for
the device (by returning a positive value from its ->prepare
callback) if it also has been requested by the driver.

While at it, make the core check pm_runtime_suspended() when
setting power.direct_complete so that it doesn't need to be
checked by ->prepare callbacks.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-11-06 13:55:30 +01:00
..
opp PM / OPP: Call notifier without holding opp_table->lock 2017-09-26 00:44:32 +02:00
clock_ops.c PM / clk: Add support for adding a specific clock from device-tree 2016-06-28 00:42:10 +02:00
common.c PM: Avoid false-positive warnings in dev_pm_domain_set() 2016-02-03 19:10:37 +01:00
domain_governor.c PM / Domains: Fix missing default_power_down_ok comment 2017-06-29 01:24:36 +02:00
domain.c PM / QoS: Drop PM_QOS_FLAG_REMOTE_WAKEUP 2017-10-14 01:04:31 +02:00
generic_ops.c PM / sleep: Remove pm_complete_with_resume_check() 2017-10-11 15:40:29 +02:00
main.c PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags 2017-11-06 13:55:30 +01:00
Makefile PM / OPP: Move opp core to its own directory 2015-09-15 02:03:16 +02:00
power.h Driver core patches for 4.10-rc1 2016-12-13 11:42:18 -08:00
qos.c PM / QoS: Use the correct variable to check the QoS request type 2017-09-18 13:38:30 +02:00
runtime.c PM / core: Convert timers to use timer_setup() 2017-10-24 10:27:42 +02:00
sysfs.c PM / QoS: Drop PM_QOS_FLAG_REMOTE_WAKEUP 2017-10-14 01:04:31 +02:00
trace.c timekeeping: Ignore the bogus sleep time if pm_trace is enabled 2016-11-29 18:02:58 +01:00
wakeirq.c PM / wakeirq: report a wakeup_event on dedicated wekup irq 2017-02-13 22:29:30 +01:00
wakeup.c PM / core: Convert timers to use timer_setup() 2017-10-24 10:27:42 +02:00