1 ======================== 2 Kernel driver for lp5521 3 ======================== 4 5 * National Semiconductor LP5521 led driver chip 6 * Datasheet: http://www.national.com/pf/LP/LP5521.html 7 8 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo 9 10 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com) 11 12 Description 13 ----------- 14 15 LP5521 can drive up to 3 channels. Leds can be controlled directly via 16 the led class control interface. Channels have generic names: 17 lp5521:channelx, where x is 0 .. 2 18 19 All three channels can be also controlled using the engine micro programs. 20 More details of the instructions can be found from the public data sheet. 21 22 LP5521 has the internal program memory for running various LED patterns. 23 There are two ways to run LED patterns. 24 25 1) Legacy interface - enginex_mode and enginex_load 26 Control interface for the engines: 27 28 x is 1 .. 3 29 30 enginex_mode: 31 disabled, load, run 32 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/device 38 echo "load" > engine3_mode 39 echo "037f4d0003ff6000" > engine3_load 40 echo "run" > engine3_mode 41 42 To stop the engine:: 43 44 echo "disabled" > engine3_mode 45 46 2) Firmware interface - LP55xx common interface 47 48 For the details, please refer to 'firmware' section in leds-lp55xx.txt 49 50 sysfs contains a selftest entry. 51 52 The test communicates with the chip and checks that 53 the clock mode is automatically set to the requested one. 54 55 Each channel has its own led current settings. 56 57 - /sys/class/leds/lp5521:channel0/led_current - RW 58 - /sys/class/leds/lp5521:channel0/max_current - RO 59 60 Format: 10x mA i.e 10 means 1.0 mA 61 62 example 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 107 Note: 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 114 If the current is set to 0 in the platform data, that channel is 115 disabled and it is not visible in the sysfs.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.