1 ======================== 1 ======================== 2 Kernel driver for lp5523 2 Kernel driver for lp5523 3 ======================== 3 ======================== 4 4 5 * National Semiconductor LP5523 led driver chi 5 * National Semiconductor LP5523 led driver chip 6 * Datasheet: http://www.national.com/pf/LP/LP5 6 * Datasheet: http://www.national.com/pf/LP/LP5523.html 7 7 8 Authors: Mathias Nyman, Yuri Zaporozhets, Samu 8 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo 9 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.c 9 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com) 10 10 11 Description 11 Description 12 ----------- 12 ----------- 13 LP5523 can drive up to 9 channels. Leds can be 13 LP5523 can drive up to 9 channels. Leds can be controlled directly via 14 the led class control interface. 14 the led class control interface. 15 The name of each channel is configurable in th 15 The name of each channel is configurable in the platform data - name and label. 16 There are three options to make the channel na 16 There are three options to make the channel name. 17 17 18 a) Define the 'name' in the platform data 18 a) Define the 'name' in the platform data 19 19 20 To make specific channel name, then use 'name' 20 To make specific channel name, then use 'name' platform data. 21 21 22 - /sys/class/leds/R1 (name: 'R1' 22 - /sys/class/leds/R1 (name: 'R1') 23 - /sys/class/leds/B1 (name: 'B1' 23 - /sys/class/leds/B1 (name: 'B1') 24 24 25 b) Use the 'label' with no 'name' field 25 b) Use the 'label' with no 'name' field 26 26 27 For one device name with channel number, then 27 For one device name with channel number, then use 'label'. 28 - /sys/class/leds/RGB:channelN (label: 'RG 28 - /sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8) 29 29 30 c) Default 30 c) Default 31 31 32 If both fields are NULL, 'lp5523' is used by d 32 If both fields are NULL, 'lp5523' is used by default. 33 - /sys/class/leds/lp5523:channelN (N: 0 ~ 8) 33 - /sys/class/leds/lp5523:channelN (N: 0 ~ 8) 34 34 35 LP5523 has the internal program memory for run 35 LP5523 has the internal program memory for running various LED patterns. 36 There are two ways to run LED patterns. 36 There are two ways to run LED patterns. 37 37 38 1) Legacy interface - enginex_mode, enginex_lo 38 1) Legacy interface - enginex_mode, enginex_load and enginex_leds 39 39 40 Control interface for the engines: 40 Control interface for the engines: 41 41 42 x is 1 .. 3 42 x is 1 .. 3 43 43 44 enginex_mode: 44 enginex_mode: 45 disabled, load, run 45 disabled, load, run 46 enginex_load: 46 enginex_load: 47 microcode load 47 microcode load 48 enginex_leds: 48 enginex_leds: 49 led mux control 49 led mux control 50 50 51 :: 51 :: 52 52 53 cd /sys/class/leds/lp5523:channel2/dev 53 cd /sys/class/leds/lp5523:channel2/device 54 echo "load" > engine3_mode 54 echo "load" > engine3_mode 55 echo "9d80400004ff05ff437f0000" > engi 55 echo "9d80400004ff05ff437f0000" > engine3_load 56 echo "111111111" > engine3_leds 56 echo "111111111" > engine3_leds 57 echo "run" > engine3_mode 57 echo "run" > engine3_mode 58 58 59 To stop the engine:: 59 To stop the engine:: 60 60 61 echo "disabled" > engine3_mode 61 echo "disabled" > engine3_mode 62 62 63 2) Firmware interface - LP55xx common interfac 63 2) Firmware interface - LP55xx common interface 64 64 65 For the details, please refer to 'firmware' se 65 For the details, please refer to 'firmware' section in leds-lp55xx.txt 66 66 67 LP5523 has three master faders. If a channel i 67 LP5523 has three master faders. If a channel is mapped to one of 68 the master faders, its output is dimmed based 68 the master faders, its output is dimmed based on the value of the master 69 fader. 69 fader. 70 70 71 For example:: 71 For example:: 72 72 73 echo "123000123" > master_fader_leds 73 echo "123000123" > master_fader_leds 74 74 75 creates the following channel-fader mappings:: 75 creates the following channel-fader mappings:: 76 76 77 channel 0,6 to master_fader1 77 channel 0,6 to master_fader1 78 channel 1,7 to master_fader2 78 channel 1,7 to master_fader2 79 channel 2,8 to master_fader3 79 channel 2,8 to master_fader3 80 80 81 Then, to have 25% of the original output on ch 81 Then, to have 25% of the original output on channel 0,6:: 82 82 83 echo 64 > master_fader1 83 echo 64 > master_fader1 84 84 85 To have 0% of the original output (i.e. no out 85 To have 0% of the original output (i.e. no output) channel 1,7:: 86 86 87 echo 0 > master_fader2 87 echo 0 > master_fader2 88 88 89 To have 100% of the original output (i.e. no d 89 To have 100% of the original output (i.e. no dimming) on channel 2,8:: 90 90 91 echo 255 > master_fader3 91 echo 255 > master_fader3 92 92 93 To clear all master fader controls:: 93 To clear all master fader controls:: 94 94 95 echo "000000000" > master_fader_leds 95 echo "000000000" > master_fader_leds 96 96 97 Selftest uses always the current from the plat 97 Selftest uses always the current from the platform data. 98 98 99 Each channel contains led current settings. 99 Each channel contains led current settings. 100 - /sys/class/leds/lp5523:channel2/led_current 100 - /sys/class/leds/lp5523:channel2/led_current - RW 101 - /sys/class/leds/lp5523:channel2/max_current 101 - /sys/class/leds/lp5523:channel2/max_current - RO 102 102 103 Format: 10x mA i.e 10 means 1.0 mA 103 Format: 10x mA i.e 10 means 1.0 mA 104 104 105 Example platform data:: 105 Example platform data:: 106 106 107 static struct lp55xx_led_config lp5523 107 static struct lp55xx_led_config lp5523_led_config[] = { 108 { 108 { 109 .name = "D1" 109 .name = "D1", 110 .chan_nr = 0, 110 .chan_nr = 0, 111 .led_current = 50, 111 .led_current = 50, 112 .max_current = 130, 112 .max_current = 130, 113 }, 113 }, 114 ... 114 ... 115 { 115 { 116 .chan_nr = 8, 116 .chan_nr = 8, 117 .led_current = 50, 117 .led_current = 50, 118 .max_current = 130, 118 .max_current = 130, 119 } 119 } 120 }; 120 }; 121 121 122 static int lp5523_setup(void) 122 static int lp5523_setup(void) 123 { 123 { 124 /* Setup HW resources */ 124 /* Setup HW resources */ 125 } 125 } 126 126 127 static void lp5523_release(void) 127 static void lp5523_release(void) 128 { 128 { 129 /* Release HW resources */ 129 /* Release HW resources */ 130 } 130 } 131 131 132 static void lp5523_enable(bool state) 132 static void lp5523_enable(bool state) 133 { 133 { 134 /* Control chip enable signal 134 /* Control chip enable signal */ 135 } 135 } 136 136 137 static struct lp55xx_platform_data lp5 137 static struct lp55xx_platform_data lp5523_platform_data = { 138 .led_config = lp5523_led_c 138 .led_config = lp5523_led_config, 139 .num_channels = ARRAY_SIZE(l 139 .num_channels = ARRAY_SIZE(lp5523_led_config), 140 .clock_mode = LP55XX_CLOCK 140 .clock_mode = LP55XX_CLOCK_EXT, 141 .setup_resources = lp5523_se 141 .setup_resources = lp5523_setup, 142 .release_resources = lp5523_re 142 .release_resources = lp5523_release, 143 .enable = lp5523_en 143 .enable = lp5523_enable, 144 }; 144 }; 145 145 146 Note 146 Note 147 chan_nr can have values between 0 and 8. 147 chan_nr can have values between 0 and 8.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.