linux/drivers/iio/dac/ad5421.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * AD5421 Digital to analog converters  driver
 *
 * Copyright 2011 Analog Devices Inc.
 */

#include <linux/device.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
#include <linux/slab.h>
#include <linux/sysfs.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/events.h>
#include <linux/iio/dac/ad5421.h>


#define AD5421_REG_DAC_DATA
#define AD5421_REG_CTRL
#define AD5421_REG_OFFSET
#define AD5421_REG_GAIN
/* load dac and fault shared the same register number. Writing to it will cause
 * a dac load command, reading from it will return the fault status register */
#define AD5421_REG_LOAD_DAC
#define AD5421_REG_FAULT
#define AD5421_REG_FORCE_ALARM_CURRENT
#define AD5421_REG_RESET
#define AD5421_REG_START_CONVERSION
#define AD5421_REG_NOOP

#define AD5421_CTRL_WATCHDOG_DISABLE
#define AD5421_CTRL_AUTO_FAULT_READBACK
#define AD5421_CTRL_MIN_CURRENT
#define AD5421_CTRL_ADC_SOURCE_TEMP
#define AD5421_CTRL_ADC_ENABLE
#define AD5421_CTRL_PWR_DOWN_INT_VREF

#define AD5421_FAULT_SPI
#define AD5421_FAULT_PEC
#define AD5421_FAULT_OVER_CURRENT
#define AD5421_FAULT_UNDER_CURRENT
#define AD5421_FAULT_TEMP_OVER_140
#define AD5421_FAULT_TEMP_OVER_100
#define AD5421_FAULT_UNDER_VOLTAGE_6V
#define AD5421_FAULT_UNDER_VOLTAGE_12V

/* These bits will cause the fault pin to go high */
#define AD5421_FAULT_TRIGGER_IRQ

/**
 * struct ad5421_state - driver instance specific data
 * @spi:		spi_device
 * @ctrl:		control register cache
 * @current_range:	current range which the device is configured for
 * @data:		spi transfer buffers
 * @fault_mask:		software masking of events
 * @lock:		lock to protect the data buffer during SPI ops
 */
struct ad5421_state {};

static const struct iio_event_spec ad5421_current_event[] =;

static const struct iio_event_spec ad5421_temp_event[] =;

static const struct iio_chan_spec ad5421_channels[] =;

static int ad5421_write_unlocked(struct iio_dev *indio_dev,
	unsigned int reg, unsigned int val)
{}

static int ad5421_write(struct iio_dev *indio_dev, unsigned int reg,
	unsigned int val)
{}

static int ad5421_read(struct iio_dev *indio_dev, unsigned int reg)
{}

static int ad5421_update_ctrl(struct iio_dev *indio_dev, unsigned int set,
	unsigned int clr)
{}

static irqreturn_t ad5421_fault_handler(int irq, void *data)
{}

static void ad5421_get_current_min_max(struct ad5421_state *st,
	unsigned int *min, unsigned int *max)
{}

static inline unsigned int ad5421_get_offset(struct ad5421_state *st)
{}

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

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

static int ad5421_write_event_config(struct iio_dev *indio_dev,
	const struct iio_chan_spec *chan, enum iio_event_type type,
	enum iio_event_direction dir, int state)
{}

static int ad5421_read_event_config(struct iio_dev *indio_dev,
	const struct iio_chan_spec *chan, enum iio_event_type type,
	enum iio_event_direction dir)
{}

static int ad5421_read_event_value(struct iio_dev *indio_dev,
	const struct iio_chan_spec *chan, enum iio_event_type type,
	enum iio_event_direction dir, enum iio_event_info info, int *val,
	int *val2)
{}

static const struct iio_info ad5421_info =;

static int ad5421_probe(struct spi_device *spi)
{}

static struct spi_driver ad5421_driver =;
module_spi_driver();

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