Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
lm3533-ctrlbank.c File Reference
#include <linux/device.h>
#include <linux/module.h>
#include <linux/mfd/lm3533.h>

Go to the source code of this file.

Macros

#define LM3533_MAX_CURRENT_MIN   5000
 
#define LM3533_MAX_CURRENT_MAX   29800
 
#define LM3533_MAX_CURRENT_STEP   800
 
#define LM3533_BRIGHTNESS_MAX   255
 
#define LM3533_PWM_MAX   0x3f
 
#define LM3533_REG_PWM_BASE   0x14
 
#define LM3533_REG_MAX_CURRENT_BASE   0x1f
 
#define LM3533_REG_CTRLBANK_ENABLE   0x27
 
#define LM3533_REG_BRIGHTNESS_BASE   0x40
 
#define lm3533_ctrlbank_set(_name, _NAME)
 
#define lm3533_ctrlbank_get(_name, _NAME)
 

Functions

int lm3533_ctrlbank_enable (struct lm3533_ctrlbank *cb)
 
 EXPORT_SYMBOL_GPL (lm3533_ctrlbank_enable)
 
int lm3533_ctrlbank_disable (struct lm3533_ctrlbank *cb)
 
 EXPORT_SYMBOL_GPL (lm3533_ctrlbank_disable)
 
int lm3533_ctrlbank_set_max_current (struct lm3533_ctrlbank *cb, u16 imax)
 
 EXPORT_SYMBOL_GPL (lm3533_ctrlbank_set_max_current)
 
 lm3533_ctrlbank_set (brightness, BRIGHTNESS)
 
 lm3533_ctrlbank_get (brightness, BRIGHTNESS)
 
 lm3533_ctrlbank_set (pwm, PWM)
 
 lm3533_ctrlbank_get (pwm, PWM)
 
 MODULE_AUTHOR ("Johan Hovold <[email protected]>")
 
 MODULE_DESCRIPTION ("LM3533 Control Bank interface")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define LM3533_BRIGHTNESS_MAX   255

Definition at line 24 of file lm3533-ctrlbank.c.

#define lm3533_ctrlbank_get (   _name,
  _NAME 
)
Value:
int lm3533_ctrlbank_get_##_name(struct lm3533_ctrlbank *cb, u8 *val) \
{ \
u8 reg; \
int ret; \
\
reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
ret = lm3533_read(cb->lm3533, reg, val); \
if (ret) \
dev_err(cb->dev, "failed to get " #_name "\n"); \
\
return ret; \
} \
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_get_##_name);

Definition at line 114 of file lm3533-ctrlbank.c.

#define lm3533_ctrlbank_set (   _name,
  _NAME 
)
Value:
int lm3533_ctrlbank_set_##_name(struct lm3533_ctrlbank *cb, u8 val) \
{ \
u8 reg; \
int ret; \
if (val > LM3533_##_NAME##_MAX) \
return -EINVAL; \
\
reg = lm3533_ctrlbank_get_reg(cb, LM3533_REG_##_NAME##_BASE); \
ret = lm3533_write(cb->lm3533, reg, val); \
if (ret) \
dev_err(cb->dev, "failed to set " #_name "\n"); \
\
return ret; \
} \
EXPORT_SYMBOL_GPL(lm3533_ctrlbank_set_##_name);

Definition at line 96 of file lm3533-ctrlbank.c.

#define LM3533_MAX_CURRENT_MAX   29800

Definition at line 21 of file lm3533-ctrlbank.c.

#define LM3533_MAX_CURRENT_MIN   5000

Definition at line 20 of file lm3533-ctrlbank.c.

#define LM3533_MAX_CURRENT_STEP   800

Definition at line 22 of file lm3533-ctrlbank.c.

#define LM3533_PWM_MAX   0x3f

Definition at line 25 of file lm3533-ctrlbank.c.

#define LM3533_REG_BRIGHTNESS_BASE   0x40

Definition at line 30 of file lm3533-ctrlbank.c.

#define LM3533_REG_CTRLBANK_ENABLE   0x27

Definition at line 29 of file lm3533-ctrlbank.c.

#define LM3533_REG_MAX_CURRENT_BASE   0x1f

Definition at line 28 of file lm3533-ctrlbank.c.

#define LM3533_REG_PWM_BASE   0x14

Definition at line 27 of file lm3533-ctrlbank.c.

Function Documentation

EXPORT_SYMBOL_GPL ( lm3533_ctrlbank_enable  )
EXPORT_SYMBOL_GPL ( lm3533_ctrlbank_disable  )
EXPORT_SYMBOL_GPL ( lm3533_ctrlbank_set_max_current  )
int lm3533_ctrlbank_disable ( struct lm3533_ctrlbank cb)

Definition at line 55 of file lm3533-ctrlbank.c.

int lm3533_ctrlbank_enable ( struct lm3533_ctrlbank cb)

Definition at line 38 of file lm3533-ctrlbank.c.

lm3533_ctrlbank_get ( brightness  ,
BRIGHTNESS   
)
lm3533_ctrlbank_get ( pwm  ,
PWM   
)
lm3533_ctrlbank_set ( brightness  ,
BRIGHTNESS   
)
lm3533_ctrlbank_set ( pwm  ,
PWM   
)
int lm3533_ctrlbank_set_max_current ( struct lm3533_ctrlbank cb,
u16  imax 
)

Definition at line 76 of file lm3533-ctrlbank.c.

MODULE_AUTHOR ( "Johan Hovold <[email protected]>"  )
MODULE_DESCRIPTION ( "LM3533 Control Bank interface )
MODULE_LICENSE ( "GPL"  )