2019-05-27 14:55:01 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-05-03 18:26:36 +08:00
|
|
|
/*
|
|
|
|
* lm3533.h -- LM3533 interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2012 Texas Instruments
|
|
|
|
*
|
|
|
|
* Author: Johan Hovold <jhovold@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LINUX_MFD_LM3533_H
|
|
|
|
#define __LINUX_MFD_LM3533_H
|
|
|
|
|
|
|
|
#define LM3533_ATTR_RO(_name) \
|
|
|
|
DEVICE_ATTR(_name, S_IRUGO, show_##_name, NULL)
|
|
|
|
#define LM3533_ATTR_RW(_name) \
|
|
|
|
DEVICE_ATTR(_name, S_IRUGO | S_IWUSR , show_##_name, store_##_name)
|
|
|
|
|
|
|
|
struct device;
|
|
|
|
struct regmap;
|
|
|
|
|
|
|
|
struct lm3533 {
|
|
|
|
struct device *dev;
|
|
|
|
|
|
|
|
struct regmap *regmap;
|
|
|
|
|
|
|
|
int gpio_hwen;
|
|
|
|
int irq;
|
|
|
|
|
|
|
|
unsigned have_als:1;
|
|
|
|
unsigned have_backlights:1;
|
|
|
|
unsigned have_leds:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lm3533_ctrlbank {
|
|
|
|
struct lm3533 *lm3533;
|
|
|
|
struct device *dev;
|
|
|
|
int id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lm3533_als_platform_data {
|
|
|
|
unsigned pwm_mode:1; /* PWM input mode (default analog) */
|
2012-05-19 02:22:45 +08:00
|
|
|
u8 r_select; /* 1 - 127 (ignored in PWM-mode) */
|
2012-05-03 18:26:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lm3533_bl_platform_data {
|
|
|
|
char *name;
|
2012-05-11 01:18:29 +08:00
|
|
|
u16 max_current; /* 5000 - 29800 uA (800 uA step) */
|
2012-05-03 18:26:36 +08:00
|
|
|
u8 default_brightness; /* 0 - 255 */
|
|
|
|
u8 pwm; /* 0 - 0x3f */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lm3533_led_platform_data {
|
|
|
|
char *name;
|
|
|
|
const char *default_trigger;
|
2012-05-11 01:18:29 +08:00
|
|
|
u16 max_current; /* 5000 - 29800 uA (800 uA step) */
|
2012-05-03 18:26:36 +08:00
|
|
|
u8 pwm; /* 0 - 0x3f */
|
|
|
|
};
|
|
|
|
|
2012-05-10 20:11:28 +08:00
|
|
|
enum lm3533_boost_freq {
|
|
|
|
LM3533_BOOST_FREQ_500KHZ,
|
|
|
|
LM3533_BOOST_FREQ_1000KHZ,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum lm3533_boost_ovp {
|
|
|
|
LM3533_BOOST_OVP_16V,
|
|
|
|
LM3533_BOOST_OVP_24V,
|
|
|
|
LM3533_BOOST_OVP_32V,
|
|
|
|
LM3533_BOOST_OVP_40V,
|
|
|
|
};
|
|
|
|
|
2012-05-03 18:26:36 +08:00
|
|
|
struct lm3533_platform_data {
|
|
|
|
int gpio_hwen;
|
|
|
|
|
2012-05-10 20:11:28 +08:00
|
|
|
enum lm3533_boost_ovp boost_ovp;
|
|
|
|
enum lm3533_boost_freq boost_freq;
|
|
|
|
|
2012-05-03 18:26:36 +08:00
|
|
|
struct lm3533_als_platform_data *als;
|
|
|
|
|
|
|
|
struct lm3533_bl_platform_data *backlights;
|
|
|
|
int num_backlights;
|
|
|
|
|
|
|
|
struct lm3533_led_platform_data *leds;
|
|
|
|
int num_leds;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int lm3533_ctrlbank_enable(struct lm3533_ctrlbank *cb);
|
|
|
|
extern int lm3533_ctrlbank_disable(struct lm3533_ctrlbank *cb);
|
|
|
|
|
|
|
|
extern int lm3533_ctrlbank_set_brightness(struct lm3533_ctrlbank *cb, u8 val);
|
|
|
|
extern int lm3533_ctrlbank_get_brightness(struct lm3533_ctrlbank *cb, u8 *val);
|
2012-05-11 01:18:29 +08:00
|
|
|
extern int lm3533_ctrlbank_set_max_current(struct lm3533_ctrlbank *cb,
|
|
|
|
u16 imax);
|
2012-05-03 18:26:36 +08:00
|
|
|
extern int lm3533_ctrlbank_set_pwm(struct lm3533_ctrlbank *cb, u8 val);
|
|
|
|
extern int lm3533_ctrlbank_get_pwm(struct lm3533_ctrlbank *cb, u8 *val);
|
|
|
|
|
|
|
|
extern int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val);
|
|
|
|
extern int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val);
|
|
|
|
extern int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask);
|
|
|
|
|
|
|
|
#endif /* __LINUX_MFD_LM3533_H */
|