Currently, some subsystems (e.g. PCI and the ACPI PM domain) have to
resume all runtime-suspended devices during system suspend, mostly
because those devices may need to be reprogrammed due to different
wakeup settings for system sleep and for runtime PM. However, at
least in some cases, that isn't really necessary, because the wakeup
settings may not be really different.
The idea here is that subsystems should know whether or not it is
necessary to reprogram a given device during system suspend and they
should be able to tell the PM core about that. For that reason, add
two new device PM flags, power.resume_not_needed and
power.use_runtime_resume, such that:
(1) If power.resume_not_needed is set for the given device and for
all of its children and the device is runtime-suspended during
device_suspend(), the remaining device's system suspend/resume
callbacks need not be executed.
(2) If power.use_runtime_resume is set for the given device and the
device is runtime-suspended in device_suspend_late(), its late/early
and noirq system suspend/resume callbacks should be skipped and
it should be resumed through pm_runtime_resume() in device_resume().
Those flags are cleared by the PM core in dpm_prepare() for all
devices. Next, subsystems (or drivers) are supposed to set
power.resume_not_needed in their ->prepare() callbacks for devices
whose remaining system suspend/resume callbacks are generally safe to
be skipped if they are runtime-suspended already. Finally, for each
runtime-suspended device with power.resume_not_needed set during
device_suspend(), its subsystem (or driver) may set the device's
power.use_runtime_resume in its ->suspend() callback without changing
the device's state, in which case the PM core will skip all of the
subsequent system suspend/resume callbacks for it and will resume it
in device_resume() using pm_runtime_resume().
resume all runtime-suspended devices during system suspend, mostly
because those devices may need to be reprogrammed due to different
wakeup settings for system sleep and for runtime PM. However, at
least in some cases, that isn't really necessary, because the wakeup
settings may not be really different.
The idea here is that subsystems should know whether or not it is
necessary to reprogram a given device during system suspend and they
should be able to tell the PM core about that. For that reason, add
two new device PM flags, power.resume_not_needed and
power.use_runtime_resume, such that:
(1) If power.resume_not_needed is set for the given device and for
all of its children and the device is runtime-suspended during
device_suspend(), the remaining device's system suspend/resume
callbacks need not be executed.
(2) If power.use_runtime_resume is set for the given device and the
device is runtime-suspended in device_suspend_late(), its late/early
and noirq system suspend/resume callbacks should be skipped and
it should be resumed through pm_runtime_resume() in device_resume().
Those flags are cleared by the PM core in dpm_prepare() for all
devices. Next, subsystems (or drivers) are supposed to set
power.resume_not_needed in their ->prepare() callbacks for devices
whose remaining system suspend/resume callbacks are generally safe to
be skipped if they are runtime-suspended already. Finally, for each
runtime-suspended device with power.resume_not_needed set during
device_suspend(), its subsystem (or driver) may set the device's
power.use_runtime_resume in its ->suspend() callback without changing
the device's state, in which case the PM core will skip all of the
subsequent system suspend/resume callbacks for it and will resume it
in device_resume() using pm_runtime_resume().