#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/iio/iio.h>
#include <linux/iio/adc/ad_sigma_delta.h>
#include <linux/iio/sysfs.h>
#define AD7124_COMMS …
#define AD7124_STATUS …
#define AD7124_ADC_CONTROL …
#define AD7124_DATA …
#define AD7124_IO_CONTROL_1 …
#define AD7124_IO_CONTROL_2 …
#define AD7124_ID …
#define AD7124_ERROR …
#define AD7124_ERROR_EN …
#define AD7124_MCLK_COUNT …
#define AD7124_CHANNEL(x) …
#define AD7124_CONFIG(x) …
#define AD7124_FILTER(x) …
#define AD7124_OFFSET(x) …
#define AD7124_GAIN(x) …
#define AD7124_STATUS_POR_FLAG_MSK …
#define AD7124_ADC_STATUS_EN_MSK …
#define AD7124_ADC_STATUS_EN(x) …
#define AD7124_ADC_CTRL_REF_EN_MSK …
#define AD7124_ADC_CTRL_REF_EN(x) …
#define AD7124_ADC_CTRL_PWR_MSK …
#define AD7124_ADC_CTRL_PWR(x) …
#define AD7124_ADC_CTRL_MODE_MSK …
#define AD7124_ADC_CTRL_MODE(x) …
#define AD7124_DEVICE_ID_MSK …
#define AD7124_DEVICE_ID_GET(x) …
#define AD7124_SILICON_REV_MSK …
#define AD7124_SILICON_REV_GET(x) …
#define CHIPID_AD7124_4 …
#define CHIPID_AD7124_8 …
#define AD7124_CHANNEL_EN_MSK …
#define AD7124_CHANNEL_EN(x) …
#define AD7124_CHANNEL_SETUP_MSK …
#define AD7124_CHANNEL_SETUP(x) …
#define AD7124_CHANNEL_AINP_MSK …
#define AD7124_CHANNEL_AINP(x) …
#define AD7124_CHANNEL_AINM_MSK …
#define AD7124_CHANNEL_AINM(x) …
#define AD7124_CONFIG_BIPOLAR_MSK …
#define AD7124_CONFIG_BIPOLAR(x) …
#define AD7124_CONFIG_REF_SEL_MSK …
#define AD7124_CONFIG_REF_SEL(x) …
#define AD7124_CONFIG_PGA_MSK …
#define AD7124_CONFIG_PGA(x) …
#define AD7124_CONFIG_IN_BUFF_MSK …
#define AD7124_CONFIG_IN_BUFF(x) …
#define AD7124_FILTER_FS_MSK …
#define AD7124_FILTER_FS(x) …
#define AD7124_FILTER_TYPE_MSK …
#define AD7124_FILTER_TYPE_SEL(x) …
#define AD7124_SINC3_FILTER …
#define AD7124_SINC4_FILTER …
#define AD7124_CONF_ADDR_OFFSET …
#define AD7124_MAX_CONFIGS …
#define AD7124_MAX_CHANNELS …
enum ad7124_ids { … };
enum ad7124_ref_sel { … };
enum ad7124_power_mode { … };
static const unsigned int ad7124_gain[8] = …;
static const unsigned int ad7124_reg_size[] = …;
static const int ad7124_master_clk_freq_hz[3] = …;
static const char * const ad7124_ref_names[] = …;
struct ad7124_chip_info { … };
struct ad7124_channel_config { … };
struct ad7124_channel { … };
struct ad7124_state { … };
static const struct iio_chan_spec ad7124_channel_template = …;
static struct ad7124_chip_info ad7124_chip_info_tbl[] = …;
static int ad7124_find_closest_match(const int *array,
unsigned int size, int val)
{ … }
static int ad7124_spi_write_mask(struct ad7124_state *st,
unsigned int addr,
unsigned long mask,
unsigned int val,
unsigned int bytes)
{ … }
static int ad7124_set_mode(struct ad_sigma_delta *sd,
enum ad_sigma_delta_mode mode)
{ … }
static void ad7124_set_channel_odr(struct ad7124_state *st, unsigned int channel, unsigned int odr)
{ … }
static int ad7124_get_3db_filter_freq(struct ad7124_state *st,
unsigned int channel)
{ … }
static void ad7124_set_3db_filter_freq(struct ad7124_state *st, unsigned int channel,
unsigned int freq)
{ … }
static struct ad7124_channel_config *ad7124_find_similar_live_cfg(struct ad7124_state *st,
struct ad7124_channel_config *cfg)
{ … }
static int ad7124_find_free_config_slot(struct ad7124_state *st)
{ … }
static int ad7124_init_config_vref(struct ad7124_state *st, struct ad7124_channel_config *cfg)
{ … }
static int ad7124_write_config(struct ad7124_state *st, struct ad7124_channel_config *cfg,
unsigned int cfg_slot)
{ … }
static struct ad7124_channel_config *ad7124_pop_config(struct ad7124_state *st)
{ … }
static int ad7124_push_config(struct ad7124_state *st, struct ad7124_channel_config *cfg)
{ … }
static int ad7124_enable_channel(struct ad7124_state *st, struct ad7124_channel *ch)
{ … }
static int ad7124_prepare_read(struct ad7124_state *st, int address)
{ … }
static int __ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int channel)
{ … }
static int ad7124_set_channel(struct ad_sigma_delta *sd, unsigned int channel)
{ … }
static int ad7124_append_status(struct ad_sigma_delta *sd, bool append)
{ … }
static int ad7124_disable_all(struct ad_sigma_delta *sd)
{ … }
static int ad7124_disable_one(struct ad_sigma_delta *sd, unsigned int chan)
{ … }
static const struct ad_sigma_delta_info ad7124_sigma_delta_info = …;
static int ad7124_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long info)
{ … }
static int ad7124_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long info)
{ … }
static int ad7124_reg_access(struct iio_dev *indio_dev,
unsigned int reg,
unsigned int writeval,
unsigned int *readval)
{ … }
static IIO_CONST_ATTR(in_voltage_scale_available,
"0.000001164 0.000002328 0.000004656 0.000009313 0.000018626 0.000037252 0.000074505 0.000149011 0.000298023");
static struct attribute *ad7124_attributes[] = …;
static const struct attribute_group ad7124_attrs_group = …;
static int ad7124_update_scan_mode(struct iio_dev *indio_dev,
const unsigned long *scan_mask)
{ … }
static const struct iio_info ad7124_info = …;
static int ad7124_soft_reset(struct ad7124_state *st)
{ … }
static int ad7124_check_chip_id(struct ad7124_state *st)
{ … }
static int ad7124_parse_channel_config(struct iio_dev *indio_dev,
struct device *dev)
{ … }
static int ad7124_setup(struct ad7124_state *st)
{ … }
static void ad7124_reg_disable(void *r)
{ … }
static int ad7124_probe(struct spi_device *spi)
{ … }
static const struct of_device_id ad7124_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad7124_of_match);
static const struct spi_device_id ad71124_ids[] = …;
MODULE_DEVICE_TABLE(spi, ad71124_ids);
static struct spi_driver ad71124_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_IMPORT_NS(…);