#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/iio/iio.h>
#include <linux/iio/driver.h>
#include <linux/iio/sysfs.h>
#define IMX7D_REG_ADC_CH_A_CFG1 …
#define IMX7D_REG_ADC_CH_A_CFG2 …
#define IMX7D_REG_ADC_CH_B_CFG1 …
#define IMX7D_REG_ADC_CH_B_CFG2 …
#define IMX7D_REG_ADC_CH_C_CFG1 …
#define IMX7D_REG_ADC_CH_C_CFG2 …
#define IMX7D_REG_ADC_CH_D_CFG1 …
#define IMX7D_REG_ADC_CH_D_CFG2 …
#define IMX7D_REG_ADC_CH_SW_CFG …
#define IMX7D_REG_ADC_TIMER_UNIT …
#define IMX7D_REG_ADC_DMA_FIFO …
#define IMX7D_REG_ADC_FIFO_STATUS …
#define IMX7D_REG_ADC_INT_SIG_EN …
#define IMX7D_REG_ADC_INT_EN …
#define IMX7D_REG_ADC_INT_STATUS …
#define IMX7D_REG_ADC_CHA_B_CNV_RSLT …
#define IMX7D_REG_ADC_CHC_D_CNV_RSLT …
#define IMX7D_REG_ADC_CH_SW_CNV_RSLT …
#define IMX7D_REG_ADC_DMA_FIFO_DAT …
#define IMX7D_REG_ADC_ADC_CFG …
#define IMX7D_REG_ADC_CHANNEL_CFG2_BASE …
#define IMX7D_EACH_CHANNEL_REG_OFFSET …
#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_EN …
#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SINGLE …
#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_AVG_EN …
#define IMX7D_REG_ADC_CH_CFG1_CHANNEL_SEL(x) …
#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_4 …
#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_8 …
#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_16 …
#define IMX7D_REG_ADC_CH_CFG2_AVG_NUM_32 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_4 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_8 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_16 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_32 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_64 …
#define IMX7D_REG_ADC_TIMER_UNIT_PRE_DIV_128 …
#define IMX7D_REG_ADC_ADC_CFG_ADC_CLK_DOWN …
#define IMX7D_REG_ADC_ADC_CFG_ADC_POWER_DOWN …
#define IMX7D_REG_ADC_ADC_CFG_ADC_EN …
#define IMX7D_REG_ADC_INT_CHA_COV_INT_EN …
#define IMX7D_REG_ADC_INT_CHB_COV_INT_EN …
#define IMX7D_REG_ADC_INT_CHC_COV_INT_EN …
#define IMX7D_REG_ADC_INT_CHD_COV_INT_EN …
#define IMX7D_REG_ADC_INT_CHANNEL_INT_EN …
#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_INT_STATUS …
#define IMX7D_REG_ADC_INT_STATUS_CHANNEL_CONV_TIME_OUT …
#define IMX7D_ADC_TIMEOUT …
#define IMX7D_ADC_INPUT_CLK …
enum imx7d_adc_clk_pre_div { … };
enum imx7d_adc_average_num { … };
struct imx7d_adc_feature { … };
struct imx7d_adc { … };
struct imx7d_adc_analogue_core_clk { … };
#define IMX7D_ADC_ANALOGUE_CLK_CONFIG(_pre_div, _reg_conf) …
static const struct imx7d_adc_analogue_core_clk imx7d_adc_analogue_clk[] = …;
#define IMX7D_ADC_CHAN(_idx) …
static const struct iio_chan_spec imx7d_adc_iio_channels[] = …;
static const u32 imx7d_adc_average_num[] = …;
static void imx7d_adc_feature_config(struct imx7d_adc *info)
{ … }
static void imx7d_adc_sample_rate_set(struct imx7d_adc *info)
{ … }
static void imx7d_adc_hw_init(struct imx7d_adc *info)
{ … }
static void imx7d_adc_channel_set(struct imx7d_adc *info)
{ … }
static u32 imx7d_adc_get_sample_rate(struct imx7d_adc *info)
{ … }
static int imx7d_adc_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long mask)
{ … }
static int imx7d_adc_read_data(struct imx7d_adc *info)
{ … }
static irqreturn_t imx7d_adc_isr(int irq, void *dev_id)
{ … }
static int imx7d_adc_reg_access(struct iio_dev *indio_dev,
unsigned reg, unsigned writeval,
unsigned *readval)
{ … }
static const struct iio_info imx7d_adc_iio_info = …;
static const struct of_device_id imx7d_adc_match[] = …;
MODULE_DEVICE_TABLE(of, imx7d_adc_match);
static void imx7d_adc_power_down(struct imx7d_adc *info)
{ … }
static int imx7d_adc_enable(struct device *dev)
{ … }
static int imx7d_adc_disable(struct device *dev)
{ … }
static void __imx7d_adc_disable(void *data)
{ … }
static int imx7d_adc_probe(struct platform_device *pdev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable,
imx7d_adc_enable);
static struct platform_driver imx7d_adc_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;