#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/completion.h>
#include <linux/clk.h>
#include <linux/property.h>
#include <linux/spi/spi.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/regulator/consumer.h>
#define ADC12138_MODE_AUTO_CAL …
#define ADC12138_MODE_READ_STATUS …
#define ADC12138_MODE_ACQUISITION_TIME_6 …
#define ADC12138_MODE_ACQUISITION_TIME_10 …
#define ADC12138_MODE_ACQUISITION_TIME_18 …
#define ADC12138_MODE_ACQUISITION_TIME_34 …
#define ADC12138_STATUS_CAL …
enum { … };
struct adc12138 { … };
#define ADC12138_VOLTAGE_CHANNEL(chan) …
#define ADC12138_VOLTAGE_CHANNEL_DIFF(chan1, chan2, si) …
static const struct iio_chan_spec adc12132_channels[] = …;
static const struct iio_chan_spec adc12138_channels[] = …;
static int adc12138_mode_programming(struct adc12138 *adc, u8 mode,
void *rx_buf, int len)
{ … }
static int adc12138_read_status(struct adc12138 *adc)
{ … }
static int __adc12138_start_conv(struct adc12138 *adc,
struct iio_chan_spec const *channel,
void *data, int len)
{ … }
static int adc12138_start_conv(struct adc12138 *adc,
struct iio_chan_spec const *channel)
{ … }
static int adc12138_start_and_read_conv(struct adc12138 *adc,
struct iio_chan_spec const *channel,
__be16 *data)
{ … }
static int adc12138_read_conv_data(struct adc12138 *adc, __be16 *value)
{ … }
static int adc12138_wait_eoc(struct adc12138 *adc, unsigned long timeout)
{ … }
static int adc12138_adc_conversion(struct adc12138 *adc,
struct iio_chan_spec const *channel,
__be16 *value)
{ … }
static int adc12138_read_raw(struct iio_dev *iio,
struct iio_chan_spec const *channel, int *value,
int *shift, long mask)
{ … }
static const struct iio_info adc12138_info = …;
static int adc12138_init(struct adc12138 *adc)
{ … }
static irqreturn_t adc12138_trigger_handler(int irq, void *p)
{ … }
static irqreturn_t adc12138_eoc_handler(int irq, void *p)
{ … }
static int adc12138_probe(struct spi_device *spi)
{ … }
static void adc12138_remove(struct spi_device *spi)
{ … }
static const struct of_device_id adc12138_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, adc12138_dt_ids);
static const struct spi_device_id adc12138_id[] = …;
MODULE_DEVICE_TABLE(spi, adc12138_id);
static struct spi_driver adc12138_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;