#include <linux/align.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define MAX_NUM_CHANNELS …
#define AD7380_INTERNAL_REF_MV …
#define AD7380_REG_WR_SPEED_HZ …
#define AD7380_REG_WR …
#define AD7380_REG_REGADDR …
#define AD7380_REG_DATA …
#define AD7380_REG_ADDR_NOP …
#define AD7380_REG_ADDR_CONFIG1 …
#define AD7380_REG_ADDR_CONFIG2 …
#define AD7380_REG_ADDR_ALERT …
#define AD7380_REG_ADDR_ALERT_LOW_TH …
#define AD7380_REG_ADDR_ALERT_HIGH_TH …
#define AD7380_CONFIG1_CH …
#define AD7380_CONFIG1_SEQ …
#define AD7380_CONFIG1_OS_MODE …
#define AD7380_CONFIG1_OSR …
#define AD7380_CONFIG1_CRC_W …
#define AD7380_CONFIG1_CRC_R …
#define AD7380_CONFIG1_ALERTEN …
#define AD7380_CONFIG1_RES …
#define AD7380_CONFIG1_REFSEL …
#define AD7380_CONFIG1_PMODE …
#define AD7380_CONFIG2_SDO2 …
#define AD7380_CONFIG2_SDO …
#define AD7380_CONFIG2_RESET …
#define AD7380_CONFIG2_RESET_SOFT …
#define AD7380_CONFIG2_RESET_HARD …
#define AD7380_ALERT_LOW_TH …
#define AD7380_ALERT_HIGH_TH …
#define T_CONVERT_NS …
#define T_CONVERT_0_NS …
#define T_CONVERT_X_NS …
#define T_POWERUP_US …
struct ad7380_timing_specs { … };
struct ad7380_chip_info { … };
enum { … };
static const struct iio_scan_type ad7380_scan_type_12_u[] = …;
static const struct iio_scan_type ad7380_scan_type_14_s[] = …;
static const struct iio_scan_type ad7380_scan_type_14_u[] = …;
static const struct iio_scan_type ad7380_scan_type_16_s[] = …;
static const struct iio_scan_type ad7380_scan_type_16_u[] = …;
#define AD7380_CHANNEL(index, bits, diff, sign) …
#define DEFINE_AD7380_2_CHANNEL(name, bits, diff, sign) …
#define DEFINE_AD7380_4_CHANNEL(name, bits, diff, sign) …
#define DEFINE_AD7380_8_CHANNEL(name, bits, diff, sign) …
DEFINE_AD7380_2_CHANNEL(…);
DEFINE_AD7380_2_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_2_CHANNEL(…);
DEFINE_AD7380_2_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_4_CHANNEL(…);
DEFINE_AD7380_8_CHANNEL(…);
DEFINE_AD7380_8_CHANNEL(…);
DEFINE_AD7380_8_CHANNEL(…);
static const char * const ad7380_supplies[] = …;
static const char * const ad7380_2_channel_vcm_supplies[] = …;
static const char * const ad7380_4_channel_vcm_supplies[] = …;
static const unsigned long ad7380_2_channel_scan_masks[] = …;
static const unsigned long ad7380_4_channel_scan_masks[] = …;
enum { … };
static const unsigned long ad7380_2x2_channel_scan_masks[] = …;
static const unsigned long ad7380_2x4_channel_scan_masks[] = …;
static const struct ad7380_timing_specs ad7380_timing = …;
static const struct ad7380_timing_specs ad7380_4_timing = …;
static const int ad7380_oversampling_ratios[] = …;
static const struct ad7380_chip_info ad7380_chip_info = …;
static const struct ad7380_chip_info ad7381_chip_info = …;
static const struct ad7380_chip_info ad7383_chip_info = …;
static const struct ad7380_chip_info ad7384_chip_info = …;
static const struct ad7380_chip_info ad7386_chip_info = …;
static const struct ad7380_chip_info ad7387_chip_info = …;
static const struct ad7380_chip_info ad7388_chip_info = …;
static const struct ad7380_chip_info ad7380_4_chip_info = …;
static const struct ad7380_chip_info ad7381_4_chip_info = …;
static const struct ad7380_chip_info ad7383_4_chip_info = …;
static const struct ad7380_chip_info ad7384_4_chip_info = …;
static const struct ad7380_chip_info ad7386_4_chip_info = …;
static const struct ad7380_chip_info ad7387_4_chip_info = …;
static const struct ad7380_chip_info ad7388_4_chip_info = …;
struct ad7380_state { … };
static int ad7380_regmap_reg_write(void *context, unsigned int reg,
unsigned int val)
{ … }
static int ad7380_regmap_reg_read(void *context, unsigned int reg,
unsigned int *val)
{ … }
static const struct regmap_config ad7380_regmap_config = …;
static int ad7380_debugfs_reg_access(struct iio_dev *indio_dev, u32 reg,
u32 writeval, u32 *readval)
{ … }
static int ad7380_set_ch(struct ad7380_state *st, unsigned int ch)
{ … }
static void ad7380_update_xfers(struct ad7380_state *st,
const struct iio_scan_type *scan_type)
{ … }
static int ad7380_triggered_buffer_preenable(struct iio_dev *indio_dev)
{ … }
static int ad7380_triggered_buffer_postdisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops ad7380_buffer_setup_ops = …;
static irqreturn_t ad7380_trigger_handler(int irq, void *p)
{ … }
static int ad7380_read_direct(struct ad7380_state *st, unsigned int scan_index,
const struct iio_scan_type *scan_type, int *val)
{ … }
static int ad7380_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long info)
{ … }
static int ad7380_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long mask)
{ … }
static int ad7380_osr_to_regval(int ratio)
{ … }
static int ad7380_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
{ … }
static int ad7380_get_current_scan_type(const struct iio_dev *indio_dev,
const struct iio_chan_spec *chan)
{ … }
static const struct iio_info ad7380_info = …;
static int ad7380_init(struct ad7380_state *st, bool external_ref_en)
{ … }
static int ad7380_probe(struct spi_device *spi)
{ … }
static const struct of_device_id ad7380_of_match_table[] = …;
static const struct spi_device_id ad7380_id_table[] = …;
MODULE_DEVICE_TABLE(spi, ad7380_id_table);
static struct spi_driver ad7380_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;