linux/drivers/iio/adc/at91_adc.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Driver for the ADC present in the Atmel AT91 evaluation boards.
 *
 * Copyright 2011 Free Electrons
 */

#include <linux/bitmap.h>
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/wait.h>

#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/pinctrl/consumer.h>

/* Registers */
#define AT91_ADC_CR
#define AT91_ADC_SWRST
#define AT91_ADC_START

#define AT91_ADC_MR
#define AT91_ADC_TSAMOD
#define AT91_ADC_TSAMOD_ADC_ONLY_MODE
#define AT91_ADC_TSAMOD_TS_ONLY_MODE
#define AT91_ADC_TRGEN
#define AT91_ADC_TRGSEL
#define AT91_ADC_TRGSEL_TC0
#define AT91_ADC_TRGSEL_TC1
#define AT91_ADC_TRGSEL_TC2
#define AT91_ADC_TRGSEL_EXTERNAL
#define AT91_ADC_LOWRES
#define AT91_ADC_SLEEP
#define AT91_ADC_PENDET
#define AT91_ADC_PRESCAL_9260
#define AT91_ADC_PRESCAL_9G45
#define AT91_ADC_PRESCAL_(x)
#define AT91_ADC_STARTUP_9260
#define AT91_ADC_STARTUP_9G45
#define AT91_ADC_STARTUP_9X5
#define AT91_ADC_STARTUP_(x)
#define AT91_ADC_SHTIM
#define AT91_ADC_SHTIM_(x)
#define AT91_ADC_PENDBC
#define AT91_ADC_PENDBC_(x)

#define AT91_ADC_TSR
#define AT91_ADC_TSR_SHTIM
#define AT91_ADC_TSR_SHTIM_(x)

#define AT91_ADC_CHER
#define AT91_ADC_CHDR
#define AT91_ADC_CHSR
#define AT91_ADC_CH(n)

#define AT91_ADC_SR
#define AT91_ADC_EOC(n)
#define AT91_ADC_OVRE(n)
#define AT91_ADC_DRDY
#define AT91_ADC_GOVRE
#define AT91_ADC_ENDRX
#define AT91_ADC_RXFUFF

#define AT91_ADC_SR_9X5
#define AT91_ADC_SR_DRDY_9X5

#define AT91_ADC_LCDR
#define AT91_ADC_LDATA

#define AT91_ADC_IER
#define AT91_ADC_IDR
#define AT91_ADC_IMR
#define AT91RL_ADC_IER_PEN
#define AT91RL_ADC_IER_NOPEN
#define AT91_ADC_IER_PEN
#define AT91_ADC_IER_NOPEN
#define AT91_ADC_IER_XRDY
#define AT91_ADC_IER_YRDY
#define AT91_ADC_IER_PRDY
#define AT91_ADC_ISR_PENS

#define AT91_ADC_CHR(n)
#define AT91_ADC_DATA

#define AT91_ADC_CDR0_9X5

#define AT91_ADC_ACR
#define AT91_ADC_ACR_PENDETSENS

#define AT91_ADC_TSMR
#define AT91_ADC_TSMR_TSMODE
#define AT91_ADC_TSMR_TSMODE_NONE
#define AT91_ADC_TSMR_TSMODE_4WIRE_NO_PRESS
#define AT91_ADC_TSMR_TSMODE_4WIRE_PRESS
#define AT91_ADC_TSMR_TSMODE_5WIRE
#define AT91_ADC_TSMR_TSAV
#define AT91_ADC_TSMR_TSAV_(x)
#define AT91_ADC_TSMR_SCTIM
#define AT91_ADC_TSMR_SCTIM_(x)
#define AT91_ADC_TSMR_PENDBC
#define AT91_ADC_TSMR_PENDBC_(x)
#define AT91_ADC_TSMR_NOTSDMA
#define AT91_ADC_TSMR_PENDET_DIS
#define AT91_ADC_TSMR_PENDET_ENA

#define AT91_ADC_TSXPOSR
#define AT91_ADC_TSYPOSR
#define AT91_ADC_TSPRESSR

#define AT91_ADC_TRGR_9260
#define AT91_ADC_TRGR_9G45
#define AT91_ADC_TRGR_9X5

/* Trigger Register bit field */
#define AT91_ADC_TRGR_TRGPER
#define AT91_ADC_TRGR_TRGPER_(x)
#define AT91_ADC_TRGR_TRGMOD
#define AT91_ADC_TRGR_NONE
#define AT91_ADC_TRGR_MOD_PERIOD_TRIG

