Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
adp8870_bl.c File Reference
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/leds.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/i2c/adp8870.h>

Go to the source code of this file.

Data Structures

struct  adp8870_bl
 
struct  adp8870_led
 

Macros

#define ADP8870_EXT_FEATURES
 
#define ADP8870_USE_LEDS
 
#define ADP8870_MFDVID   0x00 /* Manufacturer and device ID */
 
#define ADP8870_MDCR   0x01 /* Device mode and status */
 
#define ADP8870_INT_STAT   0x02 /* Interrupts status */
 
#define ADP8870_INT_EN   0x03 /* Interrupts enable */
 
#define ADP8870_CFGR   0x04 /* Configuration register */
 
#define ADP8870_BLSEL   0x05 /* Sink enable backlight or independent */
 
#define ADP8870_PWMLED   0x06 /* PWM Enable Selection Register */
 
#define ADP8870_BLOFF   0x07 /* Backlight off timeout */
 
#define ADP8870_BLDIM   0x08 /* Backlight dim timeout */
 
#define ADP8870_BLFR   0x09 /* Backlight fade in and out rates */
 
#define ADP8870_BLMX1   0x0A /* Backlight (Brightness Level 1-daylight) maximum current */
 
#define ADP8870_BLDM1   0x0B /* Backlight (Brightness Level 1-daylight) dim current */
 
#define ADP8870_BLMX2   0x0C /* Backlight (Brightness Level 2-bright) maximum current */
 
#define ADP8870_BLDM2   0x0D /* Backlight (Brightness Level 2-bright) dim current */
 
#define ADP8870_BLMX3   0x0E /* Backlight (Brightness Level 3-office) maximum current */
 
#define ADP8870_BLDM3   0x0F /* Backlight (Brightness Level 3-office) dim current */
 
#define ADP8870_BLMX4   0x10 /* Backlight (Brightness Level 4-indoor) maximum current */
 
#define ADP8870_BLDM4   0x11 /* Backlight (Brightness Level 4-indoor) dim current */
 
#define ADP8870_BLMX5   0x12 /* Backlight (Brightness Level 5-dark) maximum current */
 
#define ADP8870_BLDM5   0x13 /* Backlight (Brightness Level 5-dark) dim current */
 
#define ADP8870_ISCLAW   0x1A /* Independent sink current fade law register */
 
#define ADP8870_ISCC   0x1B /* Independent sink current control register */
 
#define ADP8870_ISCT1   0x1C /* Independent Sink Current Timer Register LED[7:5] */
 
#define ADP8870_ISCT2   0x1D /* Independent Sink Current Timer Register LED[4:1] */
 
#define ADP8870_ISCF   0x1E /* Independent sink current fade register */
 
#define ADP8870_ISC1   0x1F /* Independent Sink Current LED1 */
 
#define ADP8870_ISC2   0x20 /* Independent Sink Current LED2 */
 
#define ADP8870_ISC3   0x21 /* Independent Sink Current LED3 */
 
#define ADP8870_ISC4   0x22 /* Independent Sink Current LED4 */
 
#define ADP8870_ISC5   0x23 /* Independent Sink Current LED5 */
 
#define ADP8870_ISC6   0x24 /* Independent Sink Current LED6 */
 
#define ADP8870_ISC7   0x25 /* Independent Sink Current LED7 (Brightness Level 1-daylight) */
 
#define ADP8870_ISC7_L2   0x26 /* Independent Sink Current LED7 (Brightness Level 2-bright) */
 
#define ADP8870_ISC7_L3   0x27 /* Independent Sink Current LED7 (Brightness Level 3-office) */
 
#define ADP8870_ISC7_L4   0x28 /* Independent Sink Current LED7 (Brightness Level 4-indoor) */
 
#define ADP8870_ISC7_L5   0x29 /* Independent Sink Current LED7 (Brightness Level 5-dark) */
 
#define ADP8870_CMP_CTL   0x2D /* ALS Comparator Control Register */
 
#define ADP8870_ALS1_EN   0x2E /* Main ALS comparator level enable */
 
#define ADP8870_ALS2_EN   0x2F /* Second ALS comparator level enable */
 
#define ADP8870_ALS1_STAT   0x30 /* Main ALS Comparator Status Register */
 
#define ADP8870_ALS2_STAT   0x31 /* Second ALS Comparator Status Register */
 
#define ADP8870_L2TRP   0x32 /* L2 comparator reference */
 
#define ADP8870_L2HYS   0x33 /* L2 hysteresis */
 
#define ADP8870_L3TRP   0x34 /* L3 comparator reference */
 
