linux/drivers/iio/adc/mcp3422.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * mcp3422.c - driver for the Microchip mcp3421/2/3/4/5/6/7/8 chip family
 *
 * Copyright (C) 2013, Angelo Compagnucci
 * Author: Angelo Compagnucci <[email protected]>
 *
 * Datasheet: http://ww1.microchip.com/downloads/en/devicedoc/22088b.pdf
 *            https://ww1.microchip.com/downloads/en/DeviceDoc/22226a.pdf
 *            https://ww1.microchip.com/downloads/en/DeviceDoc/22072b.pdf
 *
 * This driver exports the value of analog input voltage to sysfs, the
 * voltage unit is nV.
 */

#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/delay.h>
#include <linux/sysfs.h>
#include <linux/unaligned.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

/* Masks */
#define MCP3422_CHANNEL_MASK
#define MCP3422_PGA_MASK
#define MCP3422_SRATE_MASK
#define MCP3422_SRATE_240
#define MCP3422_SRATE_60
#define MCP3422_SRATE_15
#define MCP3422_SRATE_3
#define MCP3422_PGA_1
#define MCP3422_PGA_2
#define MCP3422_PGA_4
#define MCP3422_PGA_8
#define MCP3422_CONT_SAMPLING

#define MCP3422_CHANNEL(config)
#define MCP3422_PGA(config)
#define MCP3422_SAMPLE_RATE(config)

#define MCP3422_CHANNEL_VALUE(value)
#define MCP3422_PGA_VALUE(value)
#define MCP3422_SAMPLE_RATE_VALUE(value)

#define MCP3422_CHAN(_index)

static const int mcp3422_scales[4][4] =;

/* Constant msleep times for data acquisitions */
static const int mcp3422_read_times[4] =;

/* sample rates to integer conversion table */
static const int mcp3422_sample_rates[4] =;

/* sample rates to sign extension table */
static const int mcp3422_sign_extend[4] =;

/* Client data (each client gets its own) */
struct mcp3422 {};

static int mcp3422_update_config(struct mcp3422 *adc, u8 newconfig)
{}

static int mcp3422_read(struct mcp3422 *adc, int *value, u8 *config)
{}

static int mcp3422_read_channel(struct mcp3422 *adc,
				struct iio_chan_spec const *channel, int *value)
{}

static int mcp3422_read_raw(struct iio_dev *iio,
			struct iio_chan_spec const *channel, int *val1,
			int *val2, long mask)
{}

static int mcp3422_write_raw(struct iio_dev *iio,
			struct iio_chan_spec const *channel, int val1,
			int val2, long mask)
{}

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

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

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

static IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO,
		mcp3422_show_samp_freqs, NULL, 0);
static IIO_DEVICE_ATTR(in_voltage_scale_available, S_IRUGO,
		mcp3422_show_scales, NULL, 0);

static struct attribute *mcp3422_attributes[] =;

static const struct attribute_group mcp3422_attribute_group =;

static const struct iio_chan_spec mcp3421_channels[] =;

static const struct iio_chan_spec mcp3422_channels[] =;

static const struct iio_chan_spec mcp3424_channels[] =;

static const struct iio_info mcp3422_info =;

static int mcp3422_probe(struct i2c_client *client)
{}

static const struct i2c_device_id mcp3422_id[] =;
MODULE_DEVICE_TABLE(i2c, mcp3422_id);

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

static struct i2c_driver mcp3422_driver =;
module_i2c_driver();

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