Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
leds-lp5523.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/ctype.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/leds.h>
#include <linux/leds-lp5523.h>
#include <linux/workqueue.h>
#include <linux/slab.h>

Go to the source code of this file.

Data Structures

struct  lp5523_engine
 
struct  lp5523_led
 
struct  lp5523_chip
 

Macros

#define LP5523_REG_ENABLE   0x00
 
#define LP5523_REG_OP_MODE   0x01
 
#define LP5523_REG_RATIOMETRIC_MSB   0x02
 
#define LP5523_REG_RATIOMETRIC_LSB   0x03
 
#define LP5523_REG_ENABLE_LEDS_MSB   0x04
 
#define LP5523_REG_ENABLE_LEDS_LSB   0x05
 
#define LP5523_REG_LED_CNTRL_BASE   0x06
 
#define LP5523_REG_LED_PWM_BASE   0x16
 
#define LP5523_REG_LED_CURRENT_BASE   0x26
 
#define LP5523_REG_CONFIG   0x36
 
#define LP5523_REG_CHANNEL1_PC   0x37
 
#define LP5523_REG_CHANNEL2_PC   0x38
 
#define LP5523_REG_CHANNEL3_PC   0x39
 
#define LP5523_REG_STATUS   0x3a
 
#define LP5523_REG_GPO   0x3b
 
#define LP5523_REG_VARIABLE   0x3c
 
#define LP5523_REG_RESET   0x3d
 
#define LP5523_REG_TEMP_CTRL   0x3e
 
#define LP5523_REG_TEMP_READ   0x3f
 
#define LP5523_REG_TEMP_WRITE   0x40
 
#define LP5523_REG_LED_TEST_CTRL   0x41
 
#define LP5523_REG_LED_TEST_ADC   0x42
 
#define LP5523_REG_ENG1_VARIABLE   0x45
 
#define LP5523_REG_ENG2_VARIABLE   0x46
 
#define LP5523_REG_ENG3_VARIABLE   0x47
 
#define LP5523_REG_MASTER_FADER1   0x48
 
#define LP5523_REG_MASTER_FADER2   0x49
 
#define LP5523_REG_MASTER_FADER3   0x4a
 
#define LP5523_REG_CH1_PROG_START   0x4c
 
#define LP5523_REG_CH2_PROG_START   0x4d
 
#define LP5523_REG_CH3_PROG_START   0x4e
 
#define LP5523_REG_PROG_PAGE_SEL   0x4f
 
#define LP5523_REG_PROG_MEM   0x50
 
#define LP5523_CMD_LOAD   0x15 /* 00010101 */
 
#define LP5523_CMD_RUN   0x2a /* 00101010 */
 
#define LP5523_CMD_DISABLED   0x00 /* 00000000 */
 
#define LP5523_ENABLE   0x40
 
#define LP5523_AUTO_INC   0x40
 
#define LP5523_PWR_SAVE   0x20
 
#define LP5523_PWM_PWR_SAVE   0x04
 
#define LP5523_CP_1   0x08
 
#define LP5523_CP_1_5   0x10
 
#define LP5523_CP_AUTO   0x18
 
#define LP5523_INT_CLK   0x01
 
#define LP5523_AUTO_CLK   0x02
 
#define LP5523_EN_LEDTEST   0x80
 
#define LP5523_LEDTEST_DONE   0x80
 
#define LP5523_DEFAULT_CURRENT   50 /* microAmps */
 
#define LP5523_PROGRAM_LENGTH   32 /* in bytes */
 
#define LP5523_PROGRAM_PAGES   6
 
#define LP5523_ADC_SHORTCIRC_LIM   80
 
#define LP5523_LEDS   9
 
#define LP5523_ENGINES   3
 
#define LP5523_ENG_MASK_BASE   0x30 /* 00110000 */
 
#define LP5523_ENG_STATUS_MASK   0x07 /* 00000111 */
 
#define LP5523_IRQ_FLAGS   IRQF_TRIGGER_FALLING
 
#define LP5523_EXT_CLK_USED   0x08
 
#define LED_ACTIVE(mux, led)   (!!(mux & (0x0001 << led)))
 
#define SHIFT_MASK(id)   (((id) - 1) * 2)
 
#define show_leds(nr)
 
#define store_leds(nr)
 
#define store_load(nr)
 
#define show_mode(nr)
 
#define store_mode(nr)
 

Enumerations

enum  lp5523_chip_id { LP5523, LP55231 }
 

