| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * pm_wakeup.h - Power management wakeup interface |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2008 Alan Stern |
|---|
| 5 | 6 | * Copyright (C) 2010 Rafael J. Wysocki, Novell Inc. |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - * (at your option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | 7 | */ |
|---|
| 21 | 8 | |
|---|
| 22 | 9 | #ifndef _LINUX_PM_WAKEUP_H |
|---|
| .. | .. |
|---|
| 51 | 38 | * @wakeup_count: Number of times the wakeup source might abort suspend. |
|---|
| 52 | 39 | * @dev: Struct device for sysfs statistics about the wakeup source. |
|---|
| 53 | 40 | * @active: Status of the wakeup source. |
|---|
| 54 | | - * @has_timeout: The wakeup source has been activated with a timeout. |
|---|
| 41 | + * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time. |
|---|
| 55 | 42 | */ |
|---|
| 56 | 43 | struct wakeup_source { |
|---|
| 57 | 44 | const char *name; |
|---|
| .. | .. |
|---|
| 75 | 62 | bool active:1; |
|---|
| 76 | 63 | bool autosleep_enabled:1; |
|---|
| 77 | 64 | }; |
|---|
| 65 | + |
|---|
| 66 | +#define for_each_wakeup_source(ws) \ |
|---|
| 67 | + for ((ws) = wakeup_sources_walk_start(); \ |
|---|
| 68 | + (ws); \ |
|---|
| 69 | + (ws) = wakeup_sources_walk_next((ws))) |
|---|
| 78 | 70 | |
|---|
| 79 | 71 | #ifdef CONFIG_PM_SLEEP |
|---|
| 80 | 72 | |
|---|
| .. | .. |
|---|
| 105 | 97 | extern struct wakeup_source *wakeup_source_register(struct device *dev, |
|---|
| 106 | 98 | const char *name); |
|---|
| 107 | 99 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
|---|
| 100 | +extern int wakeup_sources_read_lock(void); |
|---|
| 101 | +extern void wakeup_sources_read_unlock(int idx); |
|---|
| 102 | +extern struct wakeup_source *wakeup_sources_walk_start(void); |
|---|
| 103 | +extern struct wakeup_source *wakeup_sources_walk_next(struct wakeup_source *ws); |
|---|
| 108 | 104 | extern int device_wakeup_enable(struct device *dev); |
|---|
| 109 | 105 | extern int device_wakeup_disable(struct device *dev); |
|---|
| 110 | 106 | extern void device_set_wakeup_capable(struct device *dev, bool capable); |
|---|