2010-11-12 05:05:23 +07:00
|
|
|
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
|
2012-08-22 14:32:29 +07:00
|
|
|
the led class control interface.
|
|
|
|
The name of each channel is configurable in the platform data - name and label.
|
|
|
|
There are three options to make the channel name.
|
|
|
|
|
|
|
|
a) Define the 'name' in the platform data
|
|
|
|
To make specific channel name, then use 'name' platform data.
|
|
|
|
/sys/class/leds/R1 (name: 'R1')
|
|
|
|
/sys/class/leds/B1 (name: 'B1')
|
|
|
|
|
|
|
|
b) Use the 'label' with no 'name' field
|
|
|
|
For one device name with channel number, then use 'label'.
|
|
|
|
/sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8)
|
|
|
|
|
|
|
|
c) Default
|
|
|
|
If both fields are NULL, 'lp5523' is used by default.
|
|
|
|
/sys/class/leds/lp5523:channelN (N: 0 ~ 8)
|
2010-11-12 05:05:23 +07:00
|
|
|
|
2013-02-05 18:22:48 +07:00
|
|
|
LP5523 has the internal program memory for running various LED patterns.
|
|
|
|
For the details, please refer to 'firmware' section in leds-lp55xx.txt
|
2010-11-12 05:05:23 +07:00
|
|
|
|
|
|
|
Selftest uses always the current from the platform data.
|
|
|
|
|
|
|
|
Each channel contains led current settings.
|
|
|
|
/sys/class/leds/lp5523:channel2/led_current - RW
|
|
|
|
/sys/class/leds/lp5523:channel2/max_current - RO
|
|
|
|
Format: 10x mA i.e 10 means 1.0 mA
|
|
|
|
|
|
|
|
Example platform data:
|
|
|
|
|
|
|
|
Note - chan_nr can have values between 0 and 8.
|
|
|
|
|
2013-02-05 18:22:48 +07:00
|
|
|
static struct lp55xx_led_config lp5523_led_config[] = {
|
2010-11-12 05:05:23 +07:00
|
|
|
{
|
2012-08-22 14:32:29 +07:00
|
|
|
.name = "D1",
|
2010-11-12 05:05:23 +07:00
|
|
|
.chan_nr = 0,
|
|
|
|
.led_current = 50,
|
|
|
|
.max_current = 130,
|
|
|
|
},
|
|
|
|
...
|
2012-08-22 14:32:29 +07:00
|
|
|
{
|
2010-11-12 05:05:23 +07:00
|
|
|
.chan_nr = 8,
|
|
|
|
.led_current = 50,
|
|
|
|
.max_current = 130,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
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 */
|
|
|
|
}
|
|
|
|
|
2013-02-05 18:22:48 +07:00
|
|
|
static struct lp55xx_platform_data lp5523_platform_data = {
|
2010-11-12 05:05:23 +07:00
|
|
|
.led_config = lp5523_led_config,
|
|
|
|
.num_channels = ARRAY_SIZE(lp5523_led_config),
|
2013-02-05 18:22:48 +07:00
|
|
|
.clock_mode = LP55XX_CLOCK_EXT,
|
2010-11-12 05:05:23 +07:00
|
|
|
.setup_resources = lp5523_setup,
|
|
|
|
.release_resources = lp5523_release,
|
|
|
|
.enable = lp5523_enable,
|
|
|
|
};
|