#include <linux/bits.h>
#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <asm/unaligned.h>
#define MT6360_REG_PMUCHGCTRL3 …
#define MT6360_REG_PMUADCCFG …
#define MT6360_REG_PMUADCIDLET …
#define MT6360_REG_PMUADCRPT1 …
#define MT6360_AICR_MASK …
#define MT6360_AICR_SHFT …
#define MT6360_AICR_400MA …
#define MT6360_ADCEN_MASK …
#define MT6360_PREFERCH_MASK …
#define MT6360_PREFERCH_SHFT …
#define MT6360_RPTCH_MASK …
#define MT6360_NO_PREFER …
#define ADC_WAIT_TIME_MS …
#define ADC_CONV_TIMEOUT_MS …
#define ADC_LOOP_TIME_US …
enum { … };
struct mt6360_adc_data { … };
static int mt6360_adc_read_channel(struct mt6360_adc_data *mad, int channel, int *val)
{ … }
static int mt6360_adc_read_scale(struct mt6360_adc_data *mad, int channel, int *val, int *val2)
{ … }
static int mt6360_adc_read_offset(struct mt6360_adc_data *mad, int channel, int *val)
{ … }
static int mt6360_adc_read_raw(struct iio_dev *iio_dev, const struct iio_chan_spec *chan,
int *val, int *val2, long mask)
{ … }
static const char *mt6360_channel_labels[MT6360_CHAN_MAX] = …;
static int mt6360_adc_read_label(struct iio_dev *iio_dev, const struct iio_chan_spec *chan,
char *label)
{ … }
static const struct iio_info mt6360_adc_iio_info = …;
#define MT6360_ADC_CHAN(_idx, _type) …
static const struct iio_chan_spec mt6360_adc_channels[] = …;
static irqreturn_t mt6360_adc_trigger_handler(int irq, void *p)
{ … }
static inline int mt6360_adc_reset(struct mt6360_adc_data *info)
{ … }
static int mt6360_adc_probe(struct platform_device *pdev)
{ … }
static const struct of_device_id mt6360_adc_of_id[] = …;
MODULE_DEVICE_TABLE(of, mt6360_adc_of_id);
static struct platform_driver mt6360_adc_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;