blob: 32e3983473ba472388cf086a5e9a4ff36f7dc138 [file] [log] [blame]
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -03001========================
G.Shark Jeong32abb4782012-06-22 08:12:06 +08002Kernel driver for lm3556
3========================
4
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -03005* Texas Instrument:
6 1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
G.Shark Jeong32abb4782012-06-22 08:12:06 +08007* Datasheet: http://www.national.com/ds/LM/LM3556.pdf
8
9Authors:
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030010 - Daniel Jeong
11
G.Shark Jeong32abb4782012-06-22 08:12:06 +080012 Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
13
14Description
15-----------
16There are 3 functions in LM3556, Flash, Torch and Indicator.
17
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030018Flash Mode
19^^^^^^^^^^
20
G.Shark Jeong32abb4782012-06-22 08:12:06 +080021In Flash Mode, the LED current source(LED) provides 16 target current levels
22from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
23CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
24or by pulling the STROBE pin HIGH.
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030025
Mark O'Donovanabb9c072021-03-28 16:28:37 +010026LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030027
G.Shark Jeong32abb4782012-06-22 08:12:06 +080028* if STROBE pin is enabled, below example control brightness only, and
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030029 ON / OFF will be controlled by STROBE pin.
G.Shark Jeong32abb4782012-06-22 08:12:06 +080030
31Flash Example:
G.Shark Jeong32abb4782012-06-22 08:12:06 +080032
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030033OFF::
34
Mark O'Donovanabb9c072021-03-28 16:28:37 +010035 #echo 0 > /sys/class/leds/flash/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030036
3793.75 mA::
38
Mark O'Donovanabb9c072021-03-28 16:28:37 +010039 #echo 1 > /sys/class/leds/flash/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030040
41...
42
431500 mA::
44
Mark O'Donovanabb9c072021-03-28 16:28:37 +010045 #echo 16 > /sys/class/leds/flash/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030046
47Torch Mode
48^^^^^^^^^^
49
G.Shark Jeong32abb4782012-06-22 08:12:06 +080050In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
51REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
52hardware TORCH input.
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030053
Mark O'Donovanabb9c072021-03-28 16:28:37 +010054LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.
G.Shark Jeong32abb4782012-06-22 08:12:06 +080055* if TORCH pin is enabled, below example control brightness only,
56and ON / OFF will be controlled by TORCH pin.
57
58Torch Example:
G.Shark Jeong32abb4782012-06-22 08:12:06 +080059
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030060OFF::
61
Mark O'Donovanabb9c072021-03-28 16:28:37 +010062 #echo 0 > /sys/class/leds/torch/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030063
6446.88 mA::
65
Mark O'Donovanabb9c072021-03-28 16:28:37 +010066 #echo 1 > /sys/class/leds/torch/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030067
68...
69
70375 mA::
71
Mark O'Donovanabb9c072021-03-28 16:28:37 +010072 #echo 8 > /sys/class/leds/torch/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030073
74Indicator Mode
75^^^^^^^^^^^^^^
76
Mark O'Donovanabb9c072021-03-28 16:28:37 +010077Indicator pattern can be set through /sys/class/leds/indicator/pattern file,
G.Shark Jeong32abb4782012-06-22 08:12:06 +080078and 4 patterns are pre-defined in indicator_pattern array.
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030079
G.Shark Jeong32abb4782012-06-22 08:12:06 +080080According to N-lank, Pulse time and N Period values, different pattern wiill
81be generated.If you want new patterns for your own device, change
82indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030083
G.Shark Jeong32abb4782012-06-22 08:12:06 +080084Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
85
86Indicator pattern example:
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030087
88pattern 0::
89
Mark O'Donovanabb9c072021-03-28 16:28:37 +010090 #echo 0 > /sys/class/leds/indicator/pattern
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -030091
92...
93
94pattern 3::
95
Mark O'Donovanabb9c072021-03-28 16:28:37 +010096 #echo 3 > /sys/class/leds/indicator/pattern
G.Shark Jeong32abb4782012-06-22 08:12:06 +080097
98Indicator brightness can be controlled through
99sys/class/leds/indicator/brightness file.
100
101Example:
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -0300102
103OFF::
104
Mark O'Donovanabb9c072021-03-28 16:28:37 +0100105 #echo 0 > /sys/class/leds/indicator/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -0300106
1075.86 mA::
108
Mark O'Donovanabb9c072021-03-28 16:28:37 +0100109 #echo 1 > /sys/class/leds/indicator/brightness
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -0300110
111...
112
11346.875mA::
114
Mark O'Donovanabb9c072021-03-28 16:28:37 +0100115 #echo 8 > /sys/class/leds/indicator/brightness
G.Shark Jeong32abb4782012-06-22 08:12:06 +0800116
117Notes
118-----
119Driver expects it is registered using the i2c_board_info mechanism.
120To register the chip at address 0x63 on specific adapter, set the platform data
121according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
122
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -0300123Example::
124
Sachin Kamateb967b62013-08-09 09:19:33 -0700125 static struct i2c_board_info board_i2c_ch4[] __initdata = {
G.Shark Jeong32abb4782012-06-22 08:12:06 +0800126 {
127 I2C_BOARD_INFO(LM3556_NAME, 0x63),
128 .platform_data = &lm3556_pdata,
129 },
130 };
131
132and register it in the platform init function
133
Mauro Carvalho Chehab8dab9192019-06-28 09:20:20 -0300134Example::
135
G.Shark Jeong32abb4782012-06-22 08:12:06 +0800136 board_register_i2c_bus(4, 400,
137 board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));