#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/regulator/consumer.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/dac/ad5504.h>
#define AD5504_RES_MASK …
#define AD5504_CMD_READ …
#define AD5504_CMD_WRITE …
#define AD5504_ADDR(addr) …
#define AD5504_ADDR_NOOP …
#define AD5504_ADDR_DAC(x) …
#define AD5504_ADDR_ALL_DAC …
#define AD5504_ADDR_CTRL …
#define AD5504_DAC_PWR(ch) …
#define AD5504_DAC_PWRDWN_MODE(mode) …
#define AD5504_DAC_PWRDN_20K …
#define AD5504_DAC_PWRDN_3STATE …
struct ad5504_state { … };
enum ad5504_supported_device_ids { … };
static int ad5504_spi_write(struct ad5504_state *st, u8 addr, u16 val)
{ … }
static int ad5504_spi_read(struct ad5504_state *st, u8 addr)
{ … }
static int ad5504_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{ … }
static int ad5504_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
int val2,
long mask)
{ … }
static const char * const ad5504_powerdown_modes[] = …;
static int ad5504_get_powerdown_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static int ad5504_set_powerdown_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int mode)
{ … }
static const struct iio_enum ad5504_powerdown_mode_enum = …;
static ssize_t ad5504_read_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, char *buf)
{ … }
static ssize_t ad5504_write_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
size_t len)
{ … }
static IIO_CONST_ATTR(temp0_thresh_rising_value, "110000");
static IIO_CONST_ATTR(temp0_thresh_rising_en, "1");
static struct attribute *ad5504_ev_attributes[] = …;
static const struct attribute_group ad5504_ev_attribute_group = …;
static irqreturn_t ad5504_event_handler(int irq, void *private)
{ … }
static const struct iio_info ad5504_info = …;
static const struct iio_chan_spec_ext_info ad5504_ext_info[] = …;
#define AD5504_CHANNEL(_chan) …
static const struct iio_chan_spec ad5504_channels[] = …;
static int ad5504_probe(struct spi_device *spi)
{ … }
static void ad5504_remove(struct spi_device *spi)
{ … }
static const struct spi_device_id ad5504_id[] = …;
MODULE_DEVICE_TABLE(spi, ad5504_id);
static struct spi_driver ad5504_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;