Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Peng Fan and committed by
Ulf Hansson
4acbfb6c 35cfef3c

+19
+1
drivers/base/power/main.c
··· 2126 2126 device_lock(dev); 2127 2127 2128 2128 dev->power.wakeup_path = false; 2129 + dev->power.out_band_wakeup = false; 2129 2130 2130 2131 if (dev->power.no_pm_callbacks) 2131 2132 goto unlock;
+1
include/linux/pm.h
··· 684 684 bool smart_suspend:1; /* Owned by the PM core */ 685 685 bool must_resume:1; /* Owned by the PM core */ 686 686 bool may_skip_resume:1; /* Set by subsystems */ 687 + bool out_band_wakeup:1; 687 688 bool strict_midlayer:1; 688 689 #else 689 690 bool should_wakeup:1;
+17
include/linux/pm_wakeup.h
··· 94 94 dev->power.wakeup_path = true; 95 95 } 96 96 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 + 97 107 /* drivers/base/power/wakeup.c */ 98 108 extern struct wakeup_source *wakeup_source_register(struct device *dev, 99 109 const char *name); ··· 171 161 } 172 162 173 163 static inline void device_set_wakeup_path(struct device *dev) {} 164 + 165 + static inline void device_set_out_band_wakeup(struct device *dev) {} 166 + 167 + static inline bool device_out_band_wakeup(struct device *dev) 168 + { 169 + return false; 170 + } 174 171 175 172 static inline void __pm_stay_awake(struct wakeup_source *ws) {} 176 173