#include <asm/unaligned.h>
#include <linux/bitfield.h>
#include <linux/crc8.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/interrupt.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <dt-bindings/iio/addac/adi,ad74413r.h>
#define AD74413R_CRC_POLYNOMIAL …
DECLARE_CRC8_TABLE(ad74413r_crc8_table);
#define AD74413R_CHANNEL_MAX …
#define AD74413R_FRAME_SIZE …
struct ad74413r_chip_info { … };
struct ad74413r_channel_config { … };
struct ad74413r_channels { … };
struct ad74413r_state { … };
#define AD74413R_REG_NOP …
#define AD74413R_REG_CH_FUNC_SETUP_X(x) …
#define AD74413R_CH_FUNC_SETUP_MASK …
#define AD74413R_REG_ADC_CONFIG_X(x) …
#define AD74413R_ADC_CONFIG_RANGE_MASK …
#define AD74413R_ADC_CONFIG_REJECTION_MASK …
#define AD74413R_ADC_CONFIG_CH_200K_TO_GND …
#define AD74413R_ADC_RANGE_10V …
#define AD74413R_ADC_RANGE_2P5V_EXT_POW …
#define AD74413R_ADC_RANGE_2P5V_INT_POW …
#define AD74413R_ADC_RANGE_5V_BI_DIR …
#define AD74413R_ADC_REJECTION_50_60 …
#define AD74413R_ADC_REJECTION_NONE …
#define AD74413R_ADC_REJECTION_50_60_HART …
#define AD74413R_ADC_REJECTION_HART …
#define AD74413R_REG_DIN_CONFIG_X(x) …
#define AD74413R_DIN_DEBOUNCE_MASK …
#define AD74413R_DIN_DEBOUNCE_LEN …
#define AD74413R_DIN_SINK_MASK …
#define AD74413R_REG_DAC_CODE_X(x) …
#define AD74413R_DAC_CODE_MAX …
#define AD74413R_DAC_VOLTAGE_MAX …
#define AD74413R_REG_GPO_PAR_DATA …
#define AD74413R_REG_GPO_CONFIG_X(x) …
#define AD74413R_GPO_CONFIG_DATA_MASK …
#define AD74413R_GPO_CONFIG_SELECT_MASK …
#define AD74413R_GPO_CONFIG_100K_PULL_DOWN …
#define AD74413R_GPO_CONFIG_LOGIC …
#define AD74413R_GPO_CONFIG_LOGIC_PARALLEL …
#define AD74413R_GPO_CONFIG_COMPARATOR …
#define AD74413R_GPO_CONFIG_HIGH_IMPEDANCE …
#define AD74413R_REG_ADC_CONV_CTRL …
#define AD74413R_CONV_SEQ_MASK …
#define AD74413R_CONV_SEQ_ON …
#define AD74413R_CONV_SEQ_SINGLE …
#define AD74413R_CONV_SEQ_CONTINUOUS …
#define AD74413R_CONV_SEQ_OFF …
#define AD74413R_CH_EN_MASK(x) …
#define AD74413R_REG_DIN_COMP_OUT …
#define AD74413R_REG_ADC_RESULT_X(x) …
#define AD74413R_ADC_RESULT_MAX …
#define AD74413R_REG_READ_SELECT …
#define AD74413R_REG_CMD_KEY …
#define AD74413R_CMD_KEY_LDAC …
#define AD74413R_CMD_KEY_RESET1 …
#define AD74413R_CMD_KEY_RESET2 …
static const int ad74413r_adc_sampling_rates[] = …;
static const int ad74413r_adc_sampling_rates_hart[] = …;
static int ad74413r_crc(u8 *buf)
{ … }
static void ad74413r_format_reg_write(u8 reg, u16 val, u8 *buf)
{ … }
static int ad74413r_reg_write(void *context, unsigned int reg, unsigned int val)
{ … }
static int ad74413r_crc_check(struct ad74413r_state *st, u8 *buf)
{ … }
static int ad74413r_reg_read(void *context, unsigned int reg, unsigned int *val)
{ … }
static const struct regmap_config ad74413r_regmap_config = …;
static int ad74413r_set_gpo_config(struct ad74413r_state *st,
unsigned int offset, u8 mode)
{ … }
static const unsigned int ad74413r_debounce_map[AD74413R_DIN_DEBOUNCE_LEN] = …;
static int ad74413r_set_comp_debounce(struct ad74413r_state *st,
unsigned int offset,
unsigned int debounce)
{ … }
static int ad74413r_set_comp_drive_strength(struct ad74413r_state *st,
unsigned int offset,
unsigned int strength)
{ … }
static void ad74413r_gpio_set(struct gpio_chip *chip,
unsigned int offset, int val)
{ … }
static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
unsigned long *mask,
unsigned long *bits)
{ … }
static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset)
{ … }
static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
unsigned long *mask,
unsigned long *bits)
{ … }
static int ad74413r_gpio_get_gpo_direction(struct gpio_chip *chip,
unsigned int offset)
{ … }
static int ad74413r_gpio_get_comp_direction(struct gpio_chip *chip,
unsigned int offset)
{ … }
static int ad74413r_gpio_set_gpo_config(struct gpio_chip *chip,
unsigned int offset,
unsigned long config)
{ … }
static int ad74413r_gpio_set_comp_config(struct gpio_chip *chip,
unsigned int offset,
unsigned long config)
{ … }
static int ad74413r_reset(struct ad74413r_state *st)
{ … }
static int ad74413r_set_channel_dac_code(struct ad74413r_state *st,
unsigned int channel, int dac_code)
{ … }
static int ad74413r_set_channel_function(struct ad74413r_state *st,
unsigned int channel, u8 func)
{ … }
static int ad74413r_set_adc_conv_seq(struct ad74413r_state *st,
unsigned int status)
{ … }
static int ad74413r_set_adc_channel_enable(struct ad74413r_state *st,
unsigned int channel,
bool status)
{ … }
static int ad74413r_get_adc_range(struct ad74413r_state *st,
unsigned int channel,
unsigned int *val)
{ … }
static int ad74413r_get_adc_rejection(struct ad74413r_state *st,
unsigned int channel,
unsigned int *val)
{ … }
static int ad74413r_set_adc_rejection(struct ad74413r_state *st,
unsigned int channel,
unsigned int val)
{ … }
static int ad74413r_rejection_to_rate(struct ad74413r_state *st,
unsigned int rej, int *val)
{ … }
static int ad74413r_rate_to_rejection(struct ad74413r_state *st,
int rate, unsigned int *val)
{ … }
static int ad74413r_range_to_voltage_range(struct ad74413r_state *st,
unsigned int range, int *val)
{ … }
static int ad74413r_range_to_voltage_offset(struct ad74413r_state *st,
unsigned int range, int *val)
{ … }
static int ad74413r_range_to_voltage_offset_raw(struct ad74413r_state *st,
unsigned int range, int *val)
{ … }
static int ad74413r_get_output_voltage_scale(struct ad74413r_state *st,
int *val, int *val2)
{ … }
static int ad74413r_get_output_current_scale(struct ad74413r_state *st,
int *val, int *val2)
{ … }
static int ad74413r_get_input_voltage_scale(struct ad74413r_state *st,
unsigned int channel,
int *val, int *val2)
{ … }
static int ad74413r_get_input_voltage_offset(struct ad74413r_state *st,
unsigned int channel, int *val)
{ … }
static int ad74413r_get_input_current_scale(struct ad74413r_state *st,
unsigned int channel, int *val,
int *val2)
{ … }
static int ad74413r_get_input_current_offset(struct ad74413r_state *st,
unsigned int channel, int *val)
{ … }
static int ad74413r_get_adc_rate(struct ad74413r_state *st,
unsigned int channel, int *val)
{ … }
static int ad74413r_set_adc_rate(struct ad74413r_state *st,
unsigned int channel, int val)
{ … }
static irqreturn_t ad74413r_trigger_handler(int irq, void *p)
{ … }
static irqreturn_t ad74413r_adc_data_interrupt(int irq, void *data)
{ … }
static int _ad74413r_get_single_adc_result(struct ad74413r_state *st,
unsigned int channel, int *val)
{ … }
static int ad74413r_get_single_adc_result(struct iio_dev *indio_dev,
unsigned int channel, int *val)
{ … }
static void ad74413r_adc_to_resistance_result(int adc_result, int *val)
{ … }
static int ad74413r_update_scan_mode(struct iio_dev *indio_dev,
const unsigned long *active_scan_mask)
{ … }
static int ad74413r_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int ad74413r_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static int ad74413r_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val, int *val2, long info)
{ … }
static int ad74413r_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val, int val2, long info)
{ … }
static int ad74413r_read_avail(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
const int **vals, int *type, int *length,
long info)
{ … }
static const struct iio_buffer_setup_ops ad74413r_buffer_ops = …;
static const struct iio_trigger_ops ad74413r_trigger_ops = …;
static const struct iio_info ad74413r_info = …;
#define AD74413R_DAC_CHANNEL(_type, extra_mask_separate) …
#define AD74413R_ADC_CHANNEL(_type, extra_mask_separate) …
#define AD74413R_ADC_VOLTAGE_CHANNEL …
#define AD74413R_ADC_CURRENT_CHANNEL …
static struct iio_chan_spec ad74413r_voltage_output_channels[] = …;
static struct iio_chan_spec ad74413r_current_output_channels[] = …;
static struct iio_chan_spec ad74413r_voltage_input_channels[] = …;
static struct iio_chan_spec ad74413r_current_input_channels[] = …;
static struct iio_chan_spec ad74413r_current_input_loop_channels[] = …;
static struct iio_chan_spec ad74413r_resistance_input_channels[] = …;
static struct iio_chan_spec ad74413r_digital_input_channels[] = …;
#define _AD74413R_CHANNELS(_channels) …
#define AD74413R_CHANNELS(name) …
static const struct ad74413r_channels ad74413r_channels_map[] = …;
static int ad74413r_parse_channel_config(struct iio_dev *indio_dev,
struct fwnode_handle *channel_node)
{ … }
static int ad74413r_parse_channel_configs(struct iio_dev *indio_dev)
{ … }
static int ad74413r_setup_channels(struct iio_dev *indio_dev)
{ … }
static int ad74413r_setup_gpios(struct ad74413r_state *st)
{ … }
static void ad74413r_regulator_disable(void *regulator)
{ … }
static int ad74413r_probe(struct spi_device *spi)
{ … }
static int ad74413r_unregister_driver(struct spi_driver *spi)
{ … }
static int __init ad74413r_register_driver(struct spi_driver *spi)
{ … }
static const struct ad74413r_chip_info ad74412r_chip_info_data = …;
static const struct ad74413r_chip_info ad74413r_chip_info_data = …;
static const struct of_device_id ad74413r_dt_id[] = …;
MODULE_DEVICE_TABLE(of, ad74413r_dt_id);
static const struct spi_device_id ad74413r_spi_id[] = …;
MODULE_DEVICE_TABLE(spi, ad74413r_spi_id);
static struct spi_driver ad74413r_driver = …;
module_driver(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;