Functions

 show_leds (1)
 
 store_leds (1)
 
 store_load (1)
 
 show_mode (1)
 
 store_mode (1)
 
 MODULE_DEVICE_TABLE (i2c, lp5523_id)
 
 module_i2c_driver (lp5523_driver)
 
 MODULE_AUTHOR ("Mathias Nyman <[email protected]>")
 
 MODULE_DESCRIPTION ("LP5523 LED engine")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define LED_ACTIVE (   mux,
  led 
)    (!!(mux & (0x0001 << led)))

Definition at line 104 of file leds-lp5523.c.

#define LP5523_ADC_SHORTCIRC_LIM   80

Definition at line 91 of file leds-lp5523.c.

#define LP5523_AUTO_CLK   0x02

Definition at line 84 of file leds-lp5523.c.

#define LP5523_AUTO_INC   0x40

Definition at line 77 of file leds-lp5523.c.

#define LP5523_CMD_DISABLED   0x00 /* 00000000 */

Definition at line 74 of file leds-lp5523.c.

#define LP5523_CMD_LOAD   0x15 /* 00010101 */

Definition at line 72 of file leds-lp5523.c.

#define LP5523_CMD_RUN   0x2a /* 00101010 */

Definition at line 73 of file leds-lp5523.c.

#define LP5523_CP_1   0x08

Definition at line 80 of file leds-lp5523.c.

#define LP5523_CP_1_5   0x10

Definition at line 81 of file leds-lp5523.c.

#define LP5523_CP_AUTO   0x18

Definition at line 82 of file leds-lp5523.c.

#define LP5523_DEFAULT_CURRENT   50 /* microAmps */

Definition at line 88 of file leds-lp5523.c.

#define LP5523_EN_LEDTEST   0x80

Definition at line 85 of file leds-lp5523.c.

#define LP5523_ENABLE   0x40

Definition at line 76 of file leds-lp5523.c.

#define LP5523_ENG_MASK_BASE   0x30 /* 00110000 */

Definition at line 96 of file leds-lp5523.c.

#define LP5523_ENG_STATUS_MASK   0x07 /* 00000111 */

Definition at line 98 of file leds-lp5523.c.

#define LP5523_ENGINES   3

Definition at line 94 of file leds-lp5523.c.

#define LP5523_EXT_CLK_USED   0x08

Definition at line 102 of file leds-lp5523.c.

#define LP5523_INT_CLK   0x01

Definition at line 83 of file leds-lp5523.c.

#define LP5523_IRQ_FLAGS   IRQF_TRIGGER_FALLING

Definition at line 100 of file leds-lp5523.c.

#define LP5523_LEDS   9

Definition at line 93 of file leds-lp5523.c.

#define LP5523_LEDTEST_DONE   0x80

Definition at line 86 of file leds-lp5523.c.

#define LP5523_PROGRAM_LENGTH   32 /* in bytes */

Definition at line 89 of file leds-lp5523.c.

#define LP5523_PROGRAM_PAGES   6

Definition at line 90 of file leds-lp5523.c.

#define LP5523_PWM_PWR_SAVE   0x04

Definition at line 79 of file leds-lp5523.c.

#define LP5523_PWR_SAVE   0x20

Definition at line 78 of file leds-lp5523.c.

#define LP5523_REG_CH1_PROG_START   0x4c

Definition at line 66 of file leds-lp5523.c.

#define LP5523_REG_CH2_PROG_START   0x4d

Definition at line 67 of file leds-lp5523.c.

#define LP5523_REG_CH3_PROG_START   0x4e

Definition at line 68 of file leds-lp5523.c.

#define LP5523_REG_CHANNEL1_PC   0x37

Definition at line 48 of file leds-lp5523.c.

#define LP5523_REG_CHANNEL2_PC   0x38

Definition at line 49 of file leds-lp5523.c.

#define LP5523_REG_CHANNEL3_PC   0x39

Definition at line 50 of file leds-lp5523.c.

#define LP5523_REG_CONFIG   0x36

Definition at line 47 of file leds-lp5523.c.

#define LP5523_REG_ENABLE   0x00

Definition at line 38 of file leds-lp5523.c.

#define LP5523_REG_ENABLE_LEDS_LSB   0x05

Definition at line 43 of file leds-lp5523.c.

#define LP5523_REG_ENABLE_LEDS_MSB   0x04

Definition at line 42 of file leds-lp5523.c.

#define LP5523_REG_ENG1_VARIABLE   0x45

Definition at line 60 of file leds-lp5523.c.

#define LP5523_REG_ENG2_VARIABLE   0x46

Definition at line 61 of file leds-lp5523.c.

#define LP5523_REG_ENG3_VARIABLE   0x47

