brintos

brintos / linux-shallow public Read only

0
0
Text · 3.4 KiB · 7d7362a Raw
148 lines · plain
1========================2Kernel driver for lp55233========================4 5* National Semiconductor LP5523 led driver chip6* Datasheet: http://www.national.com/pf/LP/LP5523.html7 8Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo9Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)10 11Description12-----------13LP5523 can drive up to 9 channels. Leds can be controlled directly via14the led class control interface.15The name of each channel is configurable in the platform data - name and label.16There are three options to make the channel name.17 18a) Define the 'name' in the platform data19 20To make specific channel name, then use 'name' platform data.21 22- /sys/class/leds/R1               (name: 'R1')23- /sys/class/leds/B1               (name: 'B1')24 25b) Use the 'label' with no 'name' field26 27For one device name with channel number, then use 'label'.28- /sys/class/leds/RGB:channelN     (label: 'RGB', N: 0 ~ 8)29 30c) Default31 32If both fields are NULL, 'lp5523' is used by default.33- /sys/class/leds/lp5523:channelN  (N: 0 ~ 8)34 35LP5523 has the internal program memory for running various LED patterns.36There are two ways to run LED patterns.37 381) Legacy interface - enginex_mode, enginex_load and enginex_leds39 40  Control interface for the engines:41 42  x is 1 .. 343 44  enginex_mode:45	disabled, load, run46  enginex_load:47	microcode load48  enginex_leds:49	led mux control50 51  ::52 53	cd /sys/class/leds/lp5523:channel2/device54	echo "load" > engine3_mode55	echo "9d80400004ff05ff437f0000" > engine3_load56	echo "111111111" > engine3_leds57	echo "run" > engine3_mode58 59  To stop the engine::60 61	echo "disabled" > engine3_mode62 632) Firmware interface - LP55xx common interface64 65For the details, please refer to 'firmware' section in leds-lp55xx.txt66 67LP5523 has three master faders. If a channel is mapped to one of68the master faders, its output is dimmed based on the value of the master69fader.70 71For example::72 73  echo "123000123" > master_fader_leds74 75creates the following channel-fader mappings::76 77  channel 0,6 to master_fader178  channel 1,7 to master_fader279  channel 2,8 to master_fader380 81Then, to have 25% of the original output on channel 0,6::82 83  echo 64 > master_fader184 85To have 0% of the original output (i.e. no output) channel 1,7::86 87  echo 0 > master_fader288 89To have 100% of the original output (i.e. no dimming) on channel 2,8::90 91  echo 255 > master_fader392 93To clear all master fader controls::94 95  echo "000000000" > master_fader_leds96 97Selftest uses always the current from the platform data.98 99Each channel contains led current settings.100- /sys/class/leds/lp5523:channel2/led_current - RW101- /sys/class/leds/lp5523:channel2/max_current - RO102 103Format: 10x mA i.e 10 means 1.0 mA104 105Example platform data::106 107	static struct lp55xx_led_config lp5523_led_config[] = {108		{109			.name		= "D1",110			.chan_nr        = 0,111			.led_current    = 50,112			.max_current    = 130,113		},114	...115		{116			.chan_nr        = 8,117			.led_current    = 50,118			.max_current    = 130,119		}120	};121 122	static int lp5523_setup(void)123	{124		/* Setup HW resources */125	}126 127	static void lp5523_release(void)128	{129		/* Release HW resources */130	}131 132	static void lp5523_enable(bool state)133	{134		/* Control chip enable signal */135	}136 137	static struct lp55xx_platform_data lp5523_platform_data = {138		.led_config     = lp5523_led_config,139		.num_channels   = ARRAY_SIZE(lp5523_led_config),140		.clock_mode     = LP55XX_CLOCK_EXT,141		.setup_resources   = lp5523_setup,142		.release_resources = lp5523_release,143		.enable            = lp5523_enable,144	};145 146Note147  chan_nr can have values between 0 and 8.148