#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>
#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] = …;
static const int mcp3422_read_times[4] = …;
static const int mcp3422_sample_rates[4] = …;
static const int mcp3422_sign_extend[4] = …;
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(…) …;