Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
leds.h File Reference
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/timer.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  led_classdev
 
struct  led_info
 
struct  led_platform_data
 
struct  gpio_led
 
struct  gpio_led_platform_data
 

Macros

#define LED_SUSPENDED   (1 << 0)
 
#define LED_CORE_SUSPENDRESUME   (1 << 16)
 
#define LED_BLINK_ONESHOT   (1 << 17)
 
#define LED_BLINK_ONESHOT_STOP   (1 << 18)
 
#define LED_BLINK_INVERT   (1 << 19)
 
#define DEFINE_LED_TRIGGER(x)
 
#define DEFINE_LED_TRIGGER_GLOBAL(x)
 
#define led_trigger_register_simple(x, y)   do {} while(0)
 
#define led_trigger_unregister_simple(x)   do {} while(0)
 
#define led_trigger_event(x, y)   do {} while(0)
 
#define ledtrig_ide_activity()   do {} while(0)
 
#define LEDS_GPIO_DEFSTATE_OFF   0
 
#define LEDS_GPIO_DEFSTATE_ON   1
 
#define LEDS_GPIO_DEFSTATE_KEEP   2
 
#define GPIO_LED_NO_BLINK_LOW   0 /* No blink GPIO state low */
 
#define GPIO_LED_NO_BLINK_HIGH   1 /* No blink GPIO state high */
 
#define GPIO_LED_BLINK   2 /* Please, blink */
 

Enumerations

enum  led_brightness { LED_OFF = 0, LED_HALF = 127, LED_FULL = 255 }
 
enum  cpu_led_event {
  CPU_LED_IDLE_START, CPU_LED_IDLE_END, CPU_LED_START, CPU_LED_STOP,
  CPU_LED_HALTED
}
 

Functions

int led_classdev_register (struct device *parent, struct led_classdev *led_cdev)
 
void led_classdev_unregister (struct led_classdev *led_cdev)
 
void led_classdev_suspend (struct led_classdev *led_cdev)
 
void led_classdev_resume (struct led_classdev *led_cdev)
 
void led_blink_set (struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off)
 
void led_blink_set_oneshot (struct led_classdev *led_cdev, unsigned long *delay_on, unsigned long *delay_off, int invert)
 
void led_set_brightness (struct led_classdev *led_cdev, enum led_brightness brightness)
 
struct platform_devicegpio_led_register_device (int id, const struct gpio_led_platform_data *pdata)
 

Macro Definition Documentation

#define DEFINE_LED_TRIGGER (   x)

Definition at line 186 of file leds.h.

#define DEFINE_LED_TRIGGER_GLOBAL (   x)

Definition at line 187 of file leds.h.

#define GPIO_LED_BLINK   2 /* Please, blink */

Definition at line 235 of file leds.h.

#define GPIO_LED_NO_BLINK_HIGH   1 /* No blink GPIO state high */

Definition at line 234 of file leds.h.

#define GPIO_LED_NO_BLINK_LOW   0 /* No blink GPIO state low */

Definition at line 233 of file leds.h.

#define LED_BLINK_INVERT   (1 << 19)

Definition at line 44 of file leds.h.

#define LED_BLINK_ONESHOT   (1 << 17)

Definition at line 42 of file leds.h.

#define LED_BLINK_ONESHOT_STOP   (1 << 18)

Definition at line 43 of file leds.h.

#define LED_CORE_SUSPENDRESUME   (1 << 16)

Definition at line 41 of file leds.h.

#define LED_SUSPENDED   (1 << 0)

Definition at line 39 of file leds.h.

#define led_trigger_event (   x,
  y 
)    do {} while(0)

Definition at line 190 of file leds.h.

#define led_trigger_register_simple (   x,
  y 
)    do {} while(0)

Definition at line 188 of file leds.h.

#define led_trigger_unregister_simple (   x)    do {} while(0)

Definition at line 189 of file leds.h.

#define LEDS_GPIO_DEFSTATE_KEEP   2

Definition at line 227 of file leds.h.

#define LEDS_GPIO_DEFSTATE_OFF   0

Definition at line 225 of file leds.h.

#define LEDS_GPIO_DEFSTATE_ON   1

Definition at line 226 of file leds.h.

#define ledtrig_ide_activity (   void)    do {} while(0)

Definition at line 198 of file leds.h.

Enumeration Type Documentation

Enumerator:
CPU_LED_IDLE_START 
CPU_LED_IDLE_END 
CPU_LED_START 
CPU_LED_STOP 
CPU_LED_HALTED 

Definition at line 244 of file leds.h.

Enumerator:
LED_OFF 
LED_HALF 
LED_FULL 

Definition at line 26 of file leds.h.

Function Documentation

struct platform_device* gpio_led_register_device ( int  id,
const struct gpio_led_platform_data pdata 
)
read

gpio_led_register_device - register a gpio-led device : the platform data used for the new device

Makes a copy of pdata and pdata->leds and registers a new leds-gpio device with the result. This allows to have pdata and pdata-leds in .init.rodata and so saves some bytes compared to a static struct platform_device with static platform data.

Returns the registered device or an error pointer.

Definition at line 25 of file leds-gpio-register.c.

void led_blink_set ( struct led_classdev led_cdev,
unsigned long delay_on,
unsigned long delay_off 
)

led_blink_set - set blinking with software fallback : the LED to start blinking : the time it should be on (in ms) : the time it should ble off (in ms)

This function makes the LED blink, attempting to use the hardware acceleration if possible, but falling back to software blinking if there is no hardware blinking or if the LED refuses the passed values.

Note that if software blinking is active, simply calling led_cdev->brightness_set() will not stop the blinking, use led_classdev_brightness_set() instead.

Definition at line 72 of file led-core.c.

void led_blink_set_oneshot ( struct led_classdev led_cdev,
unsigned long delay_on,
unsigned long delay_off,
int  invert 
)

led_blink_set_oneshot - do a oneshot software blink : the LED to start blinking : the time it should be on (in ms) : the time it should ble off (in ms) : blink off, then on, leaving the led on

This function makes the LED blink one time for delay_on + delay_off time, ignoring the request if another one-shot blink is already in progress.

If invert is set, led blinks for delay_off first, then for delay_on and leave the led on after the on-off cycle.

Definition at line 85 of file led-core.c.

int led_classdev_register ( struct device parent,
struct led_classdev led_cdev 
)

led_classdev_register - register a new object of led_classdev class. : The device to register. : the led_classdev structure for this device.

Definition at line 184 of file led-class.c.

void led_classdev_resume ( struct led_classdev led_cdev)

led_classdev_resume - resume an led_classdev. : the led_classdev to resume.

Definition at line 152 of file led-class.c.

void led_classdev_suspend ( struct led_classdev led_cdev)

led_classdev_suspend - suspend an led_classdev. : the led_classdev to suspend.

Definition at line 141 of file led-class.c.

void led_classdev_unregister ( struct led_classdev led_cdev)

led_classdev_unregister - unregisters a object of led_properties class. : the led device to unregister

Unregisters a previously registered via led_classdev_register object.

Definition at line 227 of file led-class.c.

void led_set_brightness ( struct led_classdev led_cdev,
enum led_brightness  brightness 
)

led_set_brightness - set LED brightness : the LED to set : the brightness to set it to

Set an LED's brightness, and, if necessary, cancel the software blink timer that implements blinking when the hardware doesn't.

Definition at line 114 of file led-core.c.