Back to home page

OSCL-LXR

 
 

    


0001 ========================
0002 Kernel driver for lp5562
0003 ========================
0004 
0005 * TI LP5562 LED Driver
0006 
0007 Author: Milo(Woogyom) Kim <milo.kim@ti.com>
0008 
0009 Description
0010 ===========
0011 
0012   LP5562 can drive up to 4 channels. R/G/B and White.
0013   LEDs can be controlled directly via the led class control interface.
0014 
0015   All four channels can be also controlled using the engine micro programs.
0016   LP5562 has the internal program memory for running various LED patterns.
0017   For the details, please refer to 'firmware' section in leds-lp55xx.txt
0018 
0019 Device attribute
0020 ================
0021 
0022 engine_mux
0023   3 Engines are allocated in LP5562, but the number of channel is 4.
0024   Therefore each channel should be mapped to the engine number.
0025 
0026   Value: RGB or W
0027 
0028   This attribute is used for programming LED data with the firmware interface.
0029   Unlike the LP5521/LP5523/55231, LP5562 has unique feature for the engine mux,
0030   so additional sysfs is required
0031 
0032   LED Map
0033 
0034   ===== === ===============================
0035   Red   ... Engine 1 (fixed)
0036   Green ... Engine 2 (fixed)
0037   Blue  ... Engine 3 (fixed)
0038   White ... Engine 1 or 2 or 3 (selective)
0039   ===== === ===============================
0040 
0041 How to load the program data using engine_mux
0042 =============================================
0043 
0044   Before loading the LP5562 program data, engine_mux should be written between
0045   the engine selection and loading the firmware.
0046   Engine mux has two different mode, RGB and W.
0047   RGB is used for loading RGB program data, W is used for W program data.
0048 
0049   For example, run blinking green channel pattern::
0050 
0051     echo 2 > /sys/bus/i2c/devices/xxxx/select_engine     # 2 is for green channel
0052     echo "RGB" > /sys/bus/i2c/devices/xxxx/engine_mux    # engine mux for RGB
0053     echo 1 > /sys/class/firmware/lp5562/loading
0054     echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
0055     echo 0 > /sys/class/firmware/lp5562/loading
0056     echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
0057 
0058   To run a blinking white pattern::
0059 
0060     echo 1 or 2 or 3 > /sys/bus/i2c/devices/xxxx/select_engine
0061     echo "W" > /sys/bus/i2c/devices/xxxx/engine_mux
0062     echo 1 > /sys/class/firmware/lp5562/loading
0063     echo "4000600040FF6000" > /sys/class/firmware/lp5562/data
0064     echo 0 > /sys/class/firmware/lp5562/loading
0065     echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
0066 
0067 How to load the predefined patterns
0068 ===================================
0069 
0070   Please refer to 'leds-lp55xx.txt"
0071 
0072 Setting Current of Each Channel
0073 ===============================
0074 
0075   Like LP5521 and LP5523/55231, LP5562 provides LED current settings.
0076   The 'led_current' and 'max_current' are used.
0077 
0078 Example of Platform data
0079 ========================
0080 
0081 ::
0082 
0083         static struct lp55xx_led_config lp5562_led_config[] = {
0084                 {
0085                         .name           = "R",
0086                         .chan_nr        = 0,
0087                         .led_current    = 20,
0088                         .max_current    = 40,
0089                 },
0090                 {
0091                         .name           = "G",
0092                         .chan_nr        = 1,
0093                         .led_current    = 20,
0094                         .max_current    = 40,
0095                 },
0096                 {
0097                         .name           = "B",
0098                         .chan_nr        = 2,
0099                         .led_current    = 20,
0100                         .max_current    = 40,
0101                 },
0102                 {
0103                         .name           = "W",
0104                         .chan_nr        = 3,
0105                         .led_current    = 20,
0106                         .max_current    = 40,
0107                 },
0108         };
0109 
0110         static int lp5562_setup(void)
0111         {
0112                 /* setup HW resources */
0113         }
0114 
0115         static void lp5562_release(void)
0116         {
0117                 /* Release HW resources */
0118         }
0119 
0120         static void lp5562_enable(bool state)
0121         {
0122                 /* Control of chip enable signal */
0123         }
0124 
0125         static struct lp55xx_platform_data lp5562_platform_data = {
0126                 .led_config     = lp5562_led_config,
0127                 .num_channels   = ARRAY_SIZE(lp5562_led_config),
0128                 .setup_resources   = lp5562_setup,
0129                 .release_resources = lp5562_release,
0130                 .enable            = lp5562_enable,
0131         };
0132 
0133 To configure the platform specific data, lp55xx_platform_data structure is used
0134 
0135 
0136 If the current is set to 0 in the platform data, that channel is
0137 disabled and it is not visible in the sysfs.