#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#define AD7150_STATUS_REG …
#define AD7150_STATUS_OUT1 …
#define AD7150_STATUS_OUT2 …
#define AD7150_CH1_DATA_HIGH_REG …
#define AD7150_CH2_DATA_HIGH_REG …
#define AD7150_CH1_AVG_HIGH_REG …
#define AD7150_CH2_AVG_HIGH_REG …
#define AD7150_CH1_SENSITIVITY_REG …
#define AD7150_CH1_THR_HOLD_H_REG …
#define AD7150_CH1_TIMEOUT_REG …
#define AD7150_CH_TIMEOUT_RECEDING …
#define AD7150_CH_TIMEOUT_APPROACHING …
#define AD7150_CH1_SETUP_REG …
#define AD7150_CH2_SENSITIVITY_REG …
#define AD7150_CH2_THR_HOLD_H_REG …
#define AD7150_CH2_TIMEOUT_REG …
#define AD7150_CH2_SETUP_REG …
#define AD7150_CFG_REG …
#define AD7150_CFG_FIX …
#define AD7150_CFG_THRESHTYPE_MSK …
#define AD7150_CFG_TT_NEG …
#define AD7150_CFG_TT_POS …
#define AD7150_CFG_TT_IN_WINDOW …
#define AD7150_CFG_TT_OUT_WINDOW …
#define AD7150_PD_TIMER_REG …
#define AD7150_CH1_CAPDAC_REG …
#define AD7150_CH2_CAPDAC_REG …
#define AD7150_SN3_REG …
#define AD7150_SN2_REG …
#define AD7150_SN1_REG …
#define AD7150_SN0_REG …
#define AD7150_ID_REG …
enum { … };
struct ad7150_chip_info { … };
static const u8 ad7150_addresses[][6] = …;
static int ad7150_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long mask)
{ … }
static int ad7150_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 ad7150_write_event_params(struct iio_dev *indio_dev,
unsigned int chan,
enum iio_event_type type,
enum iio_event_direction dir)
{ … }
static int ad7150_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 ad7150_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 ad7150_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 const struct iio_event_spec ad7150_events[] = …;
#define AD7150_CAPACITANCE_CHAN(_chan) …
#define AD7150_CAPACITANCE_CHAN_NO_IRQ(_chan) …
static const struct iio_chan_spec ad7150_channels[] = …;
static const struct iio_chan_spec ad7150_channels_no_irq[] = …;
static const struct iio_chan_spec ad7151_channels[] = …;
static const struct iio_chan_spec ad7151_channels_no_irq[] = …;
static irqreturn_t __ad7150_event_handler(void *private, u8 status_mask,
int channel)
{ … }
static irqreturn_t ad7150_event_handler_ch1(int irq, void *private)
{ … }
static irqreturn_t ad7150_event_handler_ch2(int irq, void *private)
{ … }
static IIO_CONST_ATTR(in_capacitance_thresh_adaptive_timeout_available,
"[0 0.01 0.15]");
static struct attribute *ad7150_event_attributes[] = …;
static const struct attribute_group ad7150_event_attribute_group = …;
static const struct iio_info ad7150_info = …;
static const struct iio_info ad7150_info_no_irq = …;
static int ad7150_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ad7150_id[] = …;
MODULE_DEVICE_TABLE(i2c, ad7150_id);
static const struct of_device_id ad7150_of_match[] = …;
static struct i2c_driver ad7150_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;