diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-05-03 06:26:36 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-05-09 11:20:01 -0400 |
commit | 16c5c023aac86228e3e94c4bf6d19708ea861a05 (patch) | |
tree | 2fb7e87ef18d2520e4e0e957e4512c9f92a3886d /include | |
parent | ae8406357eca7fde4ff047e858d285faee836804 (diff) |
mfd: Add LM3533 lighting-power core driver
Add support for National Semiconductor / TI LM3533 lighting power chips.
This is the core driver which provides register access over I2C and
registers the ambient-light-sensor, LED and backlight sub-drivers.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/lm3533.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/include/linux/mfd/lm3533.h b/include/linux/mfd/lm3533.h new file mode 100644 index 000000000000..75f85f3fbd90 --- /dev/null +++ b/include/linux/mfd/lm3533.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * lm3533.h -- LM3533 interface | ||
3 | * | ||
4 | * Copyright (C) 2011-2012 Texas Instruments | ||
5 | * | ||
6 | * Author: Johan Hovold <jhovold@gmail.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_MFD_LM3533_H | ||
15 | #define __LINUX_MFD_LM3533_H | ||
16 | |||
17 | #define LM3533_ATTR_RO(_name) \ | ||
18 | DEVICE_ATTR(_name, S_IRUGO, show_##_name, NULL) | ||
19 | #define LM3533_ATTR_RW(_name) \ | ||
20 | DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name) | ||
21 | |||
22 | struct device; | ||
23 | struct regmap; | ||
24 | |||
25 | struct lm3533 { | ||
26 | struct device *dev; | ||
27 | |||
28 | struct regmap *regmap; | ||
29 | |||
30 | int gpio_hwen; | ||
31 | int irq; | ||
32 | |||
33 | unsigned have_als:1; | ||
34 | unsigned have_backlights:1; | ||
35 | unsigned have_leds:1; | ||
36 | }; | ||
37 | |||
38 | struct lm3533_ctrlbank { | ||
39 | struct lm3533 *lm3533; | ||
40 | struct device *dev; | ||
41 | int id; | ||
42 | }; | ||
43 | |||
44 | struct lm3533_als_platform_data { | ||
45 | unsigned pwm_mode:1; /* PWM input mode (default analog) */ | ||
46 | }; | ||
47 | |||
48 | struct lm3533_bl_platform_data { | ||
49 | char *name; | ||
50 | u8 default_brightness; /* 0 - 255 */ | ||
51 | u8 max_current; /* 0 - 31 */ | ||
52 | u8 pwm; /* 0 - 0x3f */ | ||
53 | }; | ||
54 | |||
55 | struct lm3533_led_platform_data { | ||
56 | char *name; | ||
57 | const char *default_trigger; | ||
58 | u8 max_current; /* 0 - 31 */ | ||
59 | u8 pwm; /* 0 - 0x3f */ | ||
60 | }; | ||
61 | |||
62 | struct lm3533_platform_data { | ||
63 | int gpio_hwen; | ||
64 | |||
65 | struct lm3533_als_platform_data *als; | ||
66 | |||
67 | struct lm3533_bl_platform_data *backlights; | ||
68 | int num_backlights; | ||
69 | |||
70 | struct lm3533_led_platform_data *leds; | ||
71 | int num_leds; | ||
72 | }; | ||
73 | |||
74 | extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb); | ||
75 | extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb); | ||
76 | |||
77 | extern int lm3533_ctrlbank_set_brightness(struct lm3533_ctrlbank *cb, u8 val); | ||
78 | extern int lm3533_ctrlbank_get_brightness(struct lm3533_ctrlbank *cb, u8 *val); | ||
79 | extern int lm3533_ctrlbank_set_max_current(struct lm3533_ctrlbank *cb, u8 val); | ||
80 | extern int lm3533_ctrlbank_get_max_current(struct lm3533_ctrlbank *cb, | ||
81 | u8 *val); | ||
82 | extern int lm3533_ctrlbank_set_pwm(struct lm3533_ctrlbank *cb, u8 val); | ||
83 | extern int lm3533_ctrlbank_get_pwm(struct lm3533_ctrlbank *cb, u8 *val); | ||
84 | |||
85 | extern int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val); | ||
86 | extern int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val); | ||
87 | extern int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask); | ||
88 | |||
89 | #endif /* __LINUX_MFD_LM3533_H */ | ||