Definition at line 62 of file leds-lp5523.c.

#define LP5523_REG_GPO   0x3b

Definition at line 52 of file leds-lp5523.c.

#define LP5523_REG_LED_CNTRL_BASE   0x06

Definition at line 44 of file leds-lp5523.c.

#define LP5523_REG_LED_CURRENT_BASE   0x26

Definition at line 46 of file leds-lp5523.c.

#define LP5523_REG_LED_PWM_BASE   0x16

Definition at line 45 of file leds-lp5523.c.

#define LP5523_REG_LED_TEST_ADC   0x42

Definition at line 59 of file leds-lp5523.c.

#define LP5523_REG_LED_TEST_CTRL   0x41

Definition at line 58 of file leds-lp5523.c.

#define LP5523_REG_MASTER_FADER1   0x48

Definition at line 63 of file leds-lp5523.c.

#define LP5523_REG_MASTER_FADER2   0x49

Definition at line 64 of file leds-lp5523.c.

#define LP5523_REG_MASTER_FADER3   0x4a

Definition at line 65 of file leds-lp5523.c.

#define LP5523_REG_OP_MODE   0x01

Definition at line 39 of file leds-lp5523.c.

#define LP5523_REG_PROG_MEM   0x50

Definition at line 70 of file leds-lp5523.c.

#define LP5523_REG_PROG_PAGE_SEL   0x4f

Definition at line 69 of file leds-lp5523.c.

#define LP5523_REG_RATIOMETRIC_LSB   0x03

Definition at line 41 of file leds-lp5523.c.

#define LP5523_REG_RATIOMETRIC_MSB   0x02

Definition at line 40 of file leds-lp5523.c.

#define LP5523_REG_RESET   0x3d

Definition at line 54 of file leds-lp5523.c.

#define LP5523_REG_STATUS   0x3a

Definition at line 51 of file leds-lp5523.c.

#define LP5523_REG_TEMP_CTRL   0x3e

Definition at line 55 of file leds-lp5523.c.

#define LP5523_REG_TEMP_READ   0x3f

Definition at line 56 of file leds-lp5523.c.

#define LP5523_REG_TEMP_WRITE   0x40

Definition at line 57 of file leds-lp5523.c.

#define LP5523_REG_VARIABLE   0x3c

Definition at line 53 of file leds-lp5523.c.

#define SHIFT_MASK (   id)    (((id) - 1) * 2)

Definition at line 105 of file leds-lp5523.c.

#define show_leds (   nr)
Value:
static ssize_t show_engine##nr##_leds(struct device *dev, \
char *buf) \
{ \
return show_engine_leds(dev, attr, buf, nr); \
}

Definition at line 393 of file leds-lp5523.c.

#define show_mode (   nr)
Value:
static ssize_t show_engine##nr##_mode(struct device *dev, \
char *buf) \
{ \
return show_engine_mode(dev, attr, buf, nr); \
}

Definition at line 627 of file leds-lp5523.c.

#define store_leds (   nr)
Value:
static ssize_t store_engine##nr##_leds(struct device *dev, \
const char *buf, size_t len) \
{ \
return store_engine_leds(dev, attr, buf, len, nr); \
}

Definition at line 430 of file leds-lp5523.c.

#define store_load (   nr)
Value:
static ssize_t store_engine##nr##_load(struct device *dev, \
const char *buf, size_t len) \
{ \
return store_engine_load(dev, attr, buf, len, nr); \
}

Definition at line 598 of file leds-lp5523.c.

#define store_mode (   nr)
Value:
static ssize_t store_engine##nr##_mode(struct device *dev, \
const char *buf, size_t len) \
{ \
return store_engine_mode(dev, attr, buf, len, nr); \
}

Definition at line 658 of file leds-lp5523.c.

Enumeration Type Documentation

Enumerator:
LP5523 
LP55231 

Definition at line 107 of file leds-lp5523.c.

Function Documentation

MODULE_AUTHOR ( "Mathias Nyman <[email protected]>"  )
MODULE_DESCRIPTION ( "LP5523 LED engine"  )
MODULE_DEVICE_TABLE ( i2c  ,
lp5523_id   
)
module_i2c_driver ( lp5523_driver  )
MODULE_LICENSE ( "GPL"  )
show_leds ( )

Definition at line 400 of file leds-lp5523.c.

show_mode ( )

Definition at line 634 of file leds-lp5523.c.

store_leds ( )

Definition at line 437 of file leds-lp5523.c.

store_load ( )

Definition at line 605 of file leds-lp5523.c.

store_mode ( )

Definition at line 665 of file leds-lp5523.c.