linux/drivers/iio/adc/ti-ads7950.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Texas Instruments ADS7950 SPI ADC driver
 *
 * Copyright 2016 David Lechner <[email protected]>
 *
 * Based on iio/ad7923.c:
 * Copyright 2011 Analog Devices Inc
 * Copyright 2012 CS Systemes d'Information
 *
 * And also on hwmon/ads79xx.c
 * Copyright (C) 2013 Texas Instruments Incorporated - https://www.ti.com/
 *	Nishanth Menon
 */

#include <linux/acpi.h>
#include <linux/bitops.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>

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

/*
 * In case of ACPI, we use the 5000 mV as default for the reference pin.
 * Device tree users encode that via the vref-supply regulator.
 */
#define TI_ADS7950_VA_MV_ACPI_DEFAULT

#define TI_ADS7950_CR_GPIO
#define TI_ADS7950_CR_MANUAL
#define TI_ADS7950_CR_WRITE
#define TI_ADS7950_CR_CHAN(ch)
#define TI_ADS7950_CR_RANGE_5V
#define TI_ADS7950_CR_GPIO_DATA

#define TI_ADS7950_MAX_CHAN
#define TI_ADS7950_NUM_GPIOS

#define TI_ADS7950_TIMESTAMP_SIZE

/* val = value, dec = left shift, bits = number of bits of the mask */
#define TI_ADS7950_EXTRACT(val, dec, bits)

#define TI_ADS7950_MAN_CMD(cmd)
#define TI_ADS7950_GPIO_CMD(cmd)

/* Manual mode configuration */
#define TI_ADS7950_MAN_CMD_SETTINGS(st)
/* GPIO mode configuration */
#define TI_ADS7950_GPIO_CMD_SETTINGS(st)

struct ti_ads7950_state {};

struct ti_ads7950_chip_info {};

enum ti_ads7950_id {};

#define TI_ADS7950_V_CHAN(index, bits)

#define DECLARE_TI_ADS7950_4_CHANNELS(name, bits)

#define DECLARE_TI_ADS7950_8_CHANNELS(name, bits)

#define DECLARE_TI_ADS7950_12_CHANNELS(name, bits)

#define DECLARE_TI_ADS7950_16_CHANNELS(name, bits)

static DECLARE_TI_ADS7950_4_CHANNELS(ti_ads7950, 12);
static DECLARE_TI_ADS7950_8_CHANNELS(ti_ads7951, 12);
static DECLARE_TI_ADS7950_12_CHANNELS(ti_ads7952, 12);
static DECLARE_TI_ADS7950_16_CHANNELS(ti_ads7953, 12);
static DECLARE_TI_ADS7950_4_CHANNELS(ti_ads7954, 10);
static DECLARE_TI_ADS7950_8_CHANNELS(ti_ads7955, 10);
static DECLARE_TI_ADS7950_12_CHANNELS(ti_ads7956, 10);
static DECLARE_TI_ADS7950_16_CHANNELS(ti_ads7957, 10);
static DECLARE_TI_ADS7950_4_CHANNELS(ti_ads7958, 8);
static DECLARE_TI_ADS7950_8_CHANNELS(ti_ads7959, 8);
static DECLARE_TI_ADS7950_12_CHANNELS(ti_ads7960, 8);
static DECLARE_TI_ADS7950_16_CHANNELS(ti_ads7961, 8);

static const struct ti_ads7950_chip_info ti_ads7950_chip_info[] =;

/*
 * ti_ads7950_update_scan_mode() setup the spi transfer buffer for the new
 * scan mask
 */
static int ti_ads7950_update_scan_mode(struct iio_dev *indio_dev,
				       const unsigned long *active_scan_mask)
{}

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

static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch)
{}

static int ti_ads7950_get_range(struct ti_ads7950_state *st)
{}

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

static const struct iio_info ti_ads7950_info =;

static void ti_ads7950_set(struct gpio_chip *chip, unsigned int offset,
			   int value)
{}

static int ti_ads7950_get(struct gpio_chip *chip, unsigned int offset)
{}

static int ti_ads7950_get_direction(struct gpio_chip *chip,
				    unsigned int offset)
{}

static int _ti_ads7950_set_direction(struct gpio_chip *chip, int offset,
				     int input)
{}

static int ti_ads7950_direction_input(struct gpio_chip *chip,
				      unsigned int offset)
{}

static int ti_ads7950_direction_output(struct gpio_chip *chip,
				       unsigned int offset, int value)
{}

static int ti_ads7950_init_hw(struct ti_ads7950_state *st)
{}

static int ti_ads7950_probe(struct spi_device *spi)
{}

static void ti_ads7950_remove(struct spi_device *spi)
{}

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

static const struct of_device_id ads7950_of_table[] =;
MODULE_DEVICE_TABLE(of, ads7950_of_table);

static struct spi_driver ti_ads7950_driver =;
module_spi_driver();

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