linux/drivers/iio/dac/ad9739a.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Analog Devices AD9739a SPI DAC driver
 *
 * Copyright 2015-2024 Analog Devices Inc.
 */
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/errno.h>
#include <linux/gpio/consumer.h>
#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/spi/spi.h>
#include <linux/units.h>

#include <linux/iio/backend.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>

#define AD9739A_REG_MODE
#define AD9739A_RESET_MASK
#define AD9739A_REG_FSC_1
#define AD9739A_REG_FSC_2
#define AD9739A_FSC_MSB
#define AD9739A_REG_DEC_CNT
#define AD9739A_NORMAL_MODE
#define AD9739A_MIXED_MODE
#define AD9739A_DAC_DEC
#define AD9739A_REG_LVDS_REC_CNT1
#define AD9739A_RCVR_LOOP_EN_MASK
#define AD9739A_REG_LVDS_REC_CNT4
#define AD9739A_FINE_DEL_SKW_MASK
#define AD9739A_REG_LVDS_REC_STAT9
#define AD9739A_RCVR_TRACK_AND_LOCK
#define AD9739A_REG_CROSS_CNT1
#define AD9739A_REG_CROSS_CNT2
#define AD9739A_REG_PHS_DET
#define AD9739A_REG_MU_DUTY
#define AD9739A_REG_MU_CNT1
#define AD9739A_MU_EN_MASK
#define AD9739A_MU_GAIN_MASK
#define AD9739A_REG_MU_CNT2
#define AD9739A_REG_MU_CNT3
#define AD9739A_REG_MU_CNT4
#define AD9739A_MU_CNT4_DEFAULT
#define AD9739A_REG_MU_STAT1
#define AD9739A_MU_LOCK_MASK
#define AD9739A_REG_ANA_CNT_1
#define AD9739A_REG_ID

#define AD9739A_ID
#define AD9739A_REG_IS_RESERVED(reg)

#define AD9739A_FSC_MIN
#define AD9739A_FSC_MAX
#define AD9739A_FSC_RANGE

#define AD9739A_MIN_DAC_CLK
#define AD9739A_MAX_DAC_CLK
#define AD9739A_DAC_CLK_RANGE
/* as recommended by the datasheet */
#define AD9739A_LOCK_N_TRIES

struct ad9739a_state {};

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

static int ad9739a_oper_mode_set(struct iio_dev *indio_dev,
				 const struct iio_chan_spec *chan, u32 mode)
{}

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

static int ad9739a_buffer_preenable(struct iio_dev *indio_dev)
{}

static int ad9739a_buffer_postdisable(struct iio_dev *indio_dev)
{}

static bool ad9739a_reg_accessible(struct device *dev, unsigned int reg)
{}

static int ad9739a_reset(struct device *dev, const struct ad9739a_state *st)
{}

/*
 * Recommended values (as per datasheet) for the dac clk common mode voltage
 * and Mu controller. Look at table 29.
 */
static const struct reg_sequence ad9739a_clk_mu_ctrl[] =;

static int ad9739a_init(struct device *dev, const struct ad9739a_state *st)
{}

static const char * const ad9739a_modes_avail[] =;

static const struct iio_enum ad9739a_modes =;

static const struct iio_chan_spec_ext_info ad9739a_ext_info[] =;

/*
 * The reason for having two different channels is because we have, in reality,
 * two sources of data:
 *   ALTVOLTAGE: It's a Continuous Wave that's internally generated by the
 *               backend device.
 *   VOLTAGE: It's the typical data we can have in a DAC device and the source
 *            of it has nothing to do with the backend. The backend will only
 *            forward it into our data interface to be sent out.
 */
static struct iio_chan_spec ad9739a_channels[] =;

static const struct iio_info ad9739a_info =;

static const struct iio_buffer_setup_ops ad9739a_buffer_setup_ops =;

static const struct regmap_config ad9739a_regmap_config =;

static int ad9739a_probe(struct spi_device *spi)
{}

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

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

static struct spi_driver ad9739a_driver =;
module_spi_driver();

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