Skip to content

Commit 4acbfb6

Browse files
MrVanUlf Hansson
authored andcommitted
PM: wakeup: Add out-of-band system wakeup support for devices
Some devices can wake up the system from suspend even when their power domains are turned off. This is possible because their system-wakeup logic resides in an always-on power domain - indicating that they support out-of-band system wakeup. Currently, PM domain core doesn't power off such devices if they are marked as system wakeup sources. To better represent devices with out-of-band wakeup capability, this patch introduces a new flag out_band_wakeup in 'struct dev_pm_info'. Two helper APIs are added: - device_set_out_band_wakeup() - to mark a device as having out-of-band wakeup capability. - device_out_band_wakeup() - to query the flag. Allow the PM core and drivers to distinguish between regular and out-of-band wakeup sources, enable more accurate power management decision. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 35cfef3 commit 4acbfb6

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/base/power/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,6 +2126,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
21262126
device_lock(dev);
21272127

21282128
dev->power.wakeup_path = false;
2129+
dev->power.out_band_wakeup = false;
21292130

21302131
if (dev->power.no_pm_callbacks)
21312132
goto unlock;

include/linux/pm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ struct dev_pm_info {
684684
bool smart_suspend:1; /* Owned by the PM core */
685685
bool must_resume:1; /* Owned by the PM core */
686686
bool may_skip_resume:1; /* Set by subsystems */
687+
bool out_band_wakeup:1;
687688
bool strict_midlayer:1;
688689
#else
689690
bool should_wakeup:1;

include/linux/pm_wakeup.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ static inline void device_set_wakeup_path(struct device *dev)
9494
dev->power.wakeup_path = true;
9595
}
9696

97+
static inline void device_set_out_band_wakeup(struct device *dev)
98+
{
99+
dev->power.out_band_wakeup = true;
100+
}
101+
102+
static inline bool device_out_band_wakeup(struct device *dev)
103+
{
104+
return dev->power.out_band_wakeup;
105+
}
106+
97107
/* drivers/base/power/wakeup.c */
98108
extern struct wakeup_source *wakeup_source_register(struct device *dev,
99109
const char *name);
@@ -162,6 +172,13 @@ static inline bool device_wakeup_path(struct device *dev)
162172

163173
static inline void device_set_wakeup_path(struct device *dev) {}
164174

175+
static inline void device_set_out_band_wakeup(struct device *dev) {}
176+
177+
static inline bool device_out_band_wakeup(struct device *dev)
178+
{
179+
return false;
180+
}
181+
165182
static inline void __pm_stay_awake(struct wakeup_source *ws) {}
166183

167184
static inline void pm_stay_awake(struct device *dev) {}

0 commit comments

Comments
 (0)