linux/drivers/iio/adc/ep93xx_adc.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for ADC module on the Cirrus Logic EP93xx series of SoCs
 *
 * Copyright (C) 2015 Alexander Sverdlin
 *
 * The driver uses polling to get the conversion status. According to EP93xx
 * datasheets, reading ADCResult register starts the conversion, but user is also
 * responsible for ensuring that delay between adjacent conversion triggers is
 * long enough so that maximum allowed conversion rate is not exceeded. This
 * basically renders IRQ mode unusable.
 */

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/iio/iio.h>
#include <linux/io.h>
#include <linux/irqflags.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/of.h>

/*
 * This code could benefit from real HR Timers, but jiffy granularity would
 * lower ADC conversion rate down to CONFIG_HZ, so we fallback to busy wait
 * in such case.
 *
 * HR Timers-based version loads CPU only up to 10% during back to back ADC
 * conversion, while busy wait-based version consumes whole CPU power.
 */
#ifdef CONFIG_HIGH_RES_TIMERS
#define ep93xx_adc_delay(usmin, usmax)
#else
#define ep93xx_adc_delay
#endif

#define EP93XX_ADC_RESULT
#define EP93XX_ADC_SDR
#define EP93XX_ADC_SWITCH
#define EP93XX_ADC_SW_LOCK

struct ep93xx_adc_priv {};

#define EP93XX_ADC_CH(index, dname, swcfg)

/*
 * Numbering scheme for channels 0..4 is defined in EP9301 and EP9302 datasheets.
 * EP9307, EP9312 and EP9312 have 3 channels more (total 8), but the numbering is
 * not defined. So the last three are numbered randomly, let's say.
 */
static const struct iio_chan_spec ep93xx_adc_channels[8] =;

static int ep93xx_read_raw(struct iio_dev *iiodev,
			   struct iio_chan_spec const *channel, int *value,
			   int *shift, long mask)
{}

static const struct iio_info ep93xx_adc_info =;

static int ep93xx_adc_probe(struct platform_device *pdev)
{}

static void ep93xx_adc_remove(struct platform_device *pdev)
{}

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

static struct platform_driver ep93xx_adc_driver =;
module_platform_driver();

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