#define ADP8870_L3HYS   0x35 /* L3 hysteresis */
 
#define ADP8870_L4TRP   0x36 /* L4 comparator reference */
 
#define ADP8870_L4HYS   0x37 /* L4 hysteresis */
 
#define ADP8870_L5TRP   0x38 /* L5 comparator reference */
 
#define ADP8870_L5HYS   0x39 /* L5 hysteresis */
 
#define ADP8870_PH1LEVL   0x40 /* First phototransistor ambient light level-low byte register */
 
#define ADP8870_PH1LEVH   0x41 /* First phototransistor ambient light level-high byte register */
 
#define ADP8870_PH2LEVL   0x42 /* Second phototransistor ambient light level-low byte register */
 
#define ADP8870_PH2LEVH   0x43 /* Second phototransistor ambient light level-high byte register */
 
#define ADP8870_MANUFID   0x3 /* Analog Devices AD8870 Manufacturer and device ID */
 
#define ADP8870_DEVID(x)   ((x) & 0xF)
 
#define ADP8870_MANID(x)   ((x) >> 4)
 
#define D7ALSEN   (1 << 7)
 
#define INT_CFG   (1 << 6)
 
#define NSTBY   (1 << 5)
 
#define DIM_EN   (1 << 4)
 
#define GDWN_DIS   (1 << 3)
 
#define SIS_EN   (1 << 2)
 
#define CMP_AUTOEN   (1 << 1)
 
#define BLEN   (1 << 0)
 
#define L5_EN   (1 << 3)
 
#define L4_EN   (1 << 2)
 
#define L3_EN   (1 << 1)
 
#define L2_EN   (1 << 0)
 
#define CFGR_BLV_SHIFT   3
 
#define CFGR_BLV_MASK   0x7
 
#define ADP8870_FLAG_LED_MASK   0xFF
 
#define FADE_VAL(in, out)   ((0xF & (in)) | ((0xF & (out)) << 4))
 
#define BL_CFGR_VAL(law, blv)   ((((blv) & CFGR_BLV_MASK) << CFGR_BLV_SHIFT) | ((0x3 & (law)) << 1))
 
#define ALS_CMPR_CFG_VAL(filt)   ((0x7 & (filt)) << 1)
 
#define adp8870_i2c_suspend   NULL
 
#define adp8870_i2c_resume   NULL
 

Functions

 MODULE_DEVICE_TABLE (i2c, adp8870_id)
 
 module_i2c_driver (adp8870_driver)
 
 MODULE_LICENSE ("GPL v2")
 
 MODULE_AUTHOR ("Michael Hennerich <[email protected]>")
 
 MODULE_DESCRIPTION ("ADP8870 Backlight driver")
 
 MODULE_ALIAS ("i2c:adp8870-backlight")
 

Macro Definition Documentation

#define ADP8870_ALS1_EN   0x2E /* Main ALS comparator level enable */

Definition at line 63 of file adp8870_bl.c.

#define ADP8870_ALS1_STAT   0x30 /* Main ALS Comparator Status Register */

Definition at line 65 of file adp8870_bl.c.

#define ADP8870_ALS2_EN   0x2F /* Second ALS comparator level enable */

Definition at line 64 of file adp8870_bl.c.

#define ADP8870_ALS2_STAT   0x31 /* Second ALS Comparator Status Register */

Definition at line 66 of file adp8870_bl.c.

#define ADP8870_BLDIM   0x08 /* Backlight dim timeout */

Definition at line 34 of file adp8870_bl.c.

#define ADP8870_BLDM1   0x0B /* Backlight (Brightness Level 1-daylight) dim current */

Definition at line 37 of file adp8870_bl.c.

#define ADP8870_BLDM2   0x0D /* Backlight (Brightness Level 2-bright) dim current */

Definition at line 39 of file adp8870_bl.c.

#define ADP8870_BLDM3   0x0F /* Backlight (Brightness Level 3-office) dim current */

Definition at line 41 of file adp8870_bl.c.

#define ADP8870_BLDM4   0x11 /* Backlight (Brightness Level 4-indoor) dim current */

Definition at line 43 of file adp8870_bl.c.

#define ADP8870_BLDM5   0x13 /* Backlight (Brightness Level 5-dark) dim current */

Definition at line 45 of file adp8870_bl.c.

#define ADP8870_BLFR   0x09 /* Backlight fade in and out rates */

Definition at line 35 of file adp8870_bl.c.

#define ADP8870_BLMX1   0x0A /* Backlight (Brightness Level 1-daylight) maximum current */

