2019-06-28 20:20:20 +08:00
|
|
|
========================
|
2012-06-22 08:12:06 +08:00
|
|
|
Kernel driver for lm3556
|
|
|
|
========================
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
* Texas Instrument:
|
|
|
|
1.5 A Synchronous Boost LED Flash Driver w/ High-Side Current Source
|
2012-06-22 08:12:06 +08:00
|
|
|
* Datasheet: http://www.national.com/ds/LM/LM3556.pdf
|
|
|
|
|
|
|
|
Authors:
|
2019-06-28 20:20:20 +08:00
|
|
|
- Daniel Jeong
|
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
Contact:Daniel Jeong(daniel.jeong-at-ti.com, gshark.jeong-at-gmail.com)
|
|
|
|
|
|
|
|
Description
|
|
|
|
-----------
|
|
|
|
There are 3 functions in LM3556, Flash, Torch and Indicator.
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
Flash Mode
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
In Flash Mode, the LED current source(LED) provides 16 target current levels
|
|
|
|
from 93.75 mA to 1500 mA.The Flash currents are adjusted via the CURRENT
|
|
|
|
CONTROL REGISTER(0x09).Flash mode is activated by the ENABLE REGISTER(0x0A),
|
|
|
|
or by pulling the STROBE pin HIGH.
|
2019-06-28 20:20:20 +08:00
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
LM3556 Flash can be controlled through /sys/class/leds/flash/brightness file
|
2019-06-28 20:20:20 +08:00
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
* if STROBE pin is enabled, below example control brightness only, and
|
2019-06-28 20:20:20 +08:00
|
|
|
ON / OFF will be controlled by STROBE pin.
|
2012-06-22 08:12:06 +08:00
|
|
|
|
|
|
|
Flash Example:
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
OFF::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 0 > /sys/class/leds/flash/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
93.75 mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 1 > /sys/class/leds/flash/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
1500 mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 16 > /sys/class/leds/flash/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
Torch Mode
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
In Torch Mode, the current source(LED) is programmed via the CURRENT CONTROL
|
|
|
|
REGISTER(0x09).Torch Mode is activated by the ENABLE REGISTER(0x0A) or by the
|
|
|
|
hardware TORCH input.
|
2019-06-28 20:20:20 +08:00
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
LM3556 torch can be controlled through /sys/class/leds/torch/brightness file.
|
2012-06-22 08:12:06 +08:00
|
|
|
* if TORCH pin is enabled, below example control brightness only,
|
|
|
|
and ON / OFF will be controlled by TORCH pin.
|
|
|
|
|
|
|
|
Torch Example:
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
OFF::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 0 > /sys/class/leds/torch/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
46.88 mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 1 > /sys/class/leds/torch/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
375 mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 8 > /sys/class/leds/torch/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
Indicator Mode
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
Indicator pattern can be set through /sys/class/leds/indicator/pattern file,
|
2012-06-22 08:12:06 +08:00
|
|
|
and 4 patterns are pre-defined in indicator_pattern array.
|
2019-06-28 20:20:20 +08:00
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
According to N-lank, Pulse time and N Period values, different pattern wiill
|
|
|
|
be generated.If you want new patterns for your own device, change
|
|
|
|
indicator_pattern array with your own values and INDIC_PATTERN_SIZE.
|
2019-06-28 20:20:20 +08:00
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
Please refer datasheet for more detail about N-Blank, Pulse time and N Period.
|
|
|
|
|
|
|
|
Indicator pattern example:
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
pattern 0::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 0 > /sys/class/leds/indicator/pattern
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
pattern 3::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 3 > /sys/class/leds/indicator/pattern
|
2012-06-22 08:12:06 +08:00
|
|
|
|
|
|
|
Indicator brightness can be controlled through
|
|
|
|
sys/class/leds/indicator/brightness file.
|
|
|
|
|
|
|
|
Example:
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
OFF::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 0 > /sys/class/leds/indicator/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
5.86 mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 1 > /sys/class/leds/indicator/brightness
|
2019-06-28 20:20:20 +08:00
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
46.875mA::
|
|
|
|
|
2021-03-28 23:28:37 +08:00
|
|
|
#echo 8 > /sys/class/leds/indicator/brightness
|
2012-06-22 08:12:06 +08:00
|
|
|
|
|
|
|
Notes
|
|
|
|
-----
|
|
|
|
Driver expects it is registered using the i2c_board_info mechanism.
|
|
|
|
To register the chip at address 0x63 on specific adapter, set the platform data
|
|
|
|
according to include/linux/platform_data/leds-lm3556.h, set the i2c board info
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
Example::
|
|
|
|
|
2013-08-10 00:19:33 +08:00
|
|
|
static struct i2c_board_info board_i2c_ch4[] __initdata = {
|
2012-06-22 08:12:06 +08:00
|
|
|
{
|
|
|
|
I2C_BOARD_INFO(LM3556_NAME, 0x63),
|
|
|
|
.platform_data = &lm3556_pdata,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
and register it in the platform init function
|
|
|
|
|
2019-06-28 20:20:20 +08:00
|
|
|
Example::
|
|
|
|
|
2012-06-22 08:12:06 +08:00
|
|
|
board_register_i2c_bus(4, 400,
|
|
|
|
board_i2c_ch4, ARRAY_SIZE(board_i2c_ch4));
|