#include <linux/atomic.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/mfd/lm3533.h>
#define LM3533_ALS_RESISTOR_MIN …
#define LM3533_ALS_RESISTOR_MAX …
#define LM3533_ALS_CHANNEL_CURRENT_MAX …
#define LM3533_ALS_THRESH_MAX …
#define LM3533_ALS_ZONE_MAX …
#define LM3533_REG_ALS_RESISTOR_SELECT …
#define LM3533_REG_ALS_CONF …
#define LM3533_REG_ALS_ZONE_INFO …
#define LM3533_REG_ALS_READ_ADC_RAW …
#define LM3533_REG_ALS_READ_ADC_AVERAGE …
#define LM3533_REG_ALS_BOUNDARY_BASE …
#define LM3533_REG_ALS_TARGET_BASE …
#define LM3533_ALS_ENABLE_MASK …
#define LM3533_ALS_INPUT_MODE_MASK …
#define LM3533_ALS_INT_ENABLE_MASK …
#define LM3533_ALS_ZONE_SHIFT …
#define LM3533_ALS_ZONE_MASK …
#define LM3533_ALS_FLAG_INT_ENABLED …
struct lm3533_als { … };
static int lm3533_als_get_adc(struct iio_dev *indio_dev, bool average,
int *adc)
{ … }
static int _lm3533_als_get_zone(struct iio_dev *indio_dev, u8 *zone)
{ … }
static int lm3533_als_get_zone(struct iio_dev *indio_dev, u8 *zone)
{ … }
static inline u8 lm3533_als_get_target_reg(unsigned channel, unsigned zone)
{ … }
static int lm3533_als_get_target(struct iio_dev *indio_dev, unsigned channel,
unsigned zone, u8 *val)
{ … }
static int lm3533_als_set_target(struct iio_dev *indio_dev, unsigned channel,
unsigned zone, u8 val)
{ … }
static int lm3533_als_get_current(struct iio_dev *indio_dev, unsigned channel,
int *val)
{ … }
static int lm3533_als_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
#define CHANNEL_CURRENT(_channel) …
static const struct iio_chan_spec lm3533_als_channels[] = …;
static irqreturn_t lm3533_als_isr(int irq, void *dev_id)
{ … }
static int lm3533_als_set_int_mode(struct iio_dev *indio_dev, int enable)
{ … }
static int lm3533_als_get_int_mode(struct iio_dev *indio_dev, int *enable)
{ … }
static inline u8 lm3533_als_get_threshold_reg(unsigned nr, bool raising)
{ … }
static int lm3533_als_get_threshold(struct iio_dev *indio_dev, unsigned nr,
bool raising, u8 *val)
{ … }
static int lm3533_als_set_threshold(struct iio_dev *indio_dev, unsigned nr,
bool raising, u8 val)
{ … }
static int lm3533_als_get_hysteresis(struct iio_dev *indio_dev, unsigned nr,
u8 *val)
{ … }
static ssize_t show_thresh_either_en(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t store_thresh_either_en(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t show_zone(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
enum lm3533_als_attribute_type { … };
struct lm3533_als_attribute { … };
static inline struct lm3533_als_attribute *
to_lm3533_als_attr(struct device_attribute *attr)
{ … }
static ssize_t show_als_attr(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t store_als_attr(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
#define ALS_ATTR(_name, _mode, _show, _store, _type, _val1, _val2) …
#define LM3533_ALS_ATTR(_name, _mode, _show, _store, _type, _val1, _val2) …
#define ALS_TARGET_ATTR_RW(_channel, _zone) …
static ALS_TARGET_ATTR_RW(0, 0);
static ALS_TARGET_ATTR_RW(0, 1);
static ALS_TARGET_ATTR_RW(0, 2);
static ALS_TARGET_ATTR_RW(0, 3);
static ALS_TARGET_ATTR_RW(0, 4);
static ALS_TARGET_ATTR_RW(1, 0);
static ALS_TARGET_ATTR_RW(1, 1);
static ALS_TARGET_ATTR_RW(1, 2);
static ALS_TARGET_ATTR_RW(1, 3);
static ALS_TARGET_ATTR_RW(1, 4);
static ALS_TARGET_ATTR_RW(2, 0);
static ALS_TARGET_ATTR_RW(2, 1);
static ALS_TARGET_ATTR_RW(2, 2);
static ALS_TARGET_ATTR_RW(2, 3);
static ALS_TARGET_ATTR_RW(2, 4);
#define ALS_THRESH_FALLING_ATTR_RW(_nr) …
#define ALS_THRESH_RAISING_ATTR_RW(_nr) …
static ALS_THRESH_FALLING_ATTR_RW(0);
static ALS_THRESH_FALLING_ATTR_RW(1);
static ALS_THRESH_FALLING_ATTR_RW(2);
static ALS_THRESH_FALLING_ATTR_RW(3);
static ALS_THRESH_RAISING_ATTR_RW(0);
static ALS_THRESH_RAISING_ATTR_RW(1);
static ALS_THRESH_RAISING_ATTR_RW(2);
static ALS_THRESH_RAISING_ATTR_RW(3);
#define ALS_HYSTERESIS_ATTR_RO(_nr) …
static ALS_HYSTERESIS_ATTR_RO(0);
static ALS_HYSTERESIS_ATTR_RO(1);
static ALS_HYSTERESIS_ATTR_RO(2);
static ALS_HYSTERESIS_ATTR_RO(3);
#define ILLUMINANCE_ATTR_RO(_name) …
#define ILLUMINANCE_ATTR_RW(_name) …
static ILLUMINANCE_ATTR_RW(thresh_either_en);
static ILLUMINANCE_ATTR_RO(zone);
static struct attribute *lm3533_als_event_attributes[] = …;
static const struct attribute_group lm3533_als_event_attribute_group = …;
static struct attribute *lm3533_als_attributes[] = …;
static const struct attribute_group lm3533_als_attribute_group = …;
static int lm3533_als_set_input_mode(struct lm3533_als *als, bool pwm_mode)
{ … }
static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
{ … }
static int lm3533_als_setup(struct lm3533_als *als,
struct lm3533_als_platform_data *pdata)
{ … }
static int lm3533_als_setup_irq(struct lm3533_als *als, void *dev)
{ … }
static int lm3533_als_enable(struct lm3533_als *als)
{ … }
static int lm3533_als_disable(struct lm3533_als *als)
{ … }
static const struct iio_info lm3533_als_info = …;
static int lm3533_als_probe(struct platform_device *pdev)
{ … }
static void lm3533_als_remove(struct platform_device *pdev)
{ … }
static struct platform_driver lm3533_als_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;