linux/drivers/iio/dac/ad5755.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * AD5755, AD5755-1, AD5757, AD5735, AD5737 Digital to analog converters driver
 *
 * Copyright 2012 Analog Devices Inc.
 */

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

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

#define AD5755_NUM_CHANNELS

#define AD5755_ADDR(x)

#define AD5755_WRITE_REG_DATA(chan)
#define AD5755_WRITE_REG_GAIN(chan)
#define AD5755_WRITE_REG_OFFSET(chan)
#define AD5755_WRITE_REG_CTRL(chan)

#define AD5755_READ_REG_DATA(chan)
#define AD5755_READ_REG_CTRL(chan)
#define AD5755_READ_REG_GAIN(chan)
#define AD5755_READ_REG_OFFSET(chan)
#define AD5755_READ_REG_CLEAR(chan)
#define AD5755_READ_REG_SLEW(chan)
#define AD5755_READ_REG_STATUS
#define AD5755_READ_REG_MAIN
#define AD5755_READ_REG_DC_DC

#define AD5755_CTRL_REG_SLEW
#define AD5755_CTRL_REG_MAIN
#define AD5755_CTRL_REG_DAC
#define AD5755_CTRL_REG_DC_DC
#define AD5755_CTRL_REG_SW

#define AD5755_READ_FLAG

#define AD5755_NOOP

#define AD5755_DAC_INT_EN
#define AD5755_DAC_CLR_EN
#define AD5755_DAC_OUT_EN
#define AD5755_DAC_INT_CURRENT_SENSE_RESISTOR
#define AD5755_DAC_DC_DC_EN
#define AD5755_DAC_VOLTAGE_OVERRANGE_EN

#define AD5755_DC_DC_MAXV
#define AD5755_DC_DC_FREQ_SHIFT
#define AD5755_DC_DC_PHASE_SHIFT
#define AD5755_EXT_DC_DC_COMP_RES

#define AD5755_SLEW_STEP_SIZE_SHIFT
#define AD5755_SLEW_RATE_SHIFT
#define AD5755_SLEW_ENABLE

enum ad5755_mode {};

enum ad5755_dc_dc_phase {};

enum ad5755_dc_dc_freq {};

enum ad5755_dc_dc_maxv {};

enum ad5755_slew_rate {};

enum ad5755_slew_step_size {};

/**
 * struct ad5755_platform_data - AD5755 DAC driver platform data
 * @ext_dc_dc_compenstation_resistor: Whether an external DC-DC converter
 * compensation register is used.
 * @dc_dc_phase: DC-DC converter phase.
 * @dc_dc_freq: DC-DC converter frequency.
 * @dc_dc_maxv: DC-DC maximum allowed boost voltage.
 * @dac: Per DAC instance parameters.
 * @dac.mode: The mode to be used for the DAC output.
 * @dac.ext_current_sense_resistor: Whether an external current sense resistor
 * is used.
 * @dac.enable_voltage_overrange: Whether to enable 20% voltage output overrange.
 * @dac.slew.enable: Whether to enable digital slew.
 * @dac.slew.rate: Slew rate of the digital slew.
 * @dac.slew.step_size: Slew step size of the digital slew.
 **/
struct ad5755_platform_data {};

/**
 * struct ad5755_chip_info - chip specific information
 * @channel_template:	channel specification
 * @calib_shift:	shift for the calibration data registers
 * @has_voltage_out:	whether the chip has voltage outputs
 */
struct ad5755_chip_info {};

/**
 * struct ad5755_state - driver instance specific data
 * @spi:	spi device the driver is attached to
 * @chip_info:	chip model specific constants, available modes etc
 * @pwr_down:	bitmask which contains  hether a channel is powered down or not
 * @ctrl:	software shadow of the channel ctrl registers
 * @channels:	iio channel spec for the device
 * @lock:	lock to protect the data buffer during SPI ops
 * @data:	spi transfer buffers
 */
struct ad5755_state {};

enum ad5755_type {};

static const int ad5755_dcdc_freq_table[][2] =;

static const int ad5755_dcdc_maxv_table[][2] =;

static const int ad5755_slew_rate_table[][2] =;

static const int ad5755_slew_step_table[][2] =;

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

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

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

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

static int ad5755_read(struct iio_dev *indio_dev, unsigned int addr)
{}

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

static int ad5755_set_channel_pwr_down(struct iio_dev *indio_dev,
	unsigned int channel, bool pwr_down)
{}

static const int ad5755_min_max_table[][2] =;

static void ad5755_get_min_max(struct ad5755_state *st,
	struct iio_chan_spec const *chan, int *min, int *max)
{}

static inline int ad5755_get_offset(struct ad5755_state *st,
	struct iio_chan_spec const *chan)
{}

static int ad5755_chan_reg_info(struct ad5755_state *st,
	struct iio_chan_spec const *chan, long info, bool write,
	unsigned int *reg, unsigned int *shift, unsigned int *offset)
{}

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

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

static ssize_t ad5755_read_powerdown(struct iio_dev *indio_dev, uintptr_t priv,
	const struct iio_chan_spec *chan, char *buf)
{}

static ssize_t ad5755_write_powerdown(struct iio_dev *indio_dev, uintptr_t priv,
	struct iio_chan_spec const *chan, const char *buf, size_t len)
{}

static const struct iio_info ad5755_info =;

static const struct iio_chan_spec_ext_info ad5755_ext_info[] =;

#define AD5755_CHANNEL(_bits)

static const struct ad5755_chip_info ad5755_chip_info_tbl[] =;

static bool ad5755_is_valid_mode(struct ad5755_state *st, enum ad5755_mode mode)
{}

static int ad5755_setup_pdata(struct iio_dev *indio_dev,
			      const struct ad5755_platform_data *pdata)
{}

static bool ad5755_is_voltage_mode(enum ad5755_mode mode)
{}

static int ad5755_init_channels(struct iio_dev *indio_dev,
				const struct ad5755_platform_data *pdata)
{}

#define AD5755_DEFAULT_DAC_PDATA

static const struct ad5755_platform_data ad5755_default_pdata =;

static struct ad5755_platform_data *ad5755_parse_fw(struct device *dev)
{}

static int ad5755_probe(struct spi_device *spi)
{}

static const struct spi_device_id ad5755_id[] =;
MODULE_DEVICE_TABLE(spi, ad5755_id);

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

static struct spi_driver ad5755_driver =;
module_spi_driver();

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