#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/iio/iio.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/unaligned.h>
#define AD7293_R1B …
#define AD7293_R2B …
#define AD7293_PAGE_ADDR_MSK …
#define AD7293_PAGE(x) …
#define AD7293_REG_NO_OP …
#define AD7293_REG_PAGE_SELECT …
#define AD7293_REG_CONV_CMD …
#define AD7293_REG_RESULT …
#define AD7293_REG_DAC_EN …
#define AD7293_REG_DEVICE_ID …
#define AD7293_REG_SOFT_RESET …
#define AD7293_REG_VIN0 …
#define AD7293_REG_VIN1 …
#define AD7293_REG_VIN2 …
#define AD7293_REG_VIN3 …
#define AD7293_REG_TSENSE_INT …
#define AD7293_REG_TSENSE_D0 …
#define AD7293_REG_TSENSE_D1 …
#define AD7293_REG_ISENSE_0 …
#define AD7293_REG_ISENSE_1 …
#define AD7293_REG_ISENSE_2 …
#define AD7293_REG_ISENSE_3 …
#define AD7293_REG_UNI_VOUT0 …
#define AD7293_REG_UNI_VOUT1 …
#define AD7293_REG_UNI_VOUT2 …
#define AD7293_REG_UNI_VOUT3 …
#define AD7293_REG_BI_VOUT0 …
#define AD7293_REG_BI_VOUT1 …
#define AD7293_REG_BI_VOUT2 …
#define AD7293_REG_BI_VOUT3 …
#define AD7293_REG_DIGITAL_OUT_EN …
#define AD7293_REG_DIGITAL_INOUT_FUNC …
#define AD7293_REG_DIGITAL_FUNC_POL …
#define AD7293_REG_GENERAL …
#define AD7293_REG_VINX_RANGE0 …
#define AD7293_REG_VINX_RANGE1 …
#define AD7293_REG_VINX_DIFF_SE …
#define AD7293_REG_VINX_FILTER …
#define AD7293_REG_BG_EN …
#define AD7293_REG_CONV_DELAY …
#define AD7293_REG_TSENSE_BG_EN …
#define AD7293_REG_ISENSE_BG_EN …
#define AD7293_REG_ISENSE_GAIN …
#define AD7293_REG_DAC_SNOOZE_O …
#define AD7293_REG_DAC_SNOOZE_1 …
#define AD7293_REG_RSX_MON_BG_EN …
#define AD7293_REG_INTEGR_CL …
#define AD7293_REG_PA_ON_CTRL …
#define AD7293_REG_RAMP_TIME_0 …
#define AD7293_REG_RAMP_TIME_1 …
#define AD7293_REG_RAMP_TIME_2 …
#define AD7293_REG_RAMP_TIME_3 …
#define AD7293_REG_CL_FR_IT …
#define AD7293_REG_INTX_AVSS_AVDD …
#define AD7293_REG_VINX_SEQ …
#define AD7293_REG_ISENSEX_TSENSEX_SEQ …
#define AD7293_REG_RSX_MON_BI_VOUTX_SEQ …
#define AD7293_REG_VIN0_OFFSET …
#define AD7293_REG_VIN1_OFFSET …
#define AD7293_REG_VIN2_OFFSET …
#define AD7293_REG_VIN3_OFFSET …
#define AD7293_REG_TSENSE_INT_OFFSET …
#define AD7293_REG_TSENSE_D0_OFFSET …
#define AD7293_REG_TSENSE_D1_OFFSET …
#define AD7293_REG_ISENSE0_OFFSET …
#define AD7293_REG_ISENSE1_OFFSET …
#define AD7293_REG_ISENSE2_OFFSET …
#define AD7293_REG_ISENSE3_OFFSET …
#define AD7293_REG_UNI_VOUT0_OFFSET …
#define AD7293_REG_UNI_VOUT1_OFFSET …
#define AD7293_REG_UNI_VOUT2_OFFSET …
#define AD7293_REG_UNI_VOUT3_OFFSET …
#define AD7293_REG_BI_VOUT0_OFFSET …
#define AD7293_REG_BI_VOUT1_OFFSET …
#define AD7293_REG_BI_VOUT2_OFFSET …
#define AD7293_REG_BI_VOUT3_OFFSET …
#define AD7293_READ …
#define AD7293_TRANSF_LEN_MSK …
#define AD7293_REG_ADDR_MSK …
#define AD7293_REG_VOUT_OFFSET_MSK …
#define AD7293_REG_DATA_RAW_MSK …
#define AD7293_REG_VINX_RANGE_GET_CH_MSK(x, ch) …
#define AD7293_REG_VINX_RANGE_SET_CH_MSK(x, ch) …
#define AD7293_CHIP_ID …
enum ad7293_ch_type { … };
enum ad7293_max_offset { … };
static const int dac_offset_table[] = …;
static const int isense_gain_table[] = …;
static const int adc_range_table[] = …;
struct ad7293_state { … };
static int ad7293_page_select(struct ad7293_state *st, unsigned int reg)
{ … }
static int __ad7293_spi_read(struct ad7293_state *st, unsigned int reg,
u16 *val)
{ … }
static int ad7293_spi_read(struct ad7293_state *st, unsigned int reg,
u16 *val)
{ … }
static int __ad7293_spi_write(struct ad7293_state *st, unsigned int reg,
u16 val)
{ … }
static int ad7293_spi_write(struct ad7293_state *st, unsigned int reg,
u16 val)
{ … }
static int __ad7293_spi_update_bits(struct ad7293_state *st, unsigned int reg,
u16 mask, u16 val)
{ … }
static int ad7293_spi_update_bits(struct ad7293_state *st, unsigned int reg,
u16 mask, u16 val)
{ … }
static int ad7293_adc_get_scale(struct ad7293_state *st, unsigned int ch,
u16 *range)
{ … }
static int ad7293_adc_set_scale(struct ad7293_state *st, unsigned int ch,
u16 range)
{ … }
static int ad7293_get_offset(struct ad7293_state *st, unsigned int ch,
u16 *offset)
{ … }
static int ad7293_set_offset(struct ad7293_state *st, unsigned int ch,
u16 offset)
{ … }
static int ad7293_isense_set_scale(struct ad7293_state *st, unsigned int ch,
u16 gain)
{ … }
static int ad7293_isense_get_scale(struct ad7293_state *st, unsigned int ch,
u16 *gain)
{ … }
static int ad7293_dac_write_raw(struct ad7293_state *st, unsigned int ch,
u16 raw)
{ … }
static int ad7293_ch_read_raw(struct ad7293_state *st, enum ad7293_ch_type type,
unsigned int ch, u16 *raw)
{ … }
static int ad7293_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long info)
{ … }
static int ad7293_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long info)
{ … }
static int ad7293_reg_access(struct iio_dev *indio_dev,
unsigned int reg,
unsigned int write_val,
unsigned int *read_val)
{ … }
static int ad7293_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long info)
{ … }
#define AD7293_CHAN_ADC(_channel) …
#define AD7293_CHAN_DAC(_channel) …
#define AD7293_CHAN_ISENSE(_channel) …
#define AD7293_CHAN_TEMP(_channel) …
static const struct iio_chan_spec ad7293_channels[] = …;
static int ad7293_soft_reset(struct ad7293_state *st)
{ … }
static int ad7293_reset(struct ad7293_state *st)
{ … }
static int ad7293_properties_parse(struct ad7293_state *st)
{ … }
static void ad7293_reg_disable(void *data)
{ … }
static int ad7293_init(struct ad7293_state *st)
{ … }
static const struct iio_info ad7293_info = …;
static int ad7293_probe(struct spi_device *spi)
{ … }
static const struct spi_device_id ad7293_id[] = …;
MODULE_DEVICE_TABLE(spi, ad7293_id);
static const struct of_device_id ad7293_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad7293_of_match);
static struct spi_driver ad7293_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;