Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Variables
wakeup.c File Reference
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/capability.h>
#include <linux/export.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <trace/events/power.h>
#include "power.h"

Go to the source code of this file.

Macros

#define IN_PROGRESS_BITS   (sizeof(int) * 4)
 
#define MAX_IN_PROGRESS   ((1 << IN_PROGRESS_BITS) - 1)
 

Functions

string won't be freed when @ws is still in

use.

void wakeup_source_prepare (struct wakeup_source *ws, const char *name)
 
 EXPORT_SYMBOL_GPL (wakeup_source_prepare)
 
: Name of the new wakeup source.

wakeup_source_create - Create a struct wakeup_source object.

struct wakeup_sourcewakeup_source_create (const char *name)
 
 EXPORT_SYMBOL_GPL (wakeup_source_create)
 
void wakeup_source_drop (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (wakeup_source_drop)
 
void wakeup_source_destroy (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (wakeup_source_destroy)
 
void wakeup_source_add (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (wakeup_source_add)
 
void wakeup_source_remove (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (wakeup_source_remove)
 

Variables

bool events_check_enabled __read_mostly
 

: Name of the wakeup source to register.

wakeup_source_register - Create wakeup source and add it to the list.

struct wakeup_sourcewakeup_source_register (const char *name)
 
 EXPORT_SYMBOL_GPL (wakeup_source_register)
 
void wakeup_source_unregister (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (wakeup_source_unregister)
 
int device_wakeup_enable (struct device *dev)
 
 EXPORT_SYMBOL_GPL (device_wakeup_enable)
 
int device_wakeup_disable (struct device *dev)
 
 EXPORT_SYMBOL_GPL (device_wakeup_disable)
 
void device_set_wakeup_capable (struct device *dev, bool capable)
 
 EXPORT_SYMBOL_GPL (device_set_wakeup_capable)
 
int device_init_wakeup (struct device *dev, bool enable)
 
 EXPORT_SYMBOL_GPL (device_init_wakeup)
 
int device_set_wakeup_enable (struct device *dev, bool enable)
 
 EXPORT_SYMBOL_GPL (device_set_wakeup_enable)
 
void __pm_stay_awake (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (__pm_stay_awake)
 
void pm_stay_awake (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_stay_awake)
 
void __pm_relax (struct wakeup_source *ws)
 
 EXPORT_SYMBOL_GPL (__pm_relax)
 
void pm_relax (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pm_relax)
 
void __pm_wakeup_event (struct wakeup_source *ws, unsigned int msec)
 
 EXPORT_SYMBOL_GPL (__pm_wakeup_event)
 
void pm_wakeup_event (struct device *dev, unsigned int msec)
 
 EXPORT_SYMBOL_GPL (pm_wakeup_event)
 
bool pm_wakeup_pending (void)
 
bool pm_get_wakeup_count (unsigned int *count, bool block)
 
bool pm_save_wakeup_count (unsigned int count)
 
 postcore_initcall (wakeup_sources_debugfs_init)
 

Macro Definition Documentation

#define IN_PROGRESS_BITS   (sizeof(int) * 4)

Definition at line 34 of file wakeup.c.

#define MAX_IN_PROGRESS   ((1 << IN_PROGRESS_BITS) - 1)

Definition at line 35 of file wakeup.c.

Function Documentation

void __pm_relax ( struct wakeup_source ws)

__pm_relax - Notify the PM core that processing of a wakeup event has ended. : Wakeup source object associated with the source of the event.

Call this function for wakeup events whose processing started with calling __pm_stay_awake().

It is safe to call it from interrupt context.

Definition at line 535 of file wakeup.c.

void __pm_stay_awake ( struct wakeup_source ws)

__pm_stay_awake - Notify the PM core of a wakeup event. : Wakeup source object associated with the source of the event.

It is safe to call this function from interrupt context.

Definition at line 418 of file wakeup.c.

void __pm_wakeup_event ( struct wakeup_source ws,
unsigned int  msec 
)

__pm_wakeup_event - Notify the PM core of a wakeup event. : Wakeup source object associated with the event source. : Anticipated event processing time (in milliseconds).

Notify the PM core of a wakeup event whose source is that will take approximately milliseconds to be processed by the kernel. If is not active, activate it. If is nonzero, set up the ' timer to execute pm_wakeup_timer_fn() in future.

It is safe to call this function from interrupt context.

Definition at line 604 of file wakeup.c.

int device_init_wakeup ( struct device dev,
bool  enable 
)

device_init_wakeup - Device wakeup initialization. : Device to handle. : Whether or not to enable as a wakeup device.

By default, most devices should leave wakeup disabled. The exceptions are devices that everyone expects to be wakeup sources: keyboards, power buttons, possibly network interfaces, etc. Also, devices that don't generate their own wakeup requests but merely forward requests from one bus to another (like PCI bridges) should have wakeup enabled by default.

Definition at line 317 of file wakeup.c.

void device_set_wakeup_capable ( struct device dev,
bool  capable 
)

device_set_wakeup_capable - Set/reset device wakeup capability flag. : Device to handle. : Whether or not is capable of waking up the system from sleep.

If is set, set the 's power.can_wakeup flag and add its wakeup-related attributes to sysfs. Otherwise, unset the 's power.can_wakeup flag and remove its wakeup-related attributes from sysfs.

This function may sleep and it can't be called from any context where sleeping is not allowed.

Definition at line 289 of file wakeup.c.

int device_set_wakeup_enable ( struct device dev,
bool  enable 
)

device_set_wakeup_enable - Enable or disable a device to wake up the system. : Device to handle.

Definition at line 336 of file wakeup.c.

int device_wakeup_disable ( struct device dev)

device_wakeup_disable - Do not regard a device as a wakeup source any more. : Device to handle.

Detach the 's wakeup source object from it, unregister this wakeup source object and destroy it.

Definition at line 262 of file wakeup.c.

int device_wakeup_enable ( struct device dev)

device_wakeup_enable - Enable given device to be a wakeup source. : Device to handle.

Create a wakeup source object, register it and attach it to .

Definition at line 218 of file wakeup.c.

EXPORT_SYMBOL_GPL ( wakeup_source_prepare  )
EXPORT_SYMBOL_GPL ( wakeup_source_create  )
EXPORT_SYMBOL_GPL ( wakeup_source_drop  )
EXPORT_SYMBOL_GPL ( wakeup_source_destroy  )
EXPORT_SYMBOL_GPL ( wakeup_source_add  )
EXPORT_SYMBOL_GPL ( wakeup_source_remove  )
EXPORT_SYMBOL_GPL ( wakeup_source_register  )
EXPORT_SYMBOL_GPL ( wakeup_source_unregister  )
EXPORT_SYMBOL_GPL ( device_wakeup_enable  )
EXPORT_SYMBOL_GPL ( device_wakeup_disable  )
EXPORT_SYMBOL_GPL ( device_set_wakeup_capable  )
EXPORT_SYMBOL_GPL ( device_init_wakeup  )
EXPORT_SYMBOL_GPL ( device_set_wakeup_enable  )
EXPORT_SYMBOL_GPL ( __pm_stay_awake  )
EXPORT_SYMBOL_GPL ( pm_stay_awake  )
EXPORT_SYMBOL_GPL ( __pm_relax  )
EXPORT_SYMBOL_GPL ( pm_relax  )
EXPORT_SYMBOL_GPL ( __pm_wakeup_event  )
EXPORT_SYMBOL_GPL ( pm_wakeup_event  )
bool pm_get_wakeup_count ( unsigned int count,
bool  block 
)

pm_get_wakeup_count - Read the number of registered wakeup events. : Address to store the value at. : Whether or not to block.

Store the number of registered wakeup events at the address in . If is set, block until the current number of wakeup events being processed is zero.

Return 'false' if the current number of wakeup events being processed is nonzero. Otherwise return 'true'.

Definition at line 722 of file wakeup.c.

void pm_relax ( struct device dev)

pm_relax - Notify the PM core that processing of a wakeup event has ended. : Device that signaled the event.

Execute __pm_relax() for the 's wakeup source object.

Definition at line 555 of file wakeup.c.

bool pm_save_wakeup_count ( unsigned int  count)

pm_save_wakeup_count - Save the current number of registered wakeup events. : Value to compare with the current number of registered wakeup events.

If is equal to the current number of registered wakeup events and the current number of wakeup events being processed is zero, store as the old number of registered wakeup events for pm_check_wakeup_events(), enable wakeup events detection and return 'true'. Otherwise disable wakeup events detection and return 'false'.

Definition at line 756 of file wakeup.c.

void pm_stay_awake ( struct device dev)

pm_stay_awake - Notify the PM core that a wakeup event is being processed. : Device the wakeup event is related to.

Notify the PM core of a wakeup event (signaled by ) by calling __pm_stay_awake for the 's wakeup source object.

Call this function after detecting of a wakeup event if pm_relax() is going to be called directly after processing the event (and possibly passing it to user space for further processing).

Definition at line 446 of file wakeup.c.

void pm_wakeup_event ( struct device dev,
unsigned int  msec 
)

pm_wakeup_event - Notify the PM core of a wakeup event. : Device the wakeup event is related to. : Anticipated event processing time (in milliseconds).

Call __pm_wakeup_event() for the 's wakeup source object.

Definition at line 643 of file wakeup.c.

bool pm_wakeup_pending ( void  )

pm_wakeup_pending - Check if power transition in progress should be aborted.

Compare the current number of registered wakeup events with its preserved value from the past and return true if new wakeup events have been registered since the old value was stored. Also return true if the current number of wakeup events being processed is different from zero.

Definition at line 689 of file wakeup.c.

postcore_initcall ( wakeup_sources_debugfs_init  )
void wakeup_source_add ( struct wakeup_source ws)

wakeup_source_add - Add given object to the list of wakeup sources. : Wakeup source object to add to the list.

Definition at line 128 of file wakeup.c.

struct wakeup_source* wakeup_source_create ( const char name)
read

Definition at line 77 of file wakeup.c.

void wakeup_source_destroy ( struct wakeup_source ws)

wakeup_source_destroy - Destroy a struct wakeup_source object. : Wakeup source to destroy.

Use only for wakeup source objects created with wakeup_source_create().

Definition at line 113 of file wakeup.c.

void wakeup_source_drop ( struct wakeup_source ws)

wakeup_source_drop - Prepare a struct wakeup_source object for destruction. : Wakeup source to prepare for destruction.

Callers must ensure that __pm_stay_awake() or __pm_wakeup_event() will never be run in parallel with this function for the same wakeup source object.

Definition at line 97 of file wakeup.c.

void wakeup_source_prepare ( struct wakeup_source ws,
const char name 
)

Definition at line 64 of file wakeup.c.

struct wakeup_source* wakeup_source_register ( const char name)
read

Definition at line 168 of file wakeup.c.

void wakeup_source_remove ( struct wakeup_source ws)

wakeup_source_remove - Remove given object from the wakeup sources list. : Wakeup source object to remove from the list.

Definition at line 150 of file wakeup.c.

void wakeup_source_unregister ( struct wakeup_source ws)

wakeup_source_unregister - Remove wakeup source from the list and remove it. : Wakeup source object to unregister.

Definition at line 184 of file wakeup.c.

Variable Documentation

bool events_check_enabled __read_mostly

Definition at line 25 of file wakeup.c.