linux/drivers/iio/adc/max1027.c

// SPDX-License-Identifier: GPL-2.0-only
 /*
  * iio/adc/max1027.c
  * Copyright (C) 2014 Philippe Reynes
  *
  * based on linux/drivers/iio/ad7923.c
  * Copyright 2011 Analog Devices Inc (from AD7923 Driver)
  * Copyright 2012 CS Systemes d'Information
  *
  * max1027.c
  *
  * Partial support for max1027 and similar chips.
  */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/spi/spi.h>
#include <linux/delay.h>

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

#define MAX1027_CONV_REG
#define MAX1027_SETUP_REG
#define MAX1027_AVG_REG
#define MAX1027_RST_REG

/* conversion register */
#define MAX1027_TEMP
#define MAX1027_SCAN_0_N
#define MAX1027_SCAN_N_M
#define MAX1027_SCAN_N
#define MAX1027_NOSCAN
#define MAX1027_CHAN(n)

/* setup register */
#define MAX1027_UNIPOLAR
#define MAX1027_BIPOLAR
#define MAX1027_REF_MODE0
#define MAX1027_REF_MODE1
#define MAX1027_REF_MODE2
#define MAX1027_REF_MODE3
#define MAX1027_CKS_MODE0
#define MAX1027_CKS_MODE1
#define MAX1027_CKS_MODE2
#define MAX1027_CKS_MODE3

/* averaging register */
#define MAX1027_NSCAN_4
#define MAX1027_NSCAN_8
#define MAX1027_NSCAN_12
#define MAX1027_NSCAN_16
#define MAX1027_NAVG_4
#define MAX1027_NAVG_8
#define MAX1027_NAVG_16
#define MAX1027_NAVG_32
#define MAX1027_AVG_EN

/* Device can achieve 300ksps so we assume a 3.33us conversion delay */
#define MAX1027_CONVERSION_UDELAY

enum max1027_id {};

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

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

#define MAX1027_V_CHAN(index, depth)

#define MAX1027_T_CHAN

#define MAX1X27_CHANNELS(depth)

#define MAX1X29_CHANNELS(depth)

#define MAX1X31_CHANNELS(depth)

static const struct iio_chan_spec max1027_channels[] =;

static const struct iio_chan_spec max1029_channels[] =;

static const struct iio_chan_spec max1031_channels[] =;

static const struct iio_chan_spec max1227_channels[] =;

static const struct iio_chan_spec max1229_channels[] =;

static const struct iio_chan_spec max1231_channels[] =;

/*
 * These devices are able to scan from 0 to N, N being the highest voltage
 * channel requested by the user. The temperature can be included or not,
 * but cannot be retrieved alone. Based on the below
 * ->available_scan_masks, the core will select the most appropriate
 * ->active_scan_mask and the "minimum" number of channels will be
 * scanned and pushed to the buffers.
 *
 * For example, if the user wants channels 1, 4 and 5, all channels from
 * 0 to 5 will be scanned and pushed to the IIO buffers. The core will then
 * filter out the unneeded samples based on the ->active_scan_mask that has
 * been selected and only channels 1, 4 and 5 will be available to the user
 * in the shared buffer.
 */
#define MAX1X27_SCAN_MASK_TEMP

#define MAX1X27_SCAN_MASKS(temp)

#define MAX1X29_SCAN_MASKS(temp)

#define MAX1X31_SCAN_MASKS(temp)

static const unsigned long max1027_available_scan_masks[] =;

static const unsigned long max1029_available_scan_masks[] =;

static const unsigned long max1031_available_scan_masks[] =;

struct max1027_chip_info {};

static const struct max1027_chip_info max1027_chip_info_tbl[] =;

struct max1027_state {};

static int max1027_wait_eoc(struct iio_dev *indio_dev)
{}

/* Scan from chan 0 to the highest requested channel. Include temperature on demand. */
static int max1027_configure_chans_and_start(struct iio_dev *indio_dev)
{}

static int max1027_enable_trigger(struct iio_dev *indio_dev, bool enable)
{}

static int max1027_read_single_value(struct iio_dev *indio_dev,
				     struct iio_chan_spec const *chan,
				     int *val)
{}

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

static int max1027_debugfs_reg_access(struct iio_dev *indio_dev,
				      unsigned int reg, unsigned int writeval,
				      unsigned int *readval)
{}

static int max1027_set_cnvst_trigger_state(struct iio_trigger *trig, bool state)
{}

static int max1027_read_scan(struct iio_dev *indio_dev)
{}

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

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

static const struct iio_trigger_ops max1027_trigger_ops =;

static const struct iio_info max1027_info =;

static int max1027_probe(struct spi_device *spi)
{}

static struct spi_driver max1027_driver =;
module_spi_driver();

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