#include <linux/interrupt.h>
#include <linux/gpio/consumer.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#define AD7816_FULL …
#define AD7816_PD …
#define AD7816_CS_MASK …
#define AD7816_CS_MAX …
#define AD7816_VALUE_OFFSET …
#define AD7816_BOUND_VALUE_BASE …
#define AD7816_BOUND_VALUE_MIN …
#define AD7816_BOUND_VALUE_MAX …
#define AD7816_TEMP_FLOAT_OFFSET …
#define AD7816_TEMP_FLOAT_MASK …
struct ad7816_chip_info { … };
enum ad7816_type { … };
static int ad7816_spi_read(struct ad7816_chip_info *chip, u16 *data)
{ … }
static int ad7816_spi_write(struct ad7816_chip_info *chip, u8 data)
{ … }
static ssize_t ad7816_show_mode(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t ad7816_store_mode(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static IIO_DEVICE_ATTR(mode, 0644,
ad7816_show_mode,
ad7816_store_mode,
0);
static ssize_t ad7816_show_available_modes(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(available_modes, 0444, ad7816_show_available_modes,
NULL, 0);
static ssize_t ad7816_show_channel(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t ad7816_store_channel(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static IIO_DEVICE_ATTR(channel, 0644,
ad7816_show_channel,
ad7816_store_channel,
0);
static ssize_t ad7816_show_value(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(value, 0444, ad7816_show_value, NULL, 0);
static struct attribute *ad7816_attributes[] = …;
static const struct attribute_group ad7816_attribute_group = …;
#define IIO_EVENT_CODE_AD7816_OTI …
static irqreturn_t ad7816_event_handler(int irq, void *private)
{ … }
static ssize_t ad7816_show_oti(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static inline ssize_t ad7816_set_oti(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static IIO_DEVICE_ATTR(oti, 0644,
ad7816_show_oti, ad7816_set_oti, 0);
static struct attribute *ad7816_event_attributes[] = …;
static const struct attribute_group ad7816_event_attribute_group = …;
static const struct iio_info ad7816_info = …;
static int ad7816_probe(struct spi_device *spi_dev)
{ … }
static const struct of_device_id ad7816_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad7816_of_match);
static const struct spi_device_id ad7816_id[] = …;
MODULE_DEVICE_TABLE(spi, ad7816_id);
static struct spi_driver ad7816_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;