OSDN Git Service

PM / wakeup: Add device_set_wakeup_path() helper to control wakeup path
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 2 Jan 2018 16:08:52 +0000 (17:08 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 9 Jan 2018 12:09:17 +0000 (13:09 +0100)
commitcf04ce7841fabc7af0d6ee273711ec29658bee7b
treea15b0c9d3d27d6453c46e775c6a4894f14b9b2cd
parent8512220c5782d3e469cf8127a612a6c8f521e2dc
PM / wakeup: Add device_set_wakeup_path() helper to control wakeup path

During system suspend, a driver may find that the wakeup setting is
enabled for its device and therefore configures it to deliver system
wakeup signals.

Additionally, sometimes the driver and its device, relies on some
further consumed resource, like an irqchip or a phy for example, to
stay powered on, as to be able to deliver system wakeup signals.

In general the driver deals with this, via raising an "enable count"
of the consumed resource or via a subsystem specific API, like
irq_set_irq_wake() or enable|disable_irq_wake() for an irqchip.
However, this may not be sufficient in cases when the resource's
device may be attached to a PM domain (genpd for example) or is
handled by a non-trivial middle layer (PCI for example).

To address cases like these, the existing ->dev.power.wakeup_path
status flag is there to help.  As a matter of fact, genpd already
monitors the flag during system suspend and acts accordingly.

However, so far it has not been clear, if anybody else but the PM
core is allowed to set the ->dev.power.wakeup_path status flag,
which is required to make this work.  For this reason, introduce
a new helper function, device_set_wakeup_path() for that.

Typically, a driver that manages a resource needed in the wakeup path
should call device_set_wakeup_path() from its ->suspend() or
->suspend_late() callback.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/pm_wakeup.h