cregit-Linux how code gets into the kernel

Release 4.12 include/linux/pm_wakeup.h

Directory: include/linux
/*
 *  pm_wakeup.h - Power management wakeup interface
 *
 *  Copyright (C) 2008 Alan Stern
 *  Copyright (C) 2010 Rafael J. Wysocki, Novell Inc.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _LINUX_PM_WAKEUP_H

#define _LINUX_PM_WAKEUP_H

#ifndef _DEVICE_H_
# error "please don't include this file directly"
#endif

#include <linux/types.h>

struct wake_irq;

/**
 * struct wakeup_source - Representation of wakeup sources
 *
 * @name: Name of the wakeup source
 * @entry: Wakeup source list entry
 * @lock: Wakeup source lock
 * @wakeirq: Optional device specific wakeirq
 * @timer: Wakeup timer list
 * @timer_expires: Wakeup timer expiration
 * @total_time: Total time this wakeup source has been active.
 * @max_time: Maximum time this wakeup source has been continuously active.
 * @last_time: Monotonic clock when the wakeup source's was touched last time.
 * @prevent_sleep_time: Total time this source has been preventing autosleep.
 * @event_count: Number of signaled wakeup events.
 * @active_count: Number of times the wakeup source was activated.
 * @relax_count: Number of times the wakeup source was deactivated.
 * @expire_count: Number of times the wakeup source's timeout has expired.
 * @wakeup_count: Number of times the wakeup source might abort suspend.
 * @active: Status of the wakeup source.
 * @has_timeout: The wakeup source has been activated with a timeout.
 */

struct wakeup_source {
	
const char 		*name;
	
struct list_head	entry;
	
spinlock_t		lock;
	
struct wake_irq		*wakeirq;
	
struct timer_list	timer;
	
unsigned long		timer_expires;
	
ktime_t total_time;
	
ktime_t max_time;
	
ktime_t last_time;
	
ktime_t start_prevent_time;
	
ktime_t prevent_sleep_time;
	
unsigned long		event_count;
	
unsigned long		active_count;
	
unsigned long		relax_count;
	
unsigned long		expire_count;
	
unsigned long		wakeup_count;
	
bool			active:1;
	
bool			autosleep_enabled:1;
};

#ifdef CONFIG_PM_SLEEP

/*
 * Changes to device_may_wakeup take effect on the next pm state change.
 */


static inline bool device_can_wakeup(struct device *dev) { return dev->power.can_wakeup; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki19100.00%2100.00%
Total19100.00%2100.00%


static inline bool device_may_wakeup(struct device *dev) { return dev->power.can_wakeup && !!dev->power.wakeup; }

Contributors

PersonTokensPropCommitsCommitProp
Alan Stern1762.96%133.33%
Rafael J. Wysocki933.33%133.33%
Dmitry Torokhov13.70%133.33%
Total27100.00%3100.00%

/* drivers/base/power/wakeup.c */ extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name); extern struct wakeup_source *wakeup_source_create(const char *name); extern void wakeup_source_drop(struct wakeup_source *ws); extern void wakeup_source_destroy(struct wakeup_source *ws); extern void wakeup_source_add(struct wakeup_source *ws); extern void wakeup_source_remove(struct wakeup_source *ws); extern struct wakeup_source *wakeup_source_register(const char *name); extern void wakeup_source_unregister(struct wakeup_source *ws); extern int device_wakeup_enable(struct device *dev); extern int device_wakeup_disable(struct device *dev); extern void device_set_wakeup_capable(struct device *dev, bool capable); extern int device_init_wakeup(struct device *dev, bool val); extern int device_set_wakeup_enable(struct device *dev, bool enable); extern void __pm_stay_awake(struct wakeup_source *ws); extern void pm_stay_awake(struct device *dev); extern void __pm_relax(struct wakeup_source *ws); extern void pm_relax(struct device *dev); extern void pm_wakeup_ws_event(struct wakeup_source *ws, unsigned int msec, bool hard); extern void pm_wakeup_dev_event(struct device *dev, unsigned int msec, bool hard); #else /* !CONFIG_PM_SLEEP */
static inline void device_set_wakeup_capable(struct device *dev, bool capable) { dev->power.can_wakeup = capable; }

Contributors

PersonTokensPropCommitsCommitProp
Alan Stern1878.26%133.33%
Rafael J. Wysocki417.39%133.33%
Dmitry Torokhov14.35%133.33%
Total23100.00%3100.00%


