Kernel driver for lp5523
========================

* National Semiconductor LP5523 led driver chip
* Datasheet: http://www.national.com/pf/LP/LP5523.html

Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)

Description
-----------
LP5523 can drive up to 9 channels. Leds can be controlled directly via
led class control interface. Channels have a generic names:
lp5523:channelx where x is 0...8

Chip provides 3 engines which can be control channels wihtout main CPU
interaction. Details of the micro engine code can be found from the
public data sheet. Leds can be muxed to different channels.

Control interface for engines:
x is 1 .. 3
enginex_mode : disabled, load, run
enginex_load : microcode load (visible only in load mode)
enginex_leds : led mux control (visible only in load mode)

cd /sys/class/leds/lp5523:channel2/device
echo "load" > engine3_mode
echo "9d80400004ff05ff437f0000" > engine3_load
echo "111111111" > engine3_leds
echo "run" > engine3_mode

sysfs contains also selftest entry. It measures each channel
voltage level and checks if it looks reasonable. Too high
level means missing led and to low value means short circuit.

Example platform data:

static struct lp5523_led_config lp5523_led_config[] = {
        {
                .chan_nr        = 0,
                .led_current    = 50,
        },
...
        }, {
                .chan_nr        = 8,
                .led_current    = 50,
        }
};

static int lp5523_setup(void)
{
	/* Setup HW resources */
}

static void lp5523_release(void)
{
	/* Release HW resources */
}

static void lp5523_enable(bool state)
{
	/* Control chip enable signal */
}

static struct lp5523_platform_data lp5523_platform_data = {
        .led_config     = lp5523_led_config,
        .num_channels   = ARRAY_SIZE(lp5523_led_config),
        .clock_mode     = LP5523_CLOCK_EXT,
        .setup_resources   = lp5523_setup,
        .release_resources = lp5523_release,
        .enable            = lp5523_enable,
};
