1Kernel driver for lm3556 2======================== 3 4*Texas Instrument: 5 1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source 6* Datasheet: http://www.national.com/ds/LM/LM3556.pdf 7 8Authors: 9 Daniel Jeong 10 Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com) 11 12Description 13----------- 14There are 3 functions in LM3556, Flash, Torch and Indicator. 15 16FLASH MODE 17In Flash Mode, the LED current source(LED) provides 16 target current levels 18from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT 19CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A), 20or by pulling the STROBE pin HIGH. 21LM3556 Flash can be controlled through sys/class/leds/flash/brightness file 22* if STROBE pin is enabled, below example control brightness only, and 23ON / OFF will be controlled by STROBE pin. 24 25Flash Example: 26OFF : #echo 0 > sys/class/leds/flash/brightness 2793.75 mA: #echo 1 > sys/class/leds/flash/brightness 28... ..... 291500 mA: #echo 16 > sys/class/leds/flash/brightness 30 31TORCH MODE 32In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL 33REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the 34hardware TORCH input. 35LM3556 torch can be controlled through sys/class/leds/torch/brightness file. 36* if TORCH pin is enabled, below example control brightness only, 37and ON / OFF will be controlled by TORCH pin. 38 39Torch Example: 40OFF : #echo 0 > sys/class/leds/torch/brightness 4146.88 mA: #echo 1 > sys/class/leds/torch/brightness 42... ..... 43375 mA : #echo 8 > sys/class/leds/torch/brightness 44 45INDICATOR MODE 46Indicator pattern can be set through sys/class/leds/indicator/pattern file, 47and 4 patterns are pre-defined in indicator_pattern array. 48According to N-lank, Pulse time and N Period values, different pattern wiill 49be generated.If you want new patterns for your own device, change 50indicator_pattern array with your own values and INDIC_PATTERN_SIZE. 51Please refer datasheet for more detail about N-Blank, Pulse time and N Period. 52 53Indicator pattern example: 54pattern 0: #echo 0 > sys/class/leds/indicator/pattern 55.... 56pattern 3: #echo 3 > sys/class/leds/indicator/pattern 57 58Indicator brightness can be controlled through 59sys/class/leds/indicator/brightness file. 60 61Example: 62OFF : #echo 0 > sys/class/leds/indicator/brightness 635.86 mA : #echo 1 > sys/class/leds/indicator/brightness 64........ 6546.875mA : #echo 8 > sys/class/leds/indicator/brightness 66 67Notes 68----- 69Driver expects it is registered using the i2c_board_info mechanism. 70To register the chip at address 0x63 on specific adapter, set the platform data 71according to include/linux/platform_data/leds-lm3556.h, set the i2c board info 72 73Example: 74 static struct i2c_board_info board_i2c_ch4[] __initdata = { 75 { 76 I2C_BOARD_INFO(LM3556_NAME, 0x63), 77 .platform_data = &lm3556_pdata, 78 }, 79 }; 80 81and register it in the platform init function 82 83Example: 84 board_register_i2c_bus(4, 400, 85 board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4)); 86