Back to home page

OSCL-LXR

 
 

    


0001 ========================
0002 Kernel driver for lm3556
0003 ========================
0004 
0005 * Texas Instrument:
0006   1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
0007 * Datasheet: http://www.national.com/ds/LM/LM3556.pdf
0008 
0009 Authors:
0010       - Daniel Jeong
0011 
0012         Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
0013 
0014 Description
0015 -----------
0016 There are 3 functions in LM3556, Flash, Torch and Indicator.
0017 
0018 Flash Mode
0019 ^^^^^^^^^^
0020 
0021 In Flash Mode, the LED current source(LED) provides 16 target current levels
0022 from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
0023 CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
0024 or by pulling the STROBE pin HIGH.
0025 
0026 LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file
0027 
0028 * if STROBE pin is enabled, below example control brightness only, and
0029   ON / OFF will be controlled by STROBE pin.
0030 
0031 Flash Example:
0032 
0033 OFF::
0034 
0035         #echo 0 > /sys/class/leds/flash/brightness
0036 
0037 93.75 mA::
0038 
0039         #echo 1 > /sys/class/leds/flash/brightness
0040 
0041 ...
0042 
0043 1500  mA::
0044 
0045         #echo 16 > /sys/class/leds/flash/brightness
0046 
0047 Torch Mode
0048 ^^^^^^^^^^
0049 
0050 In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
0051 REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
0052 hardware TORCH input.
0053 
0054 LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.
0055 * if TORCH pin is enabled, below example control brightness only,
0056 and ON / OFF will be controlled by TORCH pin.
0057 
0058 Torch Example:
0059 
0060 OFF::
0061 
0062         #echo 0 > /sys/class/leds/torch/brightness
0063 
0064 46.88 mA::
0065 
0066         #echo 1 > /sys/class/leds/torch/brightness
0067 
0068 ...
0069 
0070 375 mA::
0071 
0072         #echo 8 > /sys/class/leds/torch/brightness
0073 
0074 Indicator Mode
0075 ^^^^^^^^^^^^^^
0076 
0077 Indicator pattern can be set through /sys/class/leds/indicator/pattern file,
0078 and 4 patterns are pre-defined in indicator_pattern array.
0079 
0080 According to N-lank, Pulse time and N Period values, different pattern wiill
0081 be generated.If you want new patterns for your own device, change
0082 indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
0083 
0084 Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
0085 
0086 Indicator pattern example:
0087 
0088 pattern 0::
0089 
0090         #echo 0 > /sys/class/leds/indicator/pattern
0091 
0092 ...
0093 
0094 pattern 3::
0095 
0096         #echo 3 > /sys/class/leds/indicator/pattern
0097 
0098 Indicator brightness can be controlled through
0099 sys/class/leds/indicator/brightness file.
0100 
0101 Example:
0102 
0103 OFF::
0104 
0105         #echo 0 > /sys/class/leds/indicator/brightness
0106 
0107 5.86 mA::
0108 
0109         #echo 1 > /sys/class/leds/indicator/brightness
0110 
0111 ...
0112 
0113 46.875mA::
0114 
0115         #echo 8 > /sys/class/leds/indicator/brightness
0116 
0117 Notes
0118 -----
0119 Driver expects it is registered using the i2c_board_info mechanism.
0120 To register the chip at address 0x63 on specific adapter, set the platform data
0121 according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
0122 
0123 Example::
0124 
0125         static struct i2c_board_info board_i2c_ch4[] __initdata = {
0126                 {
0127                          I2C_BOARD_INFO(LM3556_NAME, 0x63),
0128                          .platform_data = &lm3556_pdata,
0129                  },
0130         };
0131 
0132 and register it in the platform init function
0133 
0134 Example::
0135 
0136         board_register_i2c_bus(4, 400,
0137                                 board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));