static inline bool device_can_wakeup(struct device *dev) { return dev->power.can_wakeup; }

Contributors

PersonTokensPropCommitsCommitProp
Alan Stern1578.95%133.33%
Rafael J. Wysocki315.79%133.33%
Dmitry Torokhov15.26%133.33%
Total19100.00%3100.00%


static inline void wakeup_source_prepare(struct wakeup_source *ws, const char *name) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki16100.00%1100.00%
Total16100.00%1100.00%


static inline struct wakeup_source *wakeup_source_create(const char *name) { return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki17100.00%1100.00%
Total17100.00%1100.00%


static inline void wakeup_source_drop(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline void wakeup_source_destroy(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline void wakeup_source_add(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline void wakeup_source_remove(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki872.73%150.00%
Alan Stern327.27%150.00%
Total11100.00%2100.00%


static inline struct wakeup_source *wakeup_source_register(const char *name) { return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki17100.00%1100.00%
Total17100.00%1100.00%


static inline void wakeup_source_unregister(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline int device_wakeup_enable(struct device *dev) { dev->power.should_wakeup = true; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki1669.57%266.67%
Alan Stern730.43%133.33%
Total23100.00%3100.00%


static inline int device_wakeup_disable(struct device *dev) { dev->power.should_wakeup = false; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki2191.30%266.67%
Alan Stern28.70%133.33%
Total23100.00%3100.00%


static inline int device_set_wakeup_enable(struct device *dev, bool enable) { dev->power.should_wakeup = enable; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Stephen Rothwell934.62%120.00%
Alan Stern830.77%120.00%
Rafael J. Wysocki830.77%240.00%
Dmitry Torokhov13.85%120.00%
Total26100.00%5100.00%


static inline int device_init_wakeup(struct device *dev, bool val) { device_set_wakeup_capable(dev, val); device_set_wakeup_enable(dev, val); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki2268.75%266.67%
Alan Stern1031.25%133.33%
Total32100.00%3100.00%


static inline bool device_may_wakeup(struct device *dev) { return dev->power.can_wakeup && dev->power.should_wakeup; }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki2392.00%150.00%
Alan Stern28.00%150.00%
Total25100.00%2100.00%


static inline void __pm_stay_awake(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki872.73%150.00%
Dmitry Torokhov327.27%150.00%
Total11100.00%2100.00%


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

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline void __pm_relax(struct wakeup_source *ws) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki11100.00%1100.00%
Total11100.00%1100.00%


static inline void pm_relax(struct device *dev) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki654.55%133.33%
Dmitry Torokhov327.27%133.33%
Alan Stern218.18%133.33%
Total11100.00%3100.00%


static inline void pm_wakeup_ws_event(struct wakeup_source *ws, unsigned int msec, bool hard) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki1688.89%266.67%
Alan Stern211.11%133.33%
Total18100.00%3100.00%


static inline void pm_wakeup_dev_event(struct device *dev, unsigned int msec, bool hard) {}

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki1055.56%250.00%
Dmitry Torokhov527.78%125.00%
Alan Stern316.67%125.00%
Total18100.00%4100.00%

#endif /* !CONFIG_PM_SLEEP */
static inline void wakeup_source_init(struct wakeup_source *ws, const char *name) { wakeup_source_prepare(ws, name); wakeup_source_add(ws); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki29100.00%1100.00%
Total29100.00%1100.00%


static inline void wakeup_source_trash(struct wakeup_source *ws) { wakeup_source_remove(ws); wakeup_source_drop(ws); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki22100.00%1100.00%
Total22100.00%1100.00%


static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec) { return pm_wakeup_ws_event(ws, msec, false); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki26100.00%1100.00%
Total26100.00%1100.00%


static inline void pm_wakeup_event(struct device *dev, unsigned int msec) { return pm_wakeup_dev_event(dev, msec, false); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki26100.00%1100.00%
Total26100.00%1100.00%


static inline void pm_wakeup_hard_event(struct device *dev) { return pm_wakeup_dev_event(dev, 0, true); }

Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki22100.00%1100.00%
Total22100.00%1100.00%

#endif /* _LINUX_PM_WAKEUP_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Rafael J. Wysocki71483.02%861.54%
Alan Stern11012.79%215.38%
Dmitry Torokhov182.09%17.69%
Tony Lindgren91.05%17.69%
Stephen Rothwell91.05%17.69%
Total860100.00%13100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.