linux/drivers/iio/dac/ltc2688.c

// SPDX-License-Identifier: GPL-2.0
/*
 * LTC2688 16 channel, 16 bit Voltage Output SoftSpan DAC driver
 *
 * Copyright 2022 Analog Devices Inc.
 */
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/iio/iio.h>
#include <linux/limits.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/of.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>

#define LTC2688_DAC_CHANNELS

#define LTC2688_CMD_CH_CODE(x)
#define LTC2688_CMD_CH_SETTING(x)
#define LTC2688_CMD_CH_OFFSET(x)
#define LTC2688_CMD_CH_GAIN(x)
#define LTC2688_CMD_CH_CODE_UPDATE(x)

#define LTC2688_CMD_CONFIG
#define LTC2688_CMD_POWERDOWN
#define LTC2688_CMD_A_B_SELECT
#define LTC2688_CMD_SW_TOGGLE
#define LTC2688_CMD_TOGGLE_DITHER_EN
#define LTC2688_CMD_THERMAL_STAT
#define LTC2688_CMD_UPDATE_ALL
#define LTC2688_CMD_NOOP

#define LTC2688_READ_OPERATION

/* Channel Settings */
#define LTC2688_CH_SPAN_MSK
#define LTC2688_CH_OVERRANGE_MSK
#define LTC2688_CH_TD_SEL_MSK
#define LTC2688_CH_TGP_MAX
#define LTC2688_CH_DIT_PER_MSK
#define LTC2688_CH_DIT_PH_MSK
#define LTC2688_CH_MODE_MSK

#define LTC2688_DITHER_RAW_MASK
#define LTC2688_CH_CALIBBIAS_MASK
#define LTC2688_DITHER_RAW_MAX_VAL
#define LTC2688_CH_CALIBBIAS_MAX_VAL

/* Configuration register */
#define LTC2688_CONFIG_RST
#define LTC2688_CONFIG_EXT_REF

#define LTC2688_DITHER_FREQ_AVAIL_N

enum {};

enum {};

struct ltc2688_chan {};

struct ltc2688_state {};

static int ltc2688_spi_read(void *context, const void *reg, size_t reg_size,
			    void *val, size_t val_size)
{}

static int ltc2688_spi_write(void *context, const void *data, size_t count)
{}

static int ltc2688_span_get(const struct ltc2688_state *st, int c)
{}

static const int ltc2688_span_helper[LTC2688_SPAN_RANGE_MAX][2] =;

static int ltc2688_scale_get(const struct ltc2688_state *st, int c, int *val)
{}

static int ltc2688_offset_get(const struct ltc2688_state *st, int c, int *val)
{}

enum {};

static int ltc2688_dac_code_write(struct ltc2688_state *st, u32 chan, u32 input,
				  u16 code)
{}

static int ltc2688_dac_code_read(struct ltc2688_state *st, u32 chan, u32 input,
				 u32 *code)
{}

static const int ltc2688_raw_range[] =;

static int ltc2688_read_avail(struct iio_dev *indio_dev,
			      struct iio_chan_spec const *chan,
			      const int **vals, int *type, int *length,
			      long info)
{}

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

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

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

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

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

static ssize_t ltc2688_dither_freq_avail(const struct ltc2688_state *st,
					 const struct ltc2688_chan *chan,
					 char *buf)
{}

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

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

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

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

static int ltc2688_get_dither_phase(struct iio_dev *dev,
				    const struct iio_chan_spec *chan)
{}

static int ltc2688_set_dither_phase(struct iio_dev *dev,
				    const struct iio_chan_spec *chan,
				    unsigned int phase)
{}

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

static const char * const ltc2688_dither_phase[] =;

static const struct iio_enum ltc2688_dither_phase_enum =;

#define LTC2688_CHAN_EXT_INFO(_name, _what, _shared, _read, _write)

/*
 * For toggle mode we only expose the symbol attr (sw_toggle) in case a TGPx is
 * not provided in dts.
 */
static const struct iio_chan_spec_ext_info ltc2688_toggle_sym_ext_info[] =;

static const struct iio_chan_spec_ext_info ltc2688_toggle_ext_info[] =;

static struct iio_chan_spec_ext_info ltc2688_dither_ext_info[] =;

static const struct iio_chan_spec_ext_info ltc2688_ext_info[] =;

#define LTC2688_CHANNEL(_chan)

static const struct iio_chan_spec ltc2688_channels[] =;

static void ltc2688_clk_disable(void *clk)
{}

static const int ltc2688_period[LTC2688_DITHER_FREQ_AVAIL_N] =;

static int ltc2688_tgp_clk_setup(struct ltc2688_state *st,
				 struct ltc2688_chan *chan,
				 struct fwnode_handle *node, int tgp)
{}

static int ltc2688_span_lookup(const struct ltc2688_state *st, int min, int max)
{}

static int ltc2688_channel_config(struct ltc2688_state *st)
{}

static int ltc2688_setup(struct ltc2688_state *st, struct regulator *vref)
{}

static void ltc2688_disable_regulator(void *regulator)
{}

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

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

static const struct regmap_bus ltc2688_regmap_bus =;

static const struct regmap_config ltc2688_regmap_config =;

static const struct iio_info ltc2688_info =;

static int ltc2688_probe(struct spi_device *spi)
{}

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

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

static struct spi_driver ltc2688_driver =;
module_spi_driver();

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