aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/leds-lp5521.h73
-rw-r--r--include/linux/leds-lp5523.h49
-rw-r--r--include/linux/leds_pwm.h2
-rw-r--r--include/linux/platform_data/leds-lp55xx.h87
-rw-r--r--include/linux/pwm.h20
5 files changed, 106 insertions, 125 deletions
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
deleted file mode 100644
index 3f071ec019b2..000000000000
--- a/include/linux/leds-lp5521.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * LP5521 LED chip driver.
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5521_H
24#define __LINUX_LP5521_H
25
26/* See Documentation/leds/leds-lp5521.txt */
27
28struct lp5521_led_config {
29 char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35struct lp5521_led_pattern {
36 u8 *r;
37 u8 *g;
38 u8 *b;
39 u8 size_r;
40 u8 size_g;
41 u8 size_b;
42};
43
44#define LP5521_CLOCK_AUTO 0
45#define LP5521_CLOCK_INT 1
46#define LP5521_CLOCK_EXT 2
47
48/* Bits in CONFIG register */
49#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
50#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
51#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
52#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
53#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
54#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
55#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
56#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
57#define LP5521_CLK_INT 1 /* Internal clock */
58#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
59
60struct lp5521_platform_data {
61 struct lp5521_led_config *led_config;
62 u8 num_channels;
63 u8 clock_mode;
64 int (*setup_resources)(void);
65 void (*release_resources)(void);
66 void (*enable)(bool state);
67 const char *label;
68 u8 update_config;
69 struct lp5521_led_pattern *patterns;
70 int num_patterns;
71};
72
73#endif /* __LINUX_LP5521_H */
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
deleted file mode 100644
index 727877fb406d..000000000000
--- a/include/linux/leds-lp5523.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * LP5523 LED Driver
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef __LINUX_LP5523_H
24#define __LINUX_LP5523_H
25
26/* See Documentation/leds/leds-lp5523.txt */
27
28struct lp5523_led_config {
29 const char *name;
30 u8 chan_nr;
31 u8 led_current; /* mA x10, 0 if led is not connected */
32 u8 max_current;
33};
34
35#define LP5523_CLOCK_AUTO 0
36#define LP5523_CLOCK_INT 1
37#define LP5523_CLOCK_EXT 2
38
39struct lp5523_platform_data {
40 struct lp5523_led_config *led_config;
41 u8 num_channels;
42 u8 clock_mode;
43 int (*setup_resources)(void);
44 void (*release_resources)(void);
45 void (*enable)(bool state);
46 const char *label;
47};
48
49#endif /* __LINUX_LP5523_H */
diff --git a/include/linux/leds_pwm.h b/include/linux/leds_pwm.h
index 33a071167489..a65e9646e4b1 100644
--- a/include/linux/leds_pwm.h
+++ b/include/linux/leds_pwm.h
@@ -7,7 +7,7 @@
7struct led_pwm { 7struct led_pwm {
8 const char *name; 8 const char *name;
9 const char *default_trigger; 9 const char *default_trigger;
10 unsigned pwm_id; 10 unsigned pwm_id __deprecated;
11 u8 active_low; 11 u8 active_low;
12 unsigned max_brightness; 12 unsigned max_brightness;
13 unsigned pwm_period_ns; 13 unsigned pwm_period_ns;
diff --git a/include/linux/platform_data/leds-lp55xx.h b/include/linux/platform_data/leds-lp55xx.h
new file mode 100644
index 000000000000..1509570d5a3f
--- /dev/null
+++ b/include/linux/platform_data/leds-lp55xx.h
@@ -0,0 +1,87 @@
1/*
2 * LP55XX Platform Data Header
3 *
4 * Copyright (C) 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * Derived from leds-lp5521.h, leds-lp5523.h
13 */
14
15#ifndef _LEDS_LP55XX_H
16#define _LEDS_LP55XX_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/* Bits in LP5521 CONFIG register. 'update_config' in lp55xx_platform_data */
24#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
25#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
26#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
27#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
28#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
29#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
30#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
31#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
32#define LP5521_CLK_INT 1 /* Internal clock */
33#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
34
35struct lp55xx_led_config {
36 const char *name;
37 u8 chan_nr;
38 u8 led_current; /* mA x10, 0 if led is not connected */
39 u8 max_current;
40};
41
42struct lp55xx_predef_pattern {
43 u8 *r;
44 u8 *g;
45 u8 *b;
46 u8 size_r;
47 u8 size_g;
48 u8 size_b;
49};
50
51/*
52 * struct lp55xx_platform_data
53 * @led_config : Configurable led class device
54 * @num_channels : Number of LED channels
55 * @label : Used for naming LEDs
56 * @clock_mode : Input clock mode. LP55XX_CLOCK_AUTO or _INT or _EXT
57 * @setup_resources : Platform specific function before enabling the chip
58 * @release_resources : Platform specific function after disabling the chip
59 * @enable : EN pin control by platform side
60 * @patterns : Predefined pattern data for RGB channels
61 * @num_patterns : Number of patterns
62 * @update_config : Value of CONFIG register
63 */
64struct lp55xx_platform_data {
65
66 /* LED channel configuration */
67 struct lp55xx_led_config *led_config;
68 u8 num_channels;
69 const char *label;
70
71 /* Clock configuration */
72 u8 clock_mode;
73
74 /* Platform specific functions */
75 int (*setup_resources)(void);
76 void (*release_resources)(void);
77 void (*enable)(bool state);
78
79 /* Predefined pattern data */
80 struct lp55xx_predef_pattern *patterns;
81 unsigned int num_patterns;
82
83 /* _CONFIG register */
84 u8 update_config;
85};
86
87#endif /* _LEDS_LP55XX_H */
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 6d661f32e0e4..70655a205b74 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -174,10 +174,13 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc, 174struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
175 const struct of_phandle_args *args); 175 const struct of_phandle_args *args);
176 176
177struct pwm_device *pwm_get(struct device *dev, const char *consumer); 177struct pwm_device *pwm_get(struct device *dev, const char *con_id);
178struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
178void pwm_put(struct pwm_device *pwm); 179void pwm_put(struct pwm_device *pwm);
179 180
180struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer); 181struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
182struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
183 const char *con_id);
181void devm_pwm_put(struct device *dev, struct pwm_device *pwm); 184void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
182#else 185#else
183static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data) 186static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
@@ -213,6 +216,12 @@ static inline struct pwm_device *pwm_get(struct device *dev,
213 return ERR_PTR(-ENODEV); 216 return ERR_PTR(-ENODEV);
214} 217}
215 218
219static inline struct pwm_device *of_pwm_get(struct device_node *np,
220 const char *con_id)
221{
222 return ERR_PTR(-ENODEV);
223}
224
216static inline void pwm_put(struct pwm_device *pwm) 225static inline void pwm_put(struct pwm_device *pwm)
217{ 226{
218} 227}
@@ -223,6 +232,13 @@ static inline struct pwm_device *devm_pwm_get(struct device *dev,
223 return ERR_PTR(-ENODEV); 232 return ERR_PTR(-ENODEV);
224} 233}
225 234
235static inline struct pwm_device *devm_of_pwm_get(struct device *dev,
236 struct device_node *np,
237 const char *con_id)
238{
239 return ERR_PTR(-ENODEV);
240}
241
226static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm) 242static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
227{ 243{
228} 244}