#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define OPT3001_RESULT …
#define OPT3001_CONFIGURATION …
#define OPT3001_LOW_LIMIT …
#define OPT3001_HIGH_LIMIT …
#define OPT3001_MANUFACTURER_ID …
#define OPT3001_DEVICE_ID …
#define OPT3001_CONFIGURATION_RN_MASK …
#define OPT3001_CONFIGURATION_RN_AUTO …
#define OPT3001_CONFIGURATION_CT …
#define OPT3001_CONFIGURATION_M_MASK …
#define OPT3001_CONFIGURATION_M_SHUTDOWN …
#define OPT3001_CONFIGURATION_M_SINGLE …
#define OPT3001_CONFIGURATION_M_CONTINUOUS …
#define OPT3001_CONFIGURATION_OVF …
#define OPT3001_CONFIGURATION_CRF …
#define OPT3001_CONFIGURATION_FH …
#define OPT3001_CONFIGURATION_FL …
#define OPT3001_CONFIGURATION_L …
#define OPT3001_CONFIGURATION_POL …
#define OPT3001_CONFIGURATION_ME …
#define OPT3001_CONFIGURATION_FC_MASK …
#define OPT3001_LOW_LIMIT_EOC_ENABLE …
#define OPT3001_REG_EXPONENT(n) …
#define OPT3001_REG_MANTISSA(n) …
#define OPT3001_INT_TIME_LONG …
#define OPT3001_INT_TIME_SHORT …
#define OPT3001_RESULT_READY_SHORT …
#define OPT3001_RESULT_READY_LONG …
struct opt3001 { … };
struct opt3001_scale { … };
static const struct opt3001_scale opt3001_scales[] = …;
static int opt3001_find_scale(const struct opt3001 *opt, int val,
int val2, u8 *exponent)
{ … }
static void opt3001_to_iio_ret(struct opt3001 *opt, u8 exponent,
u16 mantissa, int *val, int *val2)
{ … }
static void opt3001_set_mode(struct opt3001 *opt, u16 *reg, u16 mode)
{ … }
static IIO_CONST_ATTR_INT_TIME_AVAIL("0.1 0.8");
static struct attribute *opt3001_attributes[] = …;
static const struct attribute_group opt3001_attribute_group = …;
static const struct iio_event_spec opt3001_event_spec[] = …;
static const struct iio_chan_spec opt3001_channels[] = …;
static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
{ … }
static int opt3001_get_int_time(struct opt3001 *opt, int *val, int *val2)
{ … }
static int opt3001_set_int_time(struct opt3001 *opt, int time)
{ … }
static int opt3001_read_raw(struct iio_dev *iio,
struct iio_chan_spec const *chan, int *val, int *val2,
long mask)
{ … }
static int opt3001_write_raw(struct iio_dev *iio,
struct iio_chan_spec const *chan, int val, int val2,
long mask)
{ … }
static int opt3001_read_event_value(struct iio_dev *iio,
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 opt3001_write_event_value(struct iio_dev *iio,
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 opt3001_read_event_config(struct iio_dev *iio,
const struct iio_chan_spec *chan, enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int opt3001_write_event_config(struct iio_dev *iio,
const struct iio_chan_spec *chan, enum iio_event_type type,
enum iio_event_direction dir, int state)
{ … }
static const struct iio_info opt3001_info = …;
static int opt3001_read_id(struct opt3001 *opt)
{ … }
static int opt3001_configure(struct opt3001 *opt)
{ … }
static irqreturn_t opt3001_irq(int irq, void *_iio)
{ … }
static int opt3001_probe(struct i2c_client *client)
{ … }
static void opt3001_remove(struct i2c_client *client)
{ … }
static const struct i2c_device_id opt3001_id[] = …;
MODULE_DEVICE_TABLE(i2c, opt3001_id);
static const struct of_device_id opt3001_of_match[] = …;
MODULE_DEVICE_TABLE(of, opt3001_of_match);
static struct i2c_driver opt3001_driver = …;
module_i2c_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;