• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * LP55XX Platform Data Header
4  *
5  * Copyright (C) 2012 Texas Instruments
6  *
7  * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
8  *
9  * Derived from leds-lp5521.h, leds-lp5523.h
10  */
11 
12 #ifndef _LEDS_LP55XX_H
13 #define _LEDS_LP55XX_H
14 
15 #include <linux/gpio/consumer.h>
16 #include <linux/led-class-multicolor.h>
17 
18 /* Clock configuration */
19 #define LP55XX_CLOCK_AUTO	0
20 #define LP55XX_CLOCK_INT	1
21 #define LP55XX_CLOCK_EXT	2
22 
23 #define LP55XX_MAX_GROUPED_CHAN	4
24 
25 struct lp55xx_led_config {
26 	const char *name;
27 	const char *default_trigger;
28 	u8 chan_nr;
29 	u8 led_current; /* mA x10, 0 if led is not connected */
30 	u8 max_current;
31 	int num_colors;
32 	unsigned int max_channel;
33 	int color_id[LED_COLOR_ID_MAX];
34 	int output_num[LED_COLOR_ID_MAX];
35 };
36 
37 struct lp55xx_predef_pattern {
38 	const u8 *r;
39 	const u8 *g;
40 	const u8 *b;
41 	u8 size_r;
42 	u8 size_g;
43 	u8 size_b;
44 };
45 
46 enum lp8501_pwr_sel {
47 	LP8501_ALL_VDD,		/* D1~9 are connected to VDD */
48 	LP8501_6VDD_3VOUT,	/* D1~6 with VDD, D7~9 with VOUT */
49 	LP8501_3VDD_6VOUT,	/* D1~6 with VOUT, D7~9 with VDD */
50 	LP8501_ALL_VOUT,	/* D1~9 are connected to VOUT */
51 };
52 
53 /*
54  * struct lp55xx_platform_data
55  * @led_config        : Configurable led class device
56  * @num_channels      : Number of LED channels
57  * @label             : Used for naming LEDs
58  * @clock_mode        : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
59  * @setup_resources   : Platform specific function before enabling the chip
60  * @release_resources : Platform specific function after  disabling the chip
61  * @enable_gpiod      : enable GPIO descriptor
62  * @patterns          : Predefined pattern data for RGB channels
63  * @num_patterns      : Number of patterns
64  * @update_config     : Value of CONFIG register
65  */
66 struct lp55xx_platform_data {
67 
68 	/* LED channel configuration */
69 	struct lp55xx_led_config *led_config;
70 	u8 num_channels;
71 	const char *label;
72 
73 	/* Clock configuration */
74 	u8 clock_mode;
75 
76 	/* optional enable GPIO */
77 	struct gpio_desc *enable_gpiod;
78 
79 	/* Predefined pattern data */
80 	struct lp55xx_predef_pattern *patterns;
81 	unsigned int num_patterns;
82 
83 	/* LP8501 specific */
84 	enum lp8501_pwr_sel pwr_sel;
85 };
86 
87 #endif /* _LEDS_LP55XX_H */
88