Back to home page

OSCL-LXR

 
 

    


0001 ========================
0002 Kernel driver for lp5523
0003 ========================
0004 
0005 * National Semiconductor LP5523 led driver chip
0006 * Datasheet: http://www.national.com/pf/LP/LP5523.html
0007 
0008 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
0009 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
0010 
0011 Description
0012 -----------
0013 LP5523 can drive up to 9 channels. Leds can be controlled directly via
0014 the led class control interface.
0015 The name of each channel is configurable in the platform data - name and label.
0016 There are three options to make the channel name.
0017 
0018 a) Define the 'name' in the platform data
0019 
0020 To make specific channel name, then use 'name' platform data.
0021 
0022 - /sys/class/leds/R1               (name: 'R1')
0023 - /sys/class/leds/B1               (name: 'B1')
0024 
0025 b) Use the 'label' with no 'name' field
0026 
0027 For one device name with channel number, then use 'label'.
0028 - /sys/class/leds/RGB:channelN     (label: 'RGB', N: 0 ~ 8)
0029 
0030 c) Default
0031 
0032 If both fields are NULL, 'lp5523' is used by default.
0033 - /sys/class/leds/lp5523:channelN  (N: 0 ~ 8)
0034 
0035 LP5523 has the internal program memory for running various LED patterns.
0036 There are two ways to run LED patterns.
0037 
0038 1) Legacy interface - enginex_mode, enginex_load and enginex_leds
0039 
0040   Control interface for the engines:
0041 
0042   x is 1 .. 3
0043 
0044   enginex_mode:
0045         disabled, load, run
0046   enginex_load:
0047         microcode load
0048   enginex_leds:
0049         led mux control
0050 
0051   ::
0052 
0053         cd /sys/class/leds/lp5523:channel2/device
0054         echo "load" > engine3_mode
0055         echo "9d80400004ff05ff437f0000" > engine3_load
0056         echo "111111111" > engine3_leds
0057         echo "run" > engine3_mode
0058 
0059   To stop the engine::
0060 
0061         echo "disabled" > engine3_mode
0062 
0063 2) Firmware interface - LP55xx common interface
0064 
0065 For the details, please refer to 'firmware' section in leds-lp55xx.txt
0066 
0067 LP5523 has three master faders. If a channel is mapped to one of
0068 the master faders, its output is dimmed based on the value of the master
0069 fader.
0070 
0071 For example::
0072 
0073   echo "123000123" > master_fader_leds
0074 
0075 creates the following channel-fader mappings::
0076 
0077   channel 0,6 to master_fader1
0078   channel 1,7 to master_fader2
0079   channel 2,8 to master_fader3
0080 
0081 Then, to have 25% of the original output on channel 0,6::
0082 
0083   echo 64 > master_fader1
0084 
0085 To have 0% of the original output (i.e. no output) channel 1,7::
0086 
0087   echo 0 > master_fader2
0088 
0089 To have 100% of the original output (i.e. no dimming) on channel 2,8::
0090 
0091   echo 255 > master_fader3
0092 
0093 To clear all master fader controls::
0094 
0095   echo "000000000" > master_fader_leds
0096 
0097 Selftest uses always the current from the platform data.
0098 
0099 Each channel contains led current settings.
0100 - /sys/class/leds/lp5523:channel2/led_current - RW
0101 - /sys/class/leds/lp5523:channel2/max_current - RO
0102 
0103 Format: 10x mA i.e 10 means 1.0 mA
0104 
0105 Example platform data::
0106 
0107         static struct lp55xx_led_config lp5523_led_config[] = {
0108                 {
0109                         .name           = "D1",
0110                         .chan_nr        = 0,
0111                         .led_current    = 50,
0112                         .max_current    = 130,
0113                 },
0114         ...
0115                 {
0116                         .chan_nr        = 8,
0117                         .led_current    = 50,
0118                         .max_current    = 130,
0119                 }
0120         };
0121 
0122         static int lp5523_setup(void)
0123         {
0124                 /* Setup HW resources */
0125         }
0126 
0127         static void lp5523_release(void)
0128         {
0129                 /* Release HW resources */
0130         }
0131 
0132         static void lp5523_enable(bool state)
0133         {
0134                 /* Control chip enable signal */
0135         }
0136 
0137         static struct lp55xx_platform_data lp5523_platform_data = {
0138                 .led_config     = lp5523_led_config,
0139                 .num_channels   = ARRAY_SIZE(lp5523_led_config),
0140                 .clock_mode     = LP55XX_CLOCK_EXT,
0141                 .setup_resources   = lp5523_setup,
0142                 .release_resources = lp5523_release,
0143                 .enable            = lp5523_enable,
0144         };
0145 
0146 Note
0147   chan_nr can have values between 0 and 8.