#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/regmap.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define STK3310_REG_STATE …
#define STK3310_REG_PSCTRL …
#define STK3310_REG_ALSCTRL …
#define STK3310_REG_INT …
#define STK3310_REG_THDH_PS …
#define STK3310_REG_THDL_PS …
#define STK3310_REG_FLAG …
#define STK3310_REG_PS_DATA_MSB …
#define STK3310_REG_PS_DATA_LSB …
#define STK3310_REG_ALS_DATA_MSB …
#define STK3310_REG_ALS_DATA_LSB …
#define STK3310_REG_ID …
#define STK3310_MAX_REG …
#define STK3310_STATE_EN_PS …
#define STK3310_STATE_EN_ALS …
#define STK3310_STATE_STANDBY …
#define STK3013_CHIP_ID_VAL …
#define STK3310_CHIP_ID_VAL …
#define STK3311_CHIP_ID_VAL …
#define STK3311A_CHIP_ID_VAL …
#define STK3311S34_CHIP_ID_VAL …
#define STK3311X_CHIP_ID_VAL …
#define STK3335_CHIP_ID_VAL …
#define STK3310_PSINT_EN …
#define STK3310_PS_MAX_VAL …
#define STK3310_DRIVER_NAME …
#define STK3310_REGMAP_NAME …
#define STK3310_EVENT …
#define STK3310_SCALE_AVAILABLE …
#define STK3310_IT_AVAILABLE …
#define STK3310_REGFIELD(name) …
static const struct reg_field stk3310_reg_field_state = …;
static const struct reg_field stk3310_reg_field_als_gain = …;
static const struct reg_field stk3310_reg_field_ps_gain = …;
static const struct reg_field stk3310_reg_field_als_it = …;
static const struct reg_field stk3310_reg_field_ps_it = …;
static const struct reg_field stk3310_reg_field_int_ps = …;
static const struct reg_field stk3310_reg_field_flag_psint = …;
static const struct reg_field stk3310_reg_field_flag_nf = …;
static const u8 stk3310_chip_ids[] = …;
static const int stk3310_ps_max[4] = …;
static const int stk3310_scale_table[][2] = …;
static const int stk3310_it_table[][2] = …;
struct stk3310_data { … };
static const struct iio_event_spec stk3310_events[] = …;
static ssize_t stk3310_read_near_level(struct iio_dev *indio_dev,
uintptr_t priv,
const struct iio_chan_spec *chan,
char *buf)
{ … }
static const struct iio_chan_spec_ext_info stk3310_ext_info[] = …;
static const struct iio_chan_spec stk3310_channels[] = …;
static IIO_CONST_ATTR(in_illuminance_scale_available, STK3310_SCALE_AVAILABLE);
static IIO_CONST_ATTR(in_proximity_scale_available, STK3310_SCALE_AVAILABLE);
static IIO_CONST_ATTR(in_illuminance_integration_time_available,
STK3310_IT_AVAILABLE);
static IIO_CONST_ATTR(in_proximity_integration_time_available,
STK3310_IT_AVAILABLE);
static struct attribute *stk3310_attributes[] = …;
static const struct attribute_group stk3310_attribute_group = …;
static int stk3310_check_chip_id(const u8 chip_id)
{ … }
static int stk3310_get_index(const int table[][2], int table_size,
int val, int val2)
{ … }
static int stk3310_read_event(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 stk3310_write_event(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 stk3310_read_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int stk3310_write_event_config(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan,
enum iio_event_type type,
enum iio_event_direction dir,
int state)
{ … }
static int stk3310_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long mask)
{ … }
static int stk3310_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long mask)
{ … }
static const struct iio_info stk3310_info = …;
static int stk3310_set_state(struct stk3310_data *data, u8 state)
{ … }
static int stk3310_init(struct iio_dev *indio_dev)
{ … }
static bool stk3310_is_volatile_reg(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config stk3310_regmap_config = …;
static int stk3310_regmap_init(struct stk3310_data *data)
{ … }
static irqreturn_t stk3310_irq_handler(int irq, void *private)
{ … }
static irqreturn_t stk3310_irq_event_handler(int irq, void *private)
{ … }
static int stk3310_probe(struct i2c_client *client)
{ … }
static void stk3310_remove(struct i2c_client *client)
{ … }
static int stk3310_suspend(struct device *dev)
{ … }
static int stk3310_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
stk3310_resume);
static const struct i2c_device_id stk3310_i2c_id[] = …;
MODULE_DEVICE_TABLE(i2c, stk3310_i2c_id);
static const struct acpi_device_id stk3310_acpi_id[] = …;
MODULE_DEVICE_TABLE(acpi, stk3310_acpi_id);
static const struct of_device_id stk3310_of_match[] = …;
MODULE_DEVICE_TABLE(of, stk3310_of_match);
static struct i2c_driver stk3310_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;