#include <linux/device.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#define AD7291_COMMAND …
#define AD7291_VOLTAGE …
#define AD7291_T_SENSE …
#define AD7291_T_AVERAGE …
#define AD7291_DATA_HIGH(x) …
#define AD7291_DATA_LOW(x) …
#define AD7291_HYST(x) …
#define AD7291_VOLTAGE_ALERT_STATUS …
#define AD7291_T_ALERT_STATUS …
#define AD7291_BITS …
#define AD7291_VOLTAGE_LIMIT_COUNT …
#define AD7291_AUTOCYCLE …
#define AD7291_RESET …
#define AD7291_ALERT_CLEAR …
#define AD7291_ALERT_POLARITY …
#define AD7291_EXT_REF …
#define AD7291_NOISE_DELAY …
#define AD7291_T_SENSE_MASK …
#define AD7291_VOLTAGE_MASK …
#define AD7291_VOLTAGE_OFFSET …
#define AD7291_VALUE_MASK …
#define AD7291_T_LOW …
#define AD7291_T_HIGH …
#define AD7291_T_AVG_LOW …
#define AD7291_T_AVG_HIGH …
#define AD7291_V_LOW(x) …
#define AD7291_V_HIGH(x) …
struct ad7291_chip_info { … };
static int ad7291_i2c_read(struct ad7291_chip_info *chip, u8 reg, u16 *data)
{ … }
static int ad7291_i2c_write(struct ad7291_chip_info *chip, u8 reg, u16 data)
{ … }
static irqreturn_t ad7291_event_handler(int irq, void *private)
{ … }
static unsigned int ad7291_threshold_reg(const struct iio_chan_spec *chan,
enum iio_event_direction dir,
enum iio_event_info info)
{ … }
static int ad7291_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 ad7291_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 ad7291_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 ad7291_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 ad7291_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long mask)
{ … }
static const struct iio_event_spec ad7291_events[] = …;
#define AD7291_VOLTAGE_CHAN(_chan) …
static const struct iio_chan_spec ad7291_channels[] = …;
static const struct iio_info ad7291_info = …;
static void ad7291_reg_disable(void *reg)
{ … }
static int ad7291_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ad7291_id[] = …;
MODULE_DEVICE_TABLE(i2c, ad7291_id);
static const struct of_device_id ad7291_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad7291_of_match);
static struct i2c_driver ad7291_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;