#include <linux/device.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#define AD5380_REG_DATA(x) …
#define AD5380_REG_OFFSET(x) …
#define AD5380_REG_GAIN(x) …
#define AD5380_REG_SF_PWR_DOWN …
#define AD5380_REG_SF_PWR_UP …
#define AD5380_REG_SF_CTRL …
#define AD5380_CTRL_PWR_DOWN_MODE_OFFSET …
#define AD5380_CTRL_INT_VREF_2V5 …
#define AD5380_CTRL_INT_VREF_EN …
struct ad5380_chip_info { … };
struct ad5380_state { … };
enum ad5380_type { … };
static ssize_t ad5380_read_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, char *buf)
{ … }
static ssize_t ad5380_write_dac_powerdown(struct iio_dev *indio_dev,
uintptr_t private, const struct iio_chan_spec *chan, const char *buf,
size_t len)
{ … }
static const char * const ad5380_powerdown_modes[] = …;
static int ad5380_get_powerdown_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static int ad5380_set_powerdown_mode(struct iio_dev *indio_dev,
const struct iio_chan_spec *chan, unsigned int mode)
{ … }
static const struct iio_enum ad5380_powerdown_mode_enum = …;
static unsigned int ad5380_info_to_reg(struct iio_chan_spec const *chan,
long info)
{ … }
static int ad5380_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val, int val2, long info)
{ … }
static int ad5380_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2, long info)
{ … }
static const struct iio_info ad5380_info = …;
static const struct iio_chan_spec_ext_info ad5380_ext_info[] = …;
#define AD5380_CHANNEL(_bits) …
static const struct ad5380_chip_info ad5380_chip_info_tbl[] = …;
static int ad5380_alloc_channels(struct iio_dev *indio_dev)
{ … }
static int ad5380_probe(struct device *dev, struct regmap *regmap,
enum ad5380_type type, const char *name)
{ … }
static void ad5380_remove(struct device *dev)
{ … }
static bool ad5380_reg_false(struct device *dev, unsigned int reg)
{ … }
static const struct regmap_config ad5380_regmap_config = …;
#if IS_ENABLED(CONFIG_SPI_MASTER)
static int ad5380_spi_probe(struct spi_device *spi)
{ … }
static void ad5380_spi_remove(struct spi_device *spi)
{ … }
static const struct spi_device_id ad5380_spi_ids[] = …;
MODULE_DEVICE_TABLE(spi, ad5380_spi_ids);
static struct spi_driver ad5380_spi_driver = …;
static inline int ad5380_spi_register_driver(void)
{ … }
static inline void ad5380_spi_unregister_driver(void)
{ … }
#else
static inline int ad5380_spi_register_driver(void)
{
return 0;
}
static inline void ad5380_spi_unregister_driver(void)
{
}
#endif
#if IS_ENABLED(CONFIG_I2C)
static int ad5380_i2c_probe(struct i2c_client *i2c)
{ … }
static void ad5380_i2c_remove(struct i2c_client *i2c)
{ … }
static const struct i2c_device_id ad5380_i2c_ids[] = …;
MODULE_DEVICE_TABLE(i2c, ad5380_i2c_ids);
static struct i2c_driver ad5380_i2c_driver = …;
static inline int ad5380_i2c_register_driver(void)
{ … }
static inline void ad5380_i2c_unregister_driver(void)
{ … }
#else
static inline int ad5380_i2c_register_driver(void)
{
return 0;
}
static inline void ad5380_i2c_unregister_driver(void)
{
}
#endif
static int __init ad5380_spi_init(void)
{ … }
module_init(…) …;
static void __exit ad5380_spi_exit(void)
{ … }
module_exit(ad5380_spi_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;