Definition at line 36 of file adp8870_bl.c.

#define ADP8870_BLMX2   0x0C /* Backlight (Brightness Level 2-bright) maximum current */

Definition at line 38 of file adp8870_bl.c.

#define ADP8870_BLMX3   0x0E /* Backlight (Brightness Level 3-office) maximum current */

Definition at line 40 of file adp8870_bl.c.

#define ADP8870_BLMX4   0x10 /* Backlight (Brightness Level 4-indoor) maximum current */

Definition at line 42 of file adp8870_bl.c.

#define ADP8870_BLMX5   0x12 /* Backlight (Brightness Level 5-dark) maximum current */

Definition at line 44 of file adp8870_bl.c.

#define ADP8870_BLOFF   0x07 /* Backlight off timeout */

Definition at line 33 of file adp8870_bl.c.

#define ADP8870_BLSEL   0x05 /* Sink enable backlight or independent */

Definition at line 31 of file adp8870_bl.c.

#define ADP8870_CFGR   0x04 /* Configuration register */

Definition at line 30 of file adp8870_bl.c.

#define ADP8870_CMP_CTL   0x2D /* ALS Comparator Control Register */

Definition at line 62 of file adp8870_bl.c.

#define ADP8870_DEVID (   x)    ((x) & 0xF)

Definition at line 81 of file adp8870_bl.c.

#define ADP8870_EXT_FEATURES

Definition at line 22 of file adp8870_bl.c.

#define ADP8870_FLAG_LED_MASK   0xFF

Definition at line 102 of file adp8870_bl.c.

#define adp8870_i2c_resume   NULL

Definition at line 966 of file adp8870_bl.c.

#define adp8870_i2c_suspend   NULL

Definition at line 965 of file adp8870_bl.c.

#define ADP8870_INT_EN   0x03 /* Interrupts enable */

Definition at line 29 of file adp8870_bl.c.

#define ADP8870_INT_STAT   0x02 /* Interrupts status */

Definition at line 28 of file adp8870_bl.c.

#define ADP8870_ISC1   0x1F /* Independent Sink Current LED1 */

Definition at line 51 of file adp8870_bl.c.

#define ADP8870_ISC2   0x20 /* Independent Sink Current LED2 */

Definition at line 52 of file adp8870_bl.c.

#define ADP8870_ISC3   0x21 /* Independent Sink Current LED3 */

Definition at line 53 of file adp8870_bl.c.

#define ADP8870_ISC4   0x22 /* Independent Sink Current LED4 */

Definition at line 54 of file adp8870_bl.c.

#define ADP8870_ISC5   0x23 /* Independent Sink Current LED5 */

Definition at line 55 of file adp8870_bl.c.

#define ADP8870_ISC6   0x24 /* Independent Sink Current LED6 */

Definition at line 56 of file adp8870_bl.c.

#define ADP8870_ISC7   0x25 /* Independent Sink Current LED7 (Brightness Level 1-daylight) */

Definition at line 57 of file adp8870_bl.c.

#define ADP8870_ISC7_L2   0x26 /* Independent Sink Current LED7 (Brightness Level 2-bright) */

Definition at line 58 of file adp8870_bl.c.

#define ADP8870_ISC7_L3   0x27 /* Independent Sink Current LED7 (Brightness Level 3-office) */

Definition at line 59 of file adp8870_bl.c.

#define ADP8870_ISC7_L4   0x28 /* Independent Sink Current LED7 (Brightness Level 4-indoor) */

Definition at line 60 of file adp8870_bl.c.

#define ADP8870_ISC7_L5   0x29 /* Independent Sink Current LED7 (Brightness Level 5-dark) */

Definition at line 61 of file adp8870_bl.c.

#define ADP8870_ISCC   0x1B /* Independent sink current control register */

Definition at line 47 of file adp8870_bl.c.

#define ADP8870_ISCF   0x1E /* Independent sink current fade register */

Definition at line 50 of file adp8870_bl.c.

#define ADP8870_ISCLAW   0x1A /* Independent sink current fade law register */

Definition at line 46 of file adp8870_bl.c.

#define ADP8870_ISCT1   0x1C /* Independent Sink Current Timer Register LED[7:5] */

Definition at line 48 of file adp8870_bl.c.

#define ADP8870_ISCT2   0x1D /* Independent Sink Current Timer Register LED[4:1] */

Definition at line 49 of file adp8870_bl.c.

#define ADP8870_L2HYS   0x33 /* L2 hysteresis */

Definition at line 68 of file adp8870_bl.c.

#define ADP8870_L2TRP   0x32 /* L2 comparator reference */

