#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/mfd/core.h>
#include <linux/regmap.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/mfd/lm3533.h>
#define LM3533_BOOST_OVP_MASK …
#define LM3533_BOOST_OVP_SHIFT …
#define LM3533_BOOST_FREQ_MASK …
#define LM3533_BOOST_FREQ_SHIFT …
#define LM3533_BL_ID_MASK …
#define LM3533_LED_ID_MASK …
#define LM3533_BL_ID_MAX …
#define LM3533_LED_ID_MAX …
#define LM3533_HVLED_ID_MAX …
#define LM3533_LVLED_ID_MAX …
#define LM3533_REG_OUTPUT_CONF1 …
#define LM3533_REG_OUTPUT_CONF2 …
#define LM3533_REG_BOOST_PWM …
#define LM3533_REG_MAX …
static struct mfd_cell lm3533_als_devs[] = …;
static struct mfd_cell lm3533_bl_devs[] = …;
static struct mfd_cell lm3533_led_devs[] = …;
int lm3533_read(struct lm3533 *lm3533, u8 reg, u8 *val)
{ … }
EXPORT_SYMBOL_GPL(…);
int lm3533_write(struct lm3533 *lm3533, u8 reg, u8 val)
{ … }
EXPORT_SYMBOL_GPL(…);
int lm3533_update(struct lm3533 *lm3533, u8 reg, u8 val, u8 mask)
{ … }
EXPORT_SYMBOL_GPL(…);
static int lm3533_set_boost_freq(struct lm3533 *lm3533,
enum lm3533_boost_freq freq)
{ … }
static int lm3533_set_boost_ovp(struct lm3533 *lm3533,
enum lm3533_boost_ovp ovp)
{ … }
static int lm3533_set_hvled_config(struct lm3533 *lm3533, u8 hvled, u8 bl)
{ … }
static int lm3533_set_lvled_config(struct lm3533 *lm3533, u8 lvled, u8 led)
{ … }
static void lm3533_enable(struct lm3533 *lm3533)
{ … }
static void lm3533_disable(struct lm3533 *lm3533)
{ … }
enum lm3533_attribute_type { … };
struct lm3533_device_attribute { … };
#define to_lm3533_dev_attr(_attr) …
static ssize_t show_output(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t store_output(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
#define LM3533_OUTPUT_ATTR(_name, _mode, _show, _store, _type, _id) …
#define LM3533_OUTPUT_ATTR_RW(_name, _type, _id) …
#define LM3533_OUTPUT_HVLED_ATTR_RW(_nr) …
#define LM3533_OUTPUT_LVLED_ATTR_RW(_nr) …
static LM3533_OUTPUT_HVLED_ATTR_RW(1);
static LM3533_OUTPUT_HVLED_ATTR_RW(2);
static LM3533_OUTPUT_LVLED_ATTR_RW(1);
static LM3533_OUTPUT_LVLED_ATTR_RW(2);
static LM3533_OUTPUT_LVLED_ATTR_RW(3);
static LM3533_OUTPUT_LVLED_ATTR_RW(4);
static LM3533_OUTPUT_LVLED_ATTR_RW(5);
static struct attribute *lm3533_attributes[] = …;
#define to_dev_attr(_attr) …
static umode_t lm3533_attr_is_visible(struct kobject *kobj,
struct attribute *attr, int n)
{
struct device *dev = kobj_to_dev(kobj);
struct lm3533 *lm3533 = dev_get_drvdata(dev);
struct device_attribute *dattr = to_dev_attr(attr);
struct lm3533_device_attribute *lattr = to_lm3533_dev_attr(dattr);
enum lm3533_attribute_type type = lattr->type;
umode_t mode = attr->mode;
if (!lm3533->have_backlights && type == LM3533_ATTR_TYPE_BACKLIGHT)
mode = 0;
else if (!lm3533->have_leds && type == LM3533_ATTR_TYPE_LED)
mode = 0;
return mode;
};
static struct attribute_group lm3533_attribute_group = …;
static int lm3533_device_als_init(struct lm3533 *lm3533)
{ … }
static int lm3533_device_bl_init(struct lm3533 *lm3533)
{ … }
static int lm3533_device_led_init(struct lm3533 *lm3533)
{ … }
static int lm3533_device_setup(struct lm3533 *lm3533,
struct lm3533_platform_data *pdata)
{ … }
static int lm3533_device_init(struct lm3533 *lm3533)
{ … }
static void lm3533_device_exit(struct lm3533 *lm3533)
{ … }
static bool lm3533_readable_register(struct device *dev, unsigned int reg)
{ … }
static bool lm3533_volatile_register(struct device *dev, unsigned int reg)
{ … }
static bool lm3533_precious_register(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config regmap_config = …;
static int lm3533_i2c_probe(struct i2c_client *i2c)
{ … }
static void lm3533_i2c_remove(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id lm3533_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, lm3533_i2c_ids);
static struct i2c_driver lm3533_i2c_driver = …;
static int __init lm3533_i2c_init(void)
{ … }
subsys_initcall(lm3533_i2c_init);
static void __exit lm3533_i2c_exit(void)
{ … }
module_exit(lm3533_i2c_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;