Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * LP55XX Platform Data Header
0004  *
0005  * Copyright (C) 2012 Texas Instruments
0006  *
0007  * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
0008  *
0009  * Derived from leds-lp5521.h, leds-lp5523.h
0010  */
0011 
0012 #ifndef _LEDS_LP55XX_H
0013 #define _LEDS_LP55XX_H
0014 
0015 #include <linux/gpio/consumer.h>
0016 #include <linux/led-class-multicolor.h>
0017 
0018 /* Clock configuration */
0019 #define LP55XX_CLOCK_AUTO   0
0020 #define LP55XX_CLOCK_INT    1
0021 #define LP55XX_CLOCK_EXT    2
0022 
0023 #define LP55XX_MAX_GROUPED_CHAN 4
0024 
0025 struct lp55xx_led_config {
0026     const char *name;
0027     const char *default_trigger;
0028     u8 chan_nr;
0029     u8 led_current; /* mA x10, 0 if led is not connected */
0030     u8 max_current;
0031     int num_colors;
0032     unsigned int max_channel;
0033     int color_id[LED_COLOR_ID_MAX];
0034     int output_num[LED_COLOR_ID_MAX];
0035 };
0036 
0037 struct lp55xx_predef_pattern {
0038     const u8 *r;
0039     const u8 *g;
0040     const u8 *b;
0041     u8 size_r;
0042     u8 size_g;
0043     u8 size_b;
0044 };
0045 
0046 enum lp8501_pwr_sel {
0047     LP8501_ALL_VDD,     /* D1~9 are connected to VDD */
0048     LP8501_6VDD_3VOUT,  /* D1~6 with VDD, D7~9 with VOUT */
0049     LP8501_3VDD_6VOUT,  /* D1~6 with VOUT, D7~9 with VDD */
0050     LP8501_ALL_VOUT,    /* D1~9 are connected to VOUT */
0051 };
0052 
0053 /*
0054  * struct lp55xx_platform_data
0055  * @led_config        : Configurable led class device
0056  * @num_channels      : Number of LED channels
0057  * @label             : Used for naming LEDs
0058  * @clock_mode        : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
0059  * @setup_resources   : Platform specific function before enabling the chip
0060  * @release_resources : Platform specific function after  disabling the chip
0061  * @enable_gpiod      : enable GPIO descriptor
0062  * @patterns          : Predefined pattern data for RGB channels
0063  * @num_patterns      : Number of patterns
0064  * @update_config     : Value of CONFIG register
0065  */
0066 struct lp55xx_platform_data {
0067 
0068     /* LED channel configuration */
0069     struct lp55xx_led_config *led_config;
0070     u8 num_channels;
0071     const char *label;
0072 
0073     /* Clock configuration */
0074     u8 clock_mode;
0075 
0076     /* optional enable GPIO */
0077     struct gpio_desc *enable_gpiod;
0078 
0079     /* Predefined pattern data */
0080     struct lp55xx_predef_pattern *patterns;
0081     unsigned int num_patterns;
0082 
0083     /* LP8501 specific */
0084     enum lp8501_pwr_sel pwr_sel;
0085 };
0086 
0087 #endif /* _LEDS_LP55XX_H */