116 lines · plain
1========================2Kernel driver for lp55213========================4 5* National Semiconductor LP5521 led driver chip6* Datasheet: http://www.national.com/pf/LP/LP5521.html7 8Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo9 10Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)11 12Description13-----------14 15LP5521 can drive up to 3 channels. Leds can be controlled directly via16the led class control interface. Channels have generic names:17lp5521:channelx, where x is 0 .. 218 19All three channels can be also controlled using the engine micro programs.20More details of the instructions can be found from the public data sheet.21 22LP5521 has the internal program memory for running various LED patterns.23There are two ways to run LED patterns.24 251) Legacy interface - enginex_mode and enginex_load26 Control interface for the engines:27 28 x is 1 .. 329 30 enginex_mode:31 disabled, load, run32 enginex_load:33 store program (visible only in engine load mode)34 35 Example (start to blink the channel 2 led)::36 37 cd /sys/class/leds/lp5521:channel2/device38 echo "load" > engine3_mode39 echo "037f4d0003ff6000" > engine3_load40 echo "run" > engine3_mode41 42 To stop the engine::43 44 echo "disabled" > engine3_mode45 462) Firmware interface - LP55xx common interface47 48For the details, please refer to 'firmware' section in leds-lp55xx.txt49 50sysfs contains a selftest entry.51 52The test communicates with the chip and checks that53the clock mode is automatically set to the requested one.54 55Each channel has its own led current settings.56 57- /sys/class/leds/lp5521:channel0/led_current - RW58- /sys/class/leds/lp5521:channel0/max_current - RO59 60Format: 10x mA i.e 10 means 1.0 mA61 62example platform data::63 64 static struct lp55xx_led_config lp5521_led_config[] = {65 {66 .name = "red",67 .chan_nr = 0,68 .led_current = 50,69 .max_current = 130,70 }, {71 .name = "green",72 .chan_nr = 1,73 .led_current = 0,74 .max_current = 130,75 }, {76 .name = "blue",77 .chan_nr = 2,78 .led_current = 0,79 .max_current = 130,80 }81 };82 83 static int lp5521_setup(void)84 {85 /* setup HW resources */86 }87 88 static void lp5521_release(void)89 {90 /* Release HW resources */91 }92 93 static void lp5521_enable(bool state)94 {95 /* Control of chip enable signal */96 }97 98 static struct lp55xx_platform_data lp5521_platform_data = {99 .led_config = lp5521_led_config,100 .num_channels = ARRAY_SIZE(lp5521_led_config),101 .clock_mode = LP55XX_CLOCK_EXT,102 .setup_resources = lp5521_setup,103 .release_resources = lp5521_release,104 .enable = lp5521_enable,105 };106 107Note:108 chan_nr can have values between 0 and 2.109 The name of each channel can be configurable.110 If the name field is not defined, the default name will be set to 'xxxx:channelN'111 (XXXX : pdata->label or i2c client name, N : channel number)112 113 114If the current is set to 0 in the platform data, that channel is115disabled and it is not visible in the sysfs.116