Definition at line 67 of file adp8870_bl.c.

#define ADP8870_L3HYS   0x35 /* L3 hysteresis */

Definition at line 70 of file adp8870_bl.c.

#define ADP8870_L3TRP   0x34 /* L3 comparator reference */

Definition at line 69 of file adp8870_bl.c.

#define ADP8870_L4HYS   0x37 /* L4 hysteresis */

Definition at line 72 of file adp8870_bl.c.

#define ADP8870_L4TRP   0x36 /* L4 comparator reference */

Definition at line 71 of file adp8870_bl.c.

#define ADP8870_L5HYS   0x39 /* L5 hysteresis */

Definition at line 74 of file adp8870_bl.c.

#define ADP8870_L5TRP   0x38 /* L5 comparator reference */

Definition at line 73 of file adp8870_bl.c.

#define ADP8870_MANID (   x)    ((x) >> 4)

Definition at line 82 of file adp8870_bl.c.

#define ADP8870_MANUFID   0x3 /* Analog Devices AD8870 Manufacturer and device ID */

Definition at line 80 of file adp8870_bl.c.

#define ADP8870_MDCR   0x01 /* Device mode and status */

Definition at line 27 of file adp8870_bl.c.

#define ADP8870_MFDVID   0x00 /* Manufacturer and device ID */

Definition at line 26 of file adp8870_bl.c.

#define ADP8870_PH1LEVH   0x41 /* First phototransistor ambient light level-high byte register */

Definition at line 76 of file adp8870_bl.c.

#define ADP8870_PH1LEVL   0x40 /* First phototransistor ambient light level-low byte register */

Definition at line 75 of file adp8870_bl.c.

#define ADP8870_PH2LEVH   0x43 /* Second phototransistor ambient light level-high byte register */

Definition at line 78 of file adp8870_bl.c.

#define ADP8870_PH2LEVL   0x42 /* Second phototransistor ambient light level-low byte register */

Definition at line 77 of file adp8870_bl.c.

#define ADP8870_PWMLED   0x06 /* PWM Enable Selection Register */

Definition at line 32 of file adp8870_bl.c.

#define ADP8870_USE_LEDS

Definition at line 23 of file adp8870_bl.c.

#define ALS_CMPR_CFG_VAL (   filt)    ((0x7 & (filt)) << 1)

Definition at line 106 of file adp8870_bl.c.

#define BL_CFGR_VAL (   law,
  blv 
)    ((((blv) & CFGR_BLV_MASK) << CFGR_BLV_SHIFT) | ((0x3 & (law)) << 1))

Definition at line 105 of file adp8870_bl.c.

#define BLEN   (1 << 0)

Definition at line 92 of file adp8870_bl.c.

#define CFGR_BLV_MASK   0x7

Definition at line 101 of file adp8870_bl.c.

#define CFGR_BLV_SHIFT   3

Definition at line 100 of file adp8870_bl.c.

#define CMP_AUTOEN   (1 << 1)

Definition at line 91 of file adp8870_bl.c.

#define D7ALSEN   (1 << 7)

Definition at line 85 of file adp8870_bl.c.

#define DIM_EN   (1 << 4)

Definition at line 88 of file adp8870_bl.c.

#define FADE_VAL (   in,
  out 
)    ((0xF & (in)) | ((0xF & (out)) << 4))

Definition at line 104 of file adp8870_bl.c.

#define GDWN_DIS   (1 << 3)

Definition at line 89 of file adp8870_bl.c.

#define INT_CFG   (1 << 6)

Definition at line 86 of file adp8870_bl.c.

#define L2_EN   (1 << 0)

Definition at line 98 of file adp8870_bl.c.

#define L3_EN   (1 << 1)

Definition at line 97 of file adp8870_bl.c.

#define L4_EN   (1 << 2)

Definition at line 96 of file adp8870_bl.c.

#define L5_EN   (1 << 3)

Definition at line 95 of file adp8870_bl.c.

#define NSTBY   (1 << 5)

Definition at line 87 of file adp8870_bl.c.

#define SIS_EN   (1 << 2)

Definition at line 90 of file adp8870_bl.c.

Function Documentation

MODULE_ALIAS ( "i2c:adp8870-backlight"  )
MODULE_AUTHOR ( "Michael Hennerich <[email protected]>"  )
MODULE_DESCRIPTION ( "ADP8870 Backlight driver )
MODULE_DEVICE_TABLE ( i2c  ,
adp8870_id   
)
module_i2c_driver ( adp8870_driver  )
MODULE_LICENSE ( "GPL v2 )