#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/crc8.h>
#include <linux/device.h>
#include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/units.h>
#include <linux/unaligned.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#define AD74115_NAME …
#define AD74115_CH_FUNC_SETUP_REG …
#define AD74115_ADC_CONFIG_REG …
#define AD74115_ADC_CONFIG_CONV2_RATE_MASK …
#define AD74115_ADC_CONFIG_CONV1_RATE_MASK …
#define AD74115_ADC_CONFIG_CONV2_RANGE_MASK …
#define AD74115_ADC_CONFIG_CONV1_RANGE_MASK …
#define AD74115_PWR_OPTIM_CONFIG_REG …
#define AD74115_DIN_CONFIG1_REG …
#define AD74115_DIN_COMPARATOR_EN_MASK …
#define AD74115_DIN_SINK_MASK …
#define AD74115_DIN_DEBOUNCE_MASK …
#define AD74115_DIN_CONFIG2_REG …
#define AD74115_COMP_THRESH_MASK …
#define AD74115_OUTPUT_CONFIG_REG …
#define AD74115_OUTPUT_SLEW_EN_MASK …
#define AD74115_OUTPUT_SLEW_LIN_STEP_MASK …
#define AD74115_OUTPUT_SLEW_LIN_RATE_MASK …
#define AD74115_RTD3W4W_CONFIG_REG …
#define AD74115_BURNOUT_CONFIG_REG …
#define AD74115_BURNOUT_EXT2_EN_MASK …
#define AD74115_BURNOUT_EXT1_EN_MASK …
#define AD74115_BURNOUT_VIOUT_EN_MASK …
#define AD74115_DAC_CODE_REG …
#define AD74115_DAC_ACTIVE_REG …
#define AD74115_GPIO_CONFIG_X_REG(x) …
#define AD74115_GPIO_CONFIG_GPI_DATA …
#define AD74115_GPIO_CONFIG_GPO_DATA …
#define AD74115_GPIO_CONFIG_SELECT_MASK …
#define AD74115_CHARGE_PUMP_REG …
#define AD74115_ADC_CONV_CTRL_REG …
#define AD74115_ADC_CONV_SEQ_MASK …
#define AD74115_DIN_COMP_OUT_REG …
#define AD74115_LIVE_STATUS_REG …
#define AD74115_ADC_DATA_RDY_MASK …
#define AD74115_READ_SELECT_REG …
#define AD74115_CMD_KEY_REG …
#define AD74115_CMD_KEY_RESET1 …
#define AD74115_CMD_KEY_RESET2 …
#define AD74115_CRC_POLYNOMIAL …
DECLARE_CRC8_TABLE(ad74115_crc8_table);
#define AD74115_ADC_CODE_MAX …
#define AD74115_ADC_CODE_HALF …
#define AD74115_DAC_VOLTAGE_MAX …
#define AD74115_DAC_CURRENT_MAX …
#define AD74115_DAC_CODE_MAX …
#define AD74115_DAC_CODE_HALF …
#define AD74115_COMP_THRESH_MAX …
#define AD74115_SENSE_RESISTOR_OHMS …
#define AD74115_REF_RESISTOR_OHMS …
#define AD74115_DIN_SINK_LOW_STEP …
#define AD74115_DIN_SINK_HIGH_STEP …
#define AD74115_DIN_SINK_MAX …
#define AD74115_FRAME_SIZE …
#define AD74115_GPIO_NUM …
#define AD74115_CONV_TIME_US …
enum ad74115_dac_ch { … };
enum ad74115_adc_ch { … };
enum ad74115_ch_func { … };
enum ad74115_adc_range { … };
enum ad74115_adc_conv_seq { … };
enum ad74115_din_threshold_mode { … };
enum ad74115_slew_mode { … };
enum ad74115_slew_step { … };
enum ad74115_slew_rate { … };
enum ad74115_gpio_config { … };
enum ad74115_gpio_mode { … };
struct ad74115_channels { … };
struct ad74115_state { … };
struct ad74115_fw_prop { … };
#define AD74115_FW_PROP(_name, _max, _reg, _mask) …
#define AD74115_FW_PROP_TBL(_name, _tbl, _reg, _mask) …
#define AD74115_FW_PROP_BOOL(_name, _reg, _mask) …
#define AD74115_FW_PROP_BOOL_NEG(_name, _reg, _mask) …
static const int ad74115_dac_rate_tbl[] = …;
static const unsigned int ad74115_dac_rate_step_tbl[][3] = …;
static const unsigned int ad74115_rtd_excitation_current_ua_tbl[] = …;
static const unsigned int ad74115_burnout_current_na_tbl[] = …;
static const unsigned int ad74115_viout_burnout_current_na_tbl[] = …;
static const unsigned int ad74115_gpio_mode_tbl[] = …;
static const unsigned int ad74115_adc_conv_rate_tbl[] = …;
static const unsigned int ad74115_debounce_tbl[] = …;
static const unsigned int ad74115_adc_ch_data_regs_tbl[] = …;
static const unsigned int ad74115_adc_ch_en_bit_tbl[] = …;
static const bool ad74115_adc_bipolar_tbl[AD74115_ADC_RANGE_NUM] = …;
static const unsigned int ad74115_adc_conv_mul_tbl[AD74115_ADC_RANGE_NUM] = …;
static const unsigned int ad74115_adc_gain_tbl[AD74115_ADC_RANGE_NUM][2] = …;
static const int ad74115_adc_range_tbl[AD74115_ADC_RANGE_NUM][2] = …;
static int _ad74115_find_tbl_index(const unsigned int *tbl, unsigned int tbl_len,
unsigned int val, unsigned int *index)
{ … }
#define ad74115_find_tbl_index(tbl, val, index) …
static int ad74115_crc(u8 *buf)
{ … }
static void ad74115_format_reg_write(u8 reg, u16 val, u8 *buf)
{ … }
static int ad74115_reg_write(void *context, unsigned int reg, unsigned int val)
{ … }
static int ad74115_crc_check(struct ad74115_state *st, u8 *buf)
{ … }
static int ad74115_reg_read(void *context, unsigned int reg, unsigned int *val)
{ … }
static const struct regmap_config ad74115_regmap_config = …;
static int ad74115_gpio_config_set(struct ad74115_state *st, unsigned int offset,
enum ad74115_gpio_config cfg)
{ … }
static int ad74115_gpio_init_valid_mask(struct gpio_chip *gc,
unsigned long *valid_mask,
unsigned int ngpios)
{ … }
static int ad74115_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
{ … }
static int ad74115_gpio_direction_input(struct gpio_chip *gc, unsigned int offset)
{ … }
static int ad74115_gpio_direction_output(struct gpio_chip *gc, unsigned int offset,
int value)
{ … }
static int ad74115_gpio_get(struct gpio_chip *gc, unsigned int offset)
{ … }
static void ad74115_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
{ … }
static int ad74115_set_comp_debounce(struct ad74115_state *st, unsigned int val)
{ … }
static int ad74115_comp_gpio_get_direction(struct gpio_chip *chip,
unsigned int offset)
{ … }
static int ad74115_comp_gpio_set_config(struct gpio_chip *chip,
unsigned int offset,
unsigned long config)
{ … }
static int ad74115_comp_gpio_get(struct gpio_chip *chip, unsigned int offset)
{ … }
static irqreturn_t ad74115_trigger_handler(int irq, void *p)
{ … }
static irqreturn_t ad74115_adc_data_interrupt(int irq, void *data)
{ … }
static int ad74115_set_adc_ch_en(struct ad74115_state *st,
enum ad74115_adc_ch channel, bool status)
{ … }
static int ad74115_set_adc_conv_seq(struct ad74115_state *st,
enum ad74115_adc_conv_seq conv_seq)
{ … }
static int ad74115_update_scan_mode(struct iio_dev *indio_dev,
const unsigned long *active_scan_mask)
{ … }
static int ad74115_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int ad74115_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops ad74115_buffer_ops = …;
static const struct iio_trigger_ops ad74115_trigger_ops = …;
static int ad74115_get_adc_rate(struct ad74115_state *st,
enum ad74115_adc_ch channel, int *val)
{ … }
static int _ad74115_get_adc_code(struct ad74115_state *st,
enum ad74115_adc_ch channel, int *val)
{ … }
static int ad74115_get_adc_code(struct iio_dev *indio_dev,
enum ad74115_adc_ch channel, int *val)
{ … }
static int ad74115_adc_code_to_resistance(int code, int *val, int *val2)
{ … }
static int ad74115_set_dac_code(struct ad74115_state *st,
enum ad74115_dac_ch channel, int val)
{ … }
static int ad74115_get_dac_code(struct ad74115_state *st,
enum ad74115_dac_ch channel, int *val)
{ … }
static int ad74115_set_adc_rate(struct ad74115_state *st,
enum ad74115_adc_ch channel, int val)
{ … }
static int ad74115_get_dac_rate(struct ad74115_state *st, int *val)
{ … }
static int ad74115_set_dac_rate(struct ad74115_state *st, int val)
{ … }
static int ad74115_get_dac_scale(struct ad74115_state *st,
struct iio_chan_spec const *chan,
int *val, int *val2)
{ … }
static int ad74115_get_dac_offset(struct ad74115_state *st,
struct iio_chan_spec const *chan, int *val)
{ … }
static int ad74115_get_adc_range(struct ad74115_state *st,
enum ad74115_adc_ch channel, unsigned int *val)
{ … }
static int ad74115_get_adc_resistance_scale(struct ad74115_state *st,
unsigned int range,
int *val, int *val2)
{ … }
static int ad74115_get_adc_scale(struct ad74115_state *st,
struct iio_chan_spec const *chan,
int *val, int *val2)
{ … }
static int ad74115_get_adc_resistance_offset(struct ad74115_state *st,
unsigned int range,
int *val, int *val2)
{ … }
static int ad74115_get_adc_offset(struct ad74115_state *st,
struct iio_chan_spec const *chan,
int *val, int *val2)
{ … }
static int ad74115_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long info)
{ … }
static int ad74115_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val, int val2,
long info)
{ … }
static int ad74115_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length, long info)
{ … }
static int ad74115_reg_access(struct iio_dev *indio_dev, unsigned int reg,
unsigned int writeval, unsigned int *readval)
{ … }
static const struct iio_info ad74115_info = …;
#define AD74115_DAC_CHANNEL(_type, index) …
#define _AD74115_ADC_CHANNEL(_type, index, extra_mask_separate) …
#define AD74115_ADC_CHANNEL(_type, index) …
static struct iio_chan_spec ad74115_voltage_input_channels[] = …;
static struct iio_chan_spec ad74115_voltage_output_channels[] = …;
static struct iio_chan_spec ad74115_current_input_channels[] = …;
static struct iio_chan_spec ad74115_current_output_channels[] = …;
static struct iio_chan_spec ad74115_2_wire_resistance_input_channels[] = …;
static struct iio_chan_spec ad74115_3_4_wire_resistance_input_channels[] = …;
static struct iio_chan_spec ad74115_digital_input_logic_channels[] = …;
static struct iio_chan_spec ad74115_digital_input_loop_channels[] = …;
#define _AD74115_CHANNELS(_channels) …
#define AD74115_CHANNELS(name) …
static const struct ad74115_channels ad74115_channels_map[AD74115_CH_FUNC_NUM] = …;
#define AD74115_GPIO_MODE_FW_PROP(i) …
static const struct ad74115_fw_prop ad74115_gpio_mode_fw_props[] = …;
static const struct ad74115_fw_prop ad74115_din_threshold_mode_fw_prop = …;
static const struct ad74115_fw_prop ad74115_dac_bipolar_fw_prop = …;
static const struct ad74115_fw_prop ad74115_ch_func_fw_prop = …;
static const struct ad74115_fw_prop ad74115_rtd_mode_fw_prop = …;
static const struct ad74115_fw_prop ad74115_din_range_fw_prop = …;
static const struct ad74115_fw_prop ad74115_ext2_burnout_current_fw_prop = …;
static const struct ad74115_fw_prop ad74115_ext1_burnout_current_fw_prop = …;
static const struct ad74115_fw_prop ad74115_viout_burnout_current_fw_prop = …;
static const struct ad74115_fw_prop ad74115_fw_props[] = …;
static int ad74115_apply_fw_prop(struct ad74115_state *st,
const struct ad74115_fw_prop *prop, u32 *retval)
{ … }
static int ad74115_setup_adc_conv2_range(struct ad74115_state *st)
{ … }
static int ad74115_setup_iio_channels(struct iio_dev *indio_dev)
{ … }
static int ad74115_setup_gpio_chip(struct ad74115_state *st)
{ … }
static int ad74115_setup_comp_gpio_chip(struct ad74115_state *st)
{ … }
static int ad74115_setup(struct iio_dev *indio_dev)
{ … }
static int ad74115_reset(struct ad74115_state *st)
{ … }
static int ad74115_setup_trigger(struct iio_dev *indio_dev)
{ … }
static int ad74115_probe(struct spi_device *spi)
{ … }
static int ad74115_unregister_driver(struct spi_driver *spi)
{ … }
static int __init ad74115_register_driver(struct spi_driver *spi)
{ … }
static const struct spi_device_id ad74115_spi_id[] = …;
MODULE_DEVICE_TABLE(spi, ad74115_spi_id);
static const struct of_device_id ad74115_dt_id[] = …;
MODULE_DEVICE_TABLE(of, ad74115_dt_id);
static struct spi_driver ad74115_driver = …;
module_driver(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;