2 * lm3533.h -- LM3533 interface
4 * Copyright (C) 2011-2012 Texas Instruments
6 * Author: Johan Hovold <jhovold@gmail.com>
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.
14 #ifndef __LINUX_MFD_LM3533_H
15 #define __LINUX_MFD_LM3533_H
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)
28 struct regmap *regmap;
34 unsigned have_backlights:1;
38 struct lm3533_ctrlbank {
39 struct lm3533 *lm3533;
44 struct lm3533_als_platform_data {
45 unsigned pwm_mode:1; /* PWM input mode (default analog) */
46 u8 r_select; /* 1 - 127 (ignored in PWM-mode) */
49 struct lm3533_bl_platform_data {
51 u16 max_current; /* 5000 - 29800 uA (800 uA step) */
52 u8 default_brightness; /* 0 - 255 */
53 u8 pwm; /* 0 - 0x3f */
56 struct lm3533_led_platform_data {
58 const char *default_trigger;
59 u16 max_current; /* 5000 - 29800 uA (800 uA step) */
60 u8 pwm; /* 0 - 0x3f */
63 enum lm3533_boost_freq {
64 LM3533_BOOST_FREQ_500KHZ,
65 LM3533_BOOST_FREQ_1000KHZ,
68 enum lm3533_boost_ovp {
75 struct lm3533_platform_data {
78 enum lm3533_boost_ovp boost_ovp;
79 enum lm3533_boost_freq boost_freq;
81 struct lm3533_als_platform_data *als;
83 struct lm3533_bl_platform_data *backlights;
86 struct lm3533_led_platform_data *leds;
90 extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb);
91 extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb);
93 extern int lm3533_ctrlbank_set_brightness(struct lm3533_ctrlbank *cb, u8 val);
94 extern int lm3533_ctrlbank_get_brightness(struct lm3533_ctrlbank *cb, u8 *val);
95 extern int lm3533_ctrlbank_set_max_current(struct lm3533_ctrlbank *cb,
97 extern int lm3533_ctrlbank_set_pwm(struct lm3533_ctrlbank *cb, u8 val);
98 extern int lm3533_ctrlbank_get_pwm(struct lm3533_ctrlbank *cb, u8 *val);
100 extern int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val);
101 extern int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val);
102 extern int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask);
104 #endif /* __LINUX_MFD_LM3533_H */