linux/drivers/iio/adc/ad7791.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * AD7787/AD7788/AD7789/AD7790/AD7791 SPI ADC driver
 *
 * Copyright 2012 Analog Devices Inc.
 *  Author: Lars-Peter Clausen <[email protected]>
 */

#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/module.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/adc/ad_sigma_delta.h>

#include <linux/platform_data/ad7791.h>

#define AD7791_REG_COMM
#define AD7791_REG_STATUS
#define AD7791_REG_MODE
#define AD7791_REG_FILTER
#define AD7791_REG_DATA

#define AD7791_MODE_CONTINUOUS
#define AD7791_MODE_SINGLE
#define AD7791_MODE_POWERDOWN

#define AD7791_CH_AIN1P_AIN1N
#define AD7791_CH_AIN2
#define AD7791_CH_AIN1N_AIN1N
#define AD7791_CH_AVDD_MONITOR

#define AD7791_FILTER_CLK_DIV_1
#define AD7791_FILTER_CLK_DIV_2
#define AD7791_FILTER_CLK_DIV_4
#define AD7791_FILTER_CLK_DIV_8
#define AD7791_FILTER_CLK_MASK
#define AD7791_FILTER_RATE_120
#define AD7791_FILTER_RATE_100
#define AD7791_FILTER_RATE_33_3
#define AD7791_FILTER_RATE_20
#define AD7791_FILTER_RATE_16_6
#define AD7791_FILTER_RATE_16_7
#define AD7791_FILTER_RATE_13_3
#define AD7791_FILTER_RATE_9_5
#define AD7791_FILTER_RATE_MASK

#define AD7791_MODE_BUFFER
#define AD7791_MODE_UNIPOLAR
#define AD7791_MODE_BURNOUT
#define AD7791_MODE_SEL_MASK
#define AD7791_MODE_SEL(x)

#define __AD7991_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
	_storagebits, _shift, _extend_name, _type, _mask_all)

#define AD7991_SHORTED_CHANNEL(_si, _channel, _address, _bits, \
	_storagebits, _shift)

#define AD7991_CHANNEL(_si, _channel, _address, _bits, \
	_storagebits, _shift)

#define AD7991_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
	_storagebits, _shift)

#define AD7991_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \
	_shift)

#define DECLARE_AD7787_CHANNELS(name, bits, storagebits)

#define DECLARE_AD7791_CHANNELS(name, bits, storagebits)

static DECLARE_AD7787_CHANNELS(ad7787_channels, 24, 32);
static DECLARE_AD7791_CHANNELS(ad7790_channels, 16, 16);
static DECLARE_AD7791_CHANNELS(ad7791_channels, 24, 32);

enum {};

enum ad7791_chip_info_flags {};

struct ad7791_chip_info {};

static const struct ad7791_chip_info ad7791_chip_infos[] =;

struct ad7791_state {};

static const int ad7791_sample_freq_avail[8][2] =;

static struct ad7791_state *ad_sigma_delta_to_ad7791(struct ad_sigma_delta *sd)
{}

static int ad7791_set_channel(struct ad_sigma_delta *sd, unsigned int channel)
{}

static int ad7791_set_mode(struct ad_sigma_delta *sd,
	enum ad_sigma_delta_mode mode)
{}

static const struct ad_sigma_delta_info ad7791_sigma_delta_info =;

static int ad7791_read_raw(struct iio_dev *indio_dev,
	const struct iio_chan_spec *chan, int *val, int *val2, long info)
{}

static int ad7791_write_raw(struct iio_dev *indio_dev,
	struct iio_chan_spec const *chan, int val, int val2, long mask)
{}

static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("120 100 33.3 20 16.7 16.6 13.3 9.5");

static struct attribute *ad7791_attributes[] =;

static const struct attribute_group ad7791_attribute_group =;

static const struct iio_info ad7791_info =;

static const struct iio_info ad7791_no_filter_info =;

static int ad7791_setup(struct ad7791_state *st,
			struct ad7791_platform_data *pdata)
{}

static void ad7791_reg_disable(void *reg)
{}

static int ad7791_probe(struct spi_device *spi)
{}

static const struct spi_device_id ad7791_spi_ids[] =;
MODULE_DEVICE_TABLE(spi, ad7791_spi_ids);

static struct spi_driver ad7791_driver =;
module_spi_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_IMPORT_NS();