1 Kernel driver for lp5521
2 ========================
4 * National Semiconductor LP5521 led driver chip
5 * Datasheet: http://www.national.com/pf/LP/LP5521.html
7 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
8 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
13 LP5521 can drive up to 3 channels. Leds can be controlled directly via
14 the led class control interface. Channels have generic names:
15 lp5521:channelx, where x is 0 .. 2
17 All three channels can be also controlled using the engine micro programs.
18 More details of the instructions can be found from the public data sheet.
20 LP5521 has the internal program memory for running various LED patterns.
21 There are two ways to run LED patterns.
23 1) Legacy interface - enginex_mode and enginex_load
24 Control interface for the engines:
26 enginex_mode : disabled, load, run
27 enginex_load : store program (visible only in engine load mode)
29 Example (start to blink the channel 2 led):
30 cd /sys/class/leds/lp5521:channel2/device
31 echo "load" > engine3_mode
32 echo "037f4d0003ff6000" > engine3_load
33 echo "run" > engine3_mode
36 echo "disabled" > engine3_mode
38 2) Firmware interface - LP55xx common interface
39 For the details, please refer to 'firmware' section in leds-lp55xx.txt
41 sysfs contains a selftest entry.
42 The test communicates with the chip and checks that
43 the clock mode is automatically set to the requested one.
45 Each channel has its own led current settings.
46 /sys/class/leds/lp5521:channel0/led_current - RW
47 /sys/class/leds/lp5521:channel0/max_current - RO
48 Format: 10x mA i.e 10 means 1.0 mA
50 example platform data:
52 Note: chan_nr can have values between 0 and 2.
53 The name of each channel can be configurable.
54 If the name field is not defined, the default name will be set to 'xxxx:channelN'
55 (XXXX : pdata->label or i2c client name, N : channel number)
57 static struct lp55xx_led_config lp5521_led_config[] = {
76 static int lp5521_setup(void)
78 /* setup HW resources */
81 static void lp5521_release(void)
83 /* Release HW resources */
86 static void lp5521_enable(bool state)
88 /* Control of chip enable signal */
91 static struct lp55xx_platform_data lp5521_platform_data = {
92 .led_config = lp5521_led_config,
93 .num_channels = ARRAY_SIZE(lp5521_led_config),
94 .clock_mode = LP55XX_CLOCK_EXT,
95 .setup_resources = lp5521_setup,
96 .release_resources = lp5521_release,
97 .enable = lp5521_enable,
100 If the current is set to 0 in the platform data, that channel is
101 disabled and it is not visible in the sysfs.