#define AT91_ADC_CHAN(st, ch)
#define at91_adc_readl(st, reg)
#define at91_adc_writel(st, reg, val)

#define DRIVER_NAME
#define MAX_POS_BITS

#define TOUCH_SAMPLE_PERIOD_US
#define TOUCH_PEN_DETECT_DEBOUNCE_US

#define MAX_RLPOS_BITS
#define TOUCH_SAMPLE_PERIOD_US_RL
#define TOUCH_SHTIM
#define TOUCH_SCTIM_US

enum atmel_adc_ts_type {};

/**
 * struct at91_adc_trigger - description of triggers
 * @name:		name of the trigger advertised to the user
 * @value:		value to set in the ADC's trigger setup register
 *			to enable the trigger
 * @is_external:	Does the trigger rely on an external pin?
 */
struct at91_adc_trigger {};

/**
 * struct at91_adc_reg_desc - Various informations relative to registers
 * @channel_base:	Base offset for the channel data registers
 * @drdy_mask:		Mask of the DRDY field in the relevant registers
 *			(Interruptions registers mostly)
 * @status_register:	Offset of the Interrupt Status Register
 * @trigger_register:	Offset of the Trigger setup register
 * @mr_prescal_mask:	Mask of the PRESCAL field in the adc MR register
 * @mr_startup_mask:	Mask of the STARTUP field in the adc MR register
 */
struct at91_adc_reg_desc {};

struct at91_adc_caps {};

struct at91_adc_state {};

static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
{}

/* Handler for classic adc channel eoc trigger */
static void handle_adc_eoc_trigger(int irq, struct iio_dev *idev)
{}

static int at91_ts_sample(struct iio_dev *idev)
{}

static irqreturn_t at91_adc_rl_interrupt(int irq, void *private)
{}

static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private)
{}

static int at91_adc_channel_init(struct iio_dev *idev)
{}

static int at91_adc_get_trigger_value_by_name(struct iio_dev *idev,
					     const struct at91_adc_trigger *triggers,
					     const char *trigger_name)
{}

static int at91_adc_configure_trigger(struct iio_trigger *trig, bool state)
{}

static const struct iio_trigger_ops at91_adc_trigger_ops =;

static struct iio_trigger *at91_adc_allocate_trigger(struct iio_dev *idev,
						     const struct at91_adc_trigger *trigger)
{}

static int at91_adc_trigger_init(struct iio_dev *idev)
{}

static void at91_adc_trigger_remove(struct iio_dev *idev)
{}

static int at91_adc_buffer_init(struct iio_dev *idev)
{}

static void at91_adc_buffer_remove(struct iio_dev *idev)
{}

static int at91_adc_read_raw(struct iio_dev *idev,
			     struct iio_chan_spec const *chan,
			     int *val, int *val2, long mask)
{}


static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
{}

static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
{}

static int at91_adc_probe_dt_ts(struct device_node *node,
	struct at91_adc_state *st, struct device *dev)
{}

static const struct iio_info at91_adc_info =;

/* Touchscreen related functions */
static int atmel_ts_open(struct input_dev *dev)
{}

static void atmel_ts_close(struct input_dev *dev)
{}

static int at91_ts_hw_init(struct iio_dev *idev, u32 adc_clk_khz)
{}

static int at91_ts_register(struct iio_dev *idev,
		struct platform_device *pdev)
{}

static void at91_ts_unregister(struct at91_adc_state *st)
{}

static int at91_adc_probe(struct platform_device *pdev)
{}

static void at91_adc_remove(struct platform_device *pdev)
{}

static int at91_adc_suspend(struct device *dev)
{}

static int at91_adc_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend,
				at91_adc_resume);

static const struct at91_adc_trigger at91sam9260_triggers[] =;

static struct at91_adc_caps at91sam9260_caps =;

static const struct at91_adc_trigger at91sam9x5_triggers[] =;

static struct at91_adc_caps at91sam9rl_caps =;

static struct at91_adc_caps at91sam9g45_caps =;

static struct at91_adc_caps at91sam9x5_caps =;

static struct at91_adc_caps sama5d3_caps =;

static const struct of_device_id at91_adc_dt_ids[] =;
MODULE_DEVICE_TABLE(of, at91_adc_dt_ids);

static struct platform_driver at91_adc_driver =;

module_platform_driver();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_AUTHOR();