#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/platform_data/tsl2772.h>
#include <linux/regulator/consumer.h>
#define PROX_STAT_CAL …
#define PROX_STAT_SAMP …
#define MAX_SAMPLES_CAL …
#define TRITON_ID …
#define SWORDFISH_ID …
#define HALIBUT_ID …
#define TSL2772_LUX_CALC_OVER_FLOW …
#define TSL2772_MAX_CONFIG_REG …
#define TSL2772_CNTRL …
#define TSL2772_ALS_TIME …
#define TSL2772_PRX_TIME …
#define TSL2772_WAIT_TIME …
#define TSL2772_ALS_MINTHRESHLO …
#define TSL2772_ALS_MINTHRESHHI …
#define TSL2772_ALS_MAXTHRESHLO …
#define TSL2772_ALS_MAXTHRESHHI …
#define TSL2772_PRX_MINTHRESHLO …
#define TSL2772_PRX_MINTHRESHHI …
#define TSL2772_PRX_MAXTHRESHLO …
#define TSL2772_PRX_MAXTHRESHHI …
#define TSL2772_PERSISTENCE …
#define TSL2772_ALS_PRX_CONFIG …
#define TSL2772_PRX_COUNT …
#define TSL2772_GAIN …
#define TSL2772_NOTUSED …
#define TSL2772_REVID …
#define TSL2772_CHIPID …
#define TSL2772_STATUS …
#define TSL2772_ALS_CHAN0LO …
#define TSL2772_ALS_CHAN0HI …
#define TSL2772_ALS_CHAN1LO …
#define TSL2772_ALS_CHAN1HI …
#define TSL2772_PRX_LO …
#define TSL2772_PRX_HI …
#define TSL2772_CMD_REG …
#define TSL2772_CMD_SPL_FN …
#define TSL2772_CMD_REPEAT_PROTO …
#define TSL2772_CMD_AUTOINC_PROTO …
#define TSL2772_CMD_PROX_INT_CLR …
#define TSL2772_CMD_ALS_INT_CLR …
#define TSL2772_CMD_PROXALS_INT_CLR …
#define TSL2772_CNTL_ADC_ENBL …
#define TSL2772_CNTL_PWR_ON …
#define TSL2772_STA_ADC_VALID …
#define TSL2772_STA_PRX_VALID …
#define TSL2772_STA_ADC_PRX_VALID …
#define TSL2772_STA_ALS_INTR …
#define TSL2772_STA_PRX_INTR …
#define TSL2772_CNTL_REG_CLEAR …
#define TSL2772_CNTL_PROX_INT_ENBL …
#define TSL2772_CNTL_ALS_INT_ENBL …
#define TSL2772_CNTL_WAIT_TMR_ENBL …
#define TSL2772_CNTL_PROX_DET_ENBL …
#define TSL2772_CNTL_PWRON …
#define TSL2772_CNTL_ALSPON_ENBL …
#define TSL2772_CNTL_INTALSPON_ENBL …
#define TSL2772_CNTL_PROXPON_ENBL …
#define TSL2772_CNTL_INTPROXPON_ENBL …
#define TSL2772_ALS_GAIN_TRIM_MIN …
#define TSL2772_ALS_GAIN_TRIM_MAX …
#define TSL2772_MAX_PROX_LEDS …
#define TSL2772_BOOT_MIN_SLEEP_TIME …
#define TSL2772_BOOT_MAX_SLEEP_TIME …
enum { … };
enum { … };
enum { … };
struct tsl2772_als_info { … };
struct tsl2772_chip_info { … };
static const int tsl2772_led_currents[][2] = …;
struct tsl2772_chip { … };
static const struct tsl2772_lux tsl2x71_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = …;
static const struct tsl2772_lux tmd2x71_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = …;
static const struct tsl2772_lux tsl2x72_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = …;
static const struct tsl2772_lux tmd2x72_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = …;
static const struct tsl2772_lux apds9930_lux_table[TSL2772_DEF_LUX_TABLE_SZ] = …;
static const struct tsl2772_lux *tsl2772_default_lux_table_group[] = …;
static const struct tsl2772_settings tsl2772_default_settings = …;
static const s16 tsl2772_als_gain[] = …;
static const s16 tsl2772_prox_gain[] = …;
static const int tsl2772_int_time_avail[][6] = …;
static int tsl2772_int_calibscale_avail[] = …;
static int tsl2772_prox_calibscale_avail[] = …;
enum { … };
static const u8 device_channel_config[] = …;
static int tsl2772_read_status(struct tsl2772_chip *chip)
{ … }
static int tsl2772_write_control_reg(struct tsl2772_chip *chip, u8 data)
{ … }
static int tsl2772_read_autoinc_regs(struct tsl2772_chip *chip, int lower_reg,
int upper_reg)
{ … }
static int tsl2772_get_lux(struct iio_dev *indio_dev)
{ … }
static int tsl2772_get_prox(struct iio_dev *indio_dev)
{ … }
static int tsl2772_read_prox_led_current(struct tsl2772_chip *chip)
{ … }
static int tsl2772_read_prox_diodes(struct tsl2772_chip *chip)
{ … }
static void tsl2772_parse_dt(struct tsl2772_chip *chip)
{ … }
static void tsl2772_defaults(struct tsl2772_chip *chip)
{ … }
static int tsl2772_als_calibrate(struct iio_dev *indio_dev)
{ … }
static void tsl2772_disable_regulators_action(void *_data)
{ … }
static int tsl2772_chip_on(struct iio_dev *indio_dev)
{ … }
static int tsl2772_chip_off(struct iio_dev *indio_dev)
{ … }
static void tsl2772_chip_off_action(void *data)
{ … }
static int tsl2772_invoke_change(struct iio_dev *indio_dev)
{ … }
static int tsl2772_prox_cal(struct iio_dev *indio_dev)
{ … }
static int tsl2772_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long mask)
{ … }
static ssize_t in_illuminance0_target_input_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_illuminance0_target_input_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t in_illuminance0_calibrate_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t in_illuminance0_lux_table_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_illuminance0_lux_table_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t in_proximity0_calibrate_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static int tsl2772_read_interrupt_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int tsl2772_write_interrupt_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
int val)
{ … }
static int tsl2772_write_event_value(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int val, int val2)
{ … }
static int tsl2772_read_event_value(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
enum iio_event_info info,
int *val, int *val2)
{ … }
static int tsl2772_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long mask)
{ … }
static int tsl2772_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
int val2,
long mask)
{ … }
static DEVICE_ATTR_RW(in_illuminance0_target_input);
static DEVICE_ATTR_WO(in_illuminance0_calibrate);
static DEVICE_ATTR_WO(in_proximity0_calibrate);
static DEVICE_ATTR_RW(in_illuminance0_lux_table);
static int tsl2772_device_id_verif(int id, int target)
{ … }
static irqreturn_t tsl2772_event_handler(int irq, void *private)
{ … }
static struct attribute *tsl2772_ALS_device_attrs[] = …;
static struct attribute *tsl2772_PRX_device_attrs[] = …;
static struct attribute *tsl2772_ALSPRX_device_attrs[] = …;
static struct attribute *tsl2772_PRX2_device_attrs[] = …;
static struct attribute *tsl2772_ALSPRX2_device_attrs[] = …;
static const struct attribute_group tsl2772_device_attr_group_tbl[] = …;
#define TSL2772_DEVICE_INFO(type) …
static const struct iio_info tsl2772_device_info[] = …;
static const struct iio_event_spec tsl2772_events[] = …;
static const struct tsl2772_chip_info tsl2772_chip_info_tbl[] = …;
static int tsl2772_probe(struct i2c_client *clientp)
{ … }
static int tsl2772_suspend(struct device *dev)
{ … }
static int tsl2772_resume(struct device *dev)
{ … }
static const struct i2c_device_id tsl2772_idtable[] = …;
MODULE_DEVICE_TABLE(i2c, tsl2772_idtable);
static const struct of_device_id tsl2772_of_match[] = …;
MODULE_DEVICE_TABLE(of, tsl2772_of_match);
static const struct dev_pm_ops tsl2772_pm_ops = …;
static struct i2c_driver tsl2772_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;