#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/errno.h>
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/mutex.h>
#include <linux/unistd.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/pm_runtime.h>
#define TSL2583_CNTRL …
#define TSL2583_ALS_TIME …
#define TSL2583_INTERRUPT …
#define TSL2583_GAIN …
#define TSL2583_REVID …
#define TSL2583_CHIPID …
#define TSL2583_ALS_CHAN0LO …
#define TSL2583_ALS_CHAN0HI …
#define TSL2583_ALS_CHAN1LO …
#define TSL2583_ALS_CHAN1HI …
#define TSL2583_TMR_LO …
#define TSL2583_TMR_HI …
#define TSL2583_CMD_REG …
#define TSL2583_CMD_SPL_FN …
#define TSL2583_CMD_ALS_INT_CLR …
#define TSL2583_CNTL_ADC_ENBL …
#define TSL2583_CNTL_PWR_OFF …
#define TSL2583_CNTL_PWR_ON …
#define TSL2583_STA_ADC_VALID …
#define TSL2583_STA_ADC_INTR …
#define TSL2583_LUX_CALC_OVER_FLOW …
#define TSL2583_INTERRUPT_DISABLED …
#define TSL2583_CHIP_ID …
#define TSL2583_CHIP_ID_MASK …
#define TSL2583_POWER_OFF_DELAY_MS …
struct tsl2583_als_info { … };
struct tsl2583_lux { … };
static const struct tsl2583_lux tsl2583_default_lux[] = …;
#define TSL2583_MAX_LUX_TABLE_ENTRIES …
struct tsl2583_settings { … };
struct tsl2583_chip { … };
struct gainadj { … };
static const struct gainadj gainadj[] = …;
static void tsl2583_defaults(struct tsl2583_chip *chip)
{ … }
static int tsl2583_get_lux(struct iio_dev *indio_dev)
{ … }
static int tsl2583_als_calibrate(struct iio_dev *indio_dev)
{ … }
static int tsl2583_set_als_time(struct tsl2583_chip *chip)
{ … }
static int tsl2583_set_als_gain(struct tsl2583_chip *chip)
{ … }
static int tsl2583_set_power_state(struct tsl2583_chip *chip, u8 state)
{ … }
static int tsl2583_chip_init_and_power_on(struct iio_dev *indio_dev)
{ … }
static ssize_t in_illuminance_input_target_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_illuminance_input_target_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t in_illuminance_calibrate_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static ssize_t in_illuminance_lux_table_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t in_illuminance_lux_table_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static IIO_CONST_ATTR(in_illuminance_calibscale_available, "1 8 16 111");
static IIO_CONST_ATTR(in_illuminance_integration_time_available,
"0.050 0.100 0.150 0.200 0.250 0.300 0.350 0.400 0.450 0.500 0.550 0.600 0.650");
static IIO_DEVICE_ATTR_RW(in_illuminance_input_target, 0);
static IIO_DEVICE_ATTR_WO(in_illuminance_calibrate, 0);
static IIO_DEVICE_ATTR_RW(in_illuminance_lux_table, 0);
static struct attribute *sysfs_attrs_ctrl[] = …;
static const struct attribute_group tsl2583_attribute_group = …;
static const struct iio_chan_spec tsl2583_channels[] = …;
static int tsl2583_set_pm_runtime_busy(struct tsl2583_chip *chip, bool on)
{ … }
static int tsl2583_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int tsl2583_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static const struct iio_info tsl2583_info = …;
static int tsl2583_probe(struct i2c_client *clientp)
{ … }
static void tsl2583_remove(struct i2c_client *client)
{ … }
static int tsl2583_suspend(struct device *dev)
{ … }
static int tsl2583_resume(struct device *dev)
{ … }
static DEFINE_RUNTIME_DEV_PM_OPS(tsl2583_pm_ops, tsl2583_suspend,
tsl2583_resume, NULL);
static const struct i2c_device_id tsl2583_idtable[] = …;
MODULE_DEVICE_TABLE(i2c, tsl2583_idtable);
static const struct of_device_id tsl2583_of_match[] = …;
MODULE_DEVICE_TABLE(of, tsl2583_of_match);
static struct i2c_driver tsl2583_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;