linux/drivers/iio/adc/ad799x.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * iio/adc/ad799x.c
 * Copyright (C) 2010-2011 Michael Hennerich, Analog Devices Inc.
 *
 * based on iio/adc/max1363
 * Copyright (C) 2008-2010 Jonathan Cameron
 *
 * based on linux/drivers/i2c/chips/max123x
 * Copyright (C) 2002-2004 Stefan Eletzhofer
 *
 * based on linux/drivers/acron/char/pcf8583.c
 * Copyright (C) 2000 Russell King
 *
 * ad799x.c
 *
 * Support for ad7991, ad7995, ad7999, ad7992, ad7993, ad7994, ad7997,
 * ad7998 and similar chips.
 */

#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/sysfs.h>
#include <linux/i2c.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/bitops.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>

#define AD799X_CHANNEL_SHIFT

/*
 * AD7991, AD7995 and AD7999 defines
 */

#define AD7991_REF_SEL
#define AD7991_FLTR
#define AD7991_BIT_TRIAL_DELAY
#define AD7991_SAMPLE_DELAY

/*
 * AD7992, AD7993, AD7994, AD7997 and AD7998 defines
 */

#define AD7998_FLTR
#define AD7998_ALERT_EN
#define AD7998_BUSY_ALERT
#define AD7998_BUSY_ALERT_POL

#define AD7998_CONV_RES_REG
#define AD7998_ALERT_STAT_REG
#define AD7998_CONF_REG
#define AD7998_CYCLE_TMR_REG

#define AD7998_DATALOW_REG(x)
#define AD7998_DATAHIGH_REG(x)
#define AD7998_HYST_REG(x)

#define AD7998_CYC_MASK
#define AD7998_CYC_DIS
#define AD7998_CYC_TCONF_32
#define AD7998_CYC_TCONF_64
#define AD7998_CYC_TCONF_128
#define AD7998_CYC_TCONF_256
#define AD7998_CYC_TCONF_512
#define AD7998_CYC_TCONF_1024
#define AD7998_CYC_TCONF_2048

#define AD7998_ALERT_STAT_CLEAR

/*
 * AD7997 and AD7997 defines
 */

#define AD7997_8_READ_SINGLE
#define AD7997_8_READ_SEQUENCE

enum {};

/**
 * struct ad799x_chip_config - chip specific information
 * @channel:		channel specification
 * @default_config:	device default configuration
 * @info:		pointer to iio_info struct
 */
struct ad799x_chip_config {};

/**
 * struct ad799x_chip_info - chip specific information
 * @num_channels:	number of channels
 * @noirq_config:	device configuration w/o IRQ
 * @irq_config:		device configuration w/IRQ
 */
struct ad799x_chip_info {};

struct ad799x_state {};

static int ad799x_write_config(struct ad799x_state *st, u16 val)
{}

static int ad799x_read_config(struct ad799x_state *st)
{}

static int ad799x_update_config(struct ad799x_state *st, u16 config)
{}

static irqreturn_t ad799x_trigger_handler(int irq, void *p)
{}

static int ad799x_update_scan_mode(struct iio_dev *indio_dev,
	const unsigned long *scan_mask)
{}

static int ad799x_scan_direct(struct ad799x_state *st, unsigned int ch)
{}

static int ad799x_read_raw(struct iio_dev *indio_dev,
			   struct iio_chan_spec const *chan,
			   int *val,
			   int *val2,
			   long m)
{}
static const unsigned int ad7998_frequencies[] =;

static ssize_t ad799x_read_frequency(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{}

static ssize_t ad799x_write_frequency(struct device *dev,
					 struct device_attribute *attr,
					 const char *buf,
					 size_t len)
{}

static int ad799x_read_event_config(struct iio_dev *indio_dev,
				    const struct iio_chan_spec *chan,
				    enum iio_event_type type,
				    enum iio_event_direction dir)
{}

static int ad799x_write_event_config(struct iio_dev *indio_dev,
				     const struct iio_chan_spec *chan,
				     enum iio_event_type type,
				     enum iio_event_direction dir,
				     int state)
{}

static unsigned int ad799x_threshold_reg(const struct iio_chan_spec *chan,
					 enum iio_event_direction dir,
					 enum iio_event_info info)
{}

static int ad799x_write_event_value(struct iio_dev *indio_dev,
				    const struct iio_chan_spec *chan,
				    enum iio_event_type type,
				    enum iio_event_direction dir,
				    enum iio_event_info info,
				    int val, int val2)
{}

static int ad799x_read_event_value(struct iio_dev *indio_dev,
				    const struct iio_chan_spec *chan,
				    enum iio_event_type type,
				    enum iio_event_direction dir,
				    enum iio_event_info info,
				    int *val, int *val2)
{}

static irqreturn_t ad799x_event_handler(int irq, void *private)
{}

static IIO_DEV_ATTR_SAMP_FREQ(0644,
			      ad799x_read_frequency,
			      ad799x_write_frequency);
static IIO_CONST_ATTR_SAMP_FREQ_AVAIL("15625 7812 3906 1953 976 488 244 0");

static struct attribute *ad799x_event_attributes[] =;

static const struct attribute_group ad799x_event_attrs_group =;

static const struct iio_info ad7991_info =;

static const struct iio_info ad7993_4_7_8_noirq_info =;

static const struct iio_info ad7993_4_7_8_irq_info =;

static const struct iio_event_spec ad799x_events[] =;

#define _AD799X_CHANNEL(_index, _realbits, _ev_spec, _num_ev_spec)

#define AD799X_CHANNEL(_index, _realbits)

#define AD799X_CHANNEL_WITH_EVENTS(_index, _realbits)

static const struct ad799x_chip_info ad799x_chip_info_tbl[] =;

static int ad799x_probe(struct i2c_client *client)
{}

static void ad799x_remove(struct i2c_client *client)
{}

static int ad799x_suspend(struct device *dev)
{}

static int ad799x_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume);

static const struct i2c_device_id ad799x_id[] =;

MODULE_DEVICE_TABLE(i2c, ad799x_id);

static struct i2c_driver ad799x_driver =;
module_i2c_driver();

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