138 lines · plain
1========================2Kernel driver for lm35563========================4 5* Texas Instrument:6 1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source7* Datasheet: http://www.national.com/ds/LM/LM3556.pdf8 9Authors:10 - Daniel Jeong11 12 Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)13 14Description15-----------16There are 3 functions in LM3556, Flash, Torch and Indicator.17 18Flash Mode19^^^^^^^^^^20 21In Flash Mode, the LED current source(LED) provides 16 target current levels22from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT23CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),24or by pulling the STROBE pin HIGH.25 26LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file27 28* if STROBE pin is enabled, below example control brightness only, and29 ON / OFF will be controlled by STROBE pin.30 31Flash Example:32 33OFF::34 35 #echo 0 > /sys/class/leds/flash/brightness36 3793.75 mA::38 39 #echo 1 > /sys/class/leds/flash/brightness40 41...42 431500 mA::44 45 #echo 16 > /sys/class/leds/flash/brightness46 47Torch Mode48^^^^^^^^^^49 50In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL51REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the52hardware TORCH input.53 54LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.55* if TORCH pin is enabled, below example control brightness only,56and ON / OFF will be controlled by TORCH pin.57 58Torch Example:59 60OFF::61 62 #echo 0 > /sys/class/leds/torch/brightness63 6446.88 mA::65 66 #echo 1 > /sys/class/leds/torch/brightness67 68...69 70375 mA::71 72 #echo 8 > /sys/class/leds/torch/brightness73 74Indicator Mode75^^^^^^^^^^^^^^76 77Indicator pattern can be set through /sys/class/leds/indicator/pattern file,78and 4 patterns are pre-defined in indicator_pattern array.79 80According to N-lank, Pulse time and N Period values, different pattern wiill81be generated.If you want new patterns for your own device, change82indicator_pattern array with your own values and INDIC_PATTERN_SIZE.83 84Please refer datasheet for more detail about N-Blank, Pulse time and N Period.85 86Indicator pattern example:87 88pattern 0::89 90 #echo 0 > /sys/class/leds/indicator/pattern91 92...93 94pattern 3::95 96 #echo 3 > /sys/class/leds/indicator/pattern97 98Indicator brightness can be controlled through99sys/class/leds/indicator/brightness file.100 101Example:102 103OFF::104 105 #echo 0 > /sys/class/leds/indicator/brightness106 1075.86 mA::108 109 #echo 1 > /sys/class/leds/indicator/brightness110 111...112 11346.875mA::114 115 #echo 8 > /sys/class/leds/indicator/brightness116 117Notes118-----119Driver expects it is registered using the i2c_board_info mechanism.120To register the chip at address 0x63 on specific adapter, set the platform data121according to include/linux/platform_data/leds-lm3556.h, set the i2c board info122 123Example::124 125 static struct i2c_board_info board_i2c_ch4[] __initdata = {126 {127 I2C_BOARD_INFO(LM3556_NAME, 0x63),128 .platform_data = &lm3556_pdata,129 },130 };131 132and register it in the platform init function133 134Example::135 136 board_register_i2c_bus(4, 400,137 board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));138