#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/iio/iio.h>
#include <linux/of.h>
#include <linux/iio/machine.h>
#include <linux/iio/driver.h>
#include <linux/iopoll.h>
#include <linux/mfd/ti_am335x_tscadc.h>
#include <linux/iio/buffer.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#define DMA_BUFFER_SIZE …
struct tiadc_dma { … };
struct tiadc_device { … };
static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg)
{ … }
static void tiadc_writel(struct tiadc_device *adc, unsigned int reg,
unsigned int val)
{ … }
static u32 get_adc_step_mask(struct tiadc_device *adc_dev)
{ … }
static u32 get_adc_chan_step_mask(struct tiadc_device *adc_dev,
struct iio_chan_spec const *chan)
{ … }
static u32 get_adc_step_bit(struct tiadc_device *adc_dev, int chan)
{ … }
static int tiadc_wait_idle(struct tiadc_device *adc_dev)
{ … }
static void tiadc_step_config(struct iio_dev *indio_dev)
{ … }
static irqreturn_t tiadc_irq_h(int irq, void *private)
{ … }
static irqreturn_t tiadc_worker_h(int irq, void *private)
{ … }
static void tiadc_dma_rx_complete(void *param)
{ … }
static int tiadc_start_dma(struct iio_dev *indio_dev)
{ … }
static int tiadc_buffer_preenable(struct iio_dev *indio_dev)
{ … }
static int tiadc_buffer_postenable(struct iio_dev *indio_dev)
{ … }
static int tiadc_buffer_predisable(struct iio_dev *indio_dev)
{ … }
static int tiadc_buffer_postdisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops tiadc_buffer_setup_ops = …;
static int tiadc_iio_buffered_hardware_setup(struct device *dev,
struct iio_dev *indio_dev,
irqreturn_t (*pollfunc_bh)(int irq, void *p),
irqreturn_t (*pollfunc_th)(int irq, void *p),
int irq, unsigned long flags,
const struct iio_buffer_setup_ops *setup_ops)
{ … }
static const char * const chan_name_ain[] = …;
static int tiadc_channel_init(struct device *dev, struct iio_dev *indio_dev,
int channels)
{ … }
static int tiadc_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val, int *val2,
long mask)
{ … }
static const struct iio_info tiadc_info = …;
static int tiadc_request_dma(struct platform_device *pdev,
struct tiadc_device *adc_dev)
{ … }
static int tiadc_parse_dt(struct platform_device *pdev,
struct tiadc_device *adc_dev)
{ … }
static int tiadc_probe(struct platform_device *pdev)
{ … }
static void tiadc_remove(struct platform_device *pdev)
{ … }
static int tiadc_suspend(struct device *dev)
{ … }
static int tiadc_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume);
static const struct of_device_id ti_adc_dt_ids[] = …;
MODULE_DEVICE_TABLE(of, ti_adc_dt_ids);
static struct platform_driver tiadc_driver = …;
module_platform_driver(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;