linux/drivers/iio/adc/vf610_adc.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Freescale Vybrid vf610 ADC driver
 *
 * Copyright 2013 Freescale Semiconductor, Inc.
 */

#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>

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

/* This will be the driver name the kernel reports */
#define DRIVER_NAME

/* Vybrid/IMX ADC registers */
#define VF610_REG_ADC_HC0
#define VF610_REG_ADC_HC1
#define VF610_REG_ADC_HS
#define VF610_REG_ADC_R0
#define VF610_REG_ADC_R1
#define VF610_REG_ADC_CFG
#define VF610_REG_ADC_GC
#define VF610_REG_ADC_GS
#define VF610_REG_ADC_CV
#define VF610_REG_ADC_OFS
#define VF610_REG_ADC_CAL
#define VF610_REG_ADC_PCTL

/* Configuration register field define */
#define VF610_ADC_MODE_BIT8
#define VF610_ADC_MODE_BIT10
#define VF610_ADC_MODE_BIT12
#define VF610_ADC_MODE_MASK
#define VF610_ADC_BUSCLK2_SEL
#define VF610_ADC_ALTCLK_SEL
#define VF610_ADC_ADACK_SEL
#define VF610_ADC_ADCCLK_MASK
#define VF610_ADC_CLK_DIV2
#define VF610_ADC_CLK_DIV4
#define VF610_ADC_CLK_DIV8
#define VF610_ADC_CLK_MASK
#define VF610_ADC_ADLSMP_LONG
#define VF610_ADC_ADSTS_SHORT
#define VF610_ADC_ADSTS_NORMAL
#define VF610_ADC_ADSTS_LONG
#define VF610_ADC_ADSTS_MASK
#define VF610_ADC_ADLPC_EN
#define VF610_ADC_ADHSC_EN
#define VF610_ADC_REFSEL_VALT
#define VF610_ADC_REFSEL_VBG
#define VF610_ADC_ADTRG_HARD
#define VF610_ADC_AVGS_8
#define VF610_ADC_AVGS_16
#define VF610_ADC_AVGS_32
#define VF610_ADC_AVGS_MASK
#define VF610_ADC_OVWREN

/* General control register field define */
#define VF610_ADC_ADACKEN
#define VF610_ADC_DMAEN
#define VF610_ADC_ACREN
#define VF610_ADC_ACFGT
#define VF610_ADC_ACFE
#define VF610_ADC_AVGEN
#define VF610_ADC_ADCON
#define VF610_ADC_CAL

/* Other field define */
#define VF610_ADC_ADCHC(x)
#define VF610_ADC_AIEN
#define VF610_ADC_CONV_DISABLE
#define VF610_ADC_HS_COCO0
#define VF610_ADC_CALF
#define VF610_ADC_TIMEOUT

#define DEFAULT_SAMPLE_TIME

/* V at 25°C of 696 mV */
#define VF610_VTEMP25_3V0
/* V at 25°C of 699 mV */
#define VF610_VTEMP25_3V3
/* Typical sensor slope coefficient at all temperatures */
#define VF610_TEMP_SLOPE_COEFF

enum clk_sel {};

enum vol_ref {};

enum average_sel {};

enum conversion_mode_sel {};

enum lst_adder_sel {};

struct vf610_adc_feature {};

struct vf610_adc {};

static const u32 vf610_hw_avgs[] =;
static const u32 vf610_lst_adder[] =;

static inline void vf610_adc_calculate_rates(struct vf610_adc *info)
{}

static inline void vf610_adc_cfg_init(struct vf610_adc *info)
{}

static void vf610_adc_cfg_post_set(struct vf610_adc *info)
{}

static void vf610_adc_calibration(struct vf610_adc *info)
{}

static void vf610_adc_cfg_set(struct vf610_adc *info)
{}

static void vf610_adc_sample_set(struct vf610_adc *info)
{}

static void vf610_adc_hw_init(struct vf610_adc *info)
{}

static int vf610_set_conversion_mode(struct iio_dev *indio_dev,
				     const struct iio_chan_spec *chan,
				     unsigned int mode)
{}

static int vf610_get_conversion_mode(struct iio_dev *indio_dev,
				     const struct iio_chan_spec *chan)
{}

static const char * const vf610_conv_modes[] =;

static const struct iio_enum vf610_conversion_mode =;

static const struct iio_chan_spec_ext_info vf610_ext_info[] =;

#define VF610_ADC_CHAN(_idx, _chan_type)

#define VF610_ADC_TEMPERATURE_CHAN(_idx, _chan_type)

static const struct iio_chan_spec vf610_adc_iio_channels[] =;

static int vf610_adc_read_data(struct vf610_adc *info)
{}

static irqreturn_t vf610_adc_isr(int irq, void *dev_id)
{}

static ssize_t vf610_show_samp_freq_avail(struct device *dev,
				struct device_attribute *attr, char *buf)
{}

static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(vf610_show_samp_freq_avail);

static struct attribute *vf610_attributes[] =;

static const struct attribute_group vf610_attribute_group =;

static int vf610_read_sample(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan, int *val)
{}

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

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

static int vf610_adc_buffer_postenable(struct iio_dev *indio_dev)
{}

static int vf610_adc_buffer_predisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops iio_triggered_buffer_setup_ops =;

static int vf610_adc_reg_access(struct iio_dev *indio_dev,
			unsigned reg, unsigned writeval,
			unsigned *readval)
{}

static const struct iio_info vf610_adc_iio_info =;

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

static int vf610_adc_probe(struct platform_device *pdev)
{}

static void vf610_adc_remove(struct platform_device *pdev)
{}

static int vf610_adc_suspend(struct device *dev)
{}

static int vf610_adc_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend,
				vf610_adc_resume);

static struct platform_driver vf610_adc_driver =;

module_platform_driver();

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