linux/drivers/iio/dac/adi-axi-dac.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Analog Devices Generic AXI DAC IP core
 * Link: https://wiki.analog.com/resources/fpga/docs/axi_dac_ip
 *
 * Copyright 2016-2024 Analog Devices Inc.
 */
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/cleanup.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/limits.h>
#include <linux/kstrtox.h>
#include <linux/math.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/units.h>

#include <linux/fpga/adi-axi-common.h>
#include <linux/iio/backend.h>
#include <linux/iio/buffer-dmaengine.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>

/*
 * Register definitions:
 *   https://wiki.analog.com/resources/fpga/docs/axi_dac_ip#register_map
 */

/* Base controls */
#define AXI_DAC_REG_CONFIG
#define AXI_DDS_DISABLE

 /* DAC controls */
#define AXI_DAC_REG_RSTN
#define AXI_DAC_RSTN_CE_N
#define AXI_DAC_RSTN_MMCM_RSTN
#define AXI_DAC_RSTN_RSTN
#define AXI_DAC_REG_CNTRL_1
#define AXI_DAC_SYNC
#define AXI_DAC_REG_CNTRL_2
#define ADI_DAC_R1_MODE
#define AXI_DAC_DRP_STATUS
#define AXI_DAC_DRP_LOCKED
/* DAC Channel controls */
#define AXI_DAC_REG_CHAN_CNTRL_1(c)
#define AXI_DAC_REG_CHAN_CNTRL_3(c)
#define AXI_DAC_SCALE_SIGN
#define AXI_DAC_SCALE_INT
#define AXI_DAC_SCALE
#define AXI_DAC_REG_CHAN_CNTRL_2(c)
#define AXI_DAC_REG_CHAN_CNTRL_4(c)
#define AXI_DAC_PHASE
#define AXI_DAC_FREQUENCY
#define AXI_DAC_REG_CHAN_CNTRL_7(c)
#define AXI_DAC_DATA_SEL

/* 360 degrees in rad */
#define AXI_DAC_2_PI_MEGA
enum {};

struct axi_dac_state {};

static int axi_dac_enable(struct iio_backend *back)
{}

static void axi_dac_disable(struct iio_backend *back)
{}

static struct iio_buffer *axi_dac_request_buffer(struct iio_backend *back,
						 struct iio_dev *indio_dev)
{}

static void axi_dac_free_buffer(struct iio_backend *back,
				struct iio_buffer *buffer)
{}

enum {};

static int __axi_dac_frequency_get(struct axi_dac_state *st, unsigned int chan,
				   unsigned int tone_2, unsigned int *freq)
{}

static int axi_dac_frequency_get(struct axi_dac_state *st,
				 const struct iio_chan_spec *chan, char *buf,
				 unsigned int tone_2)
{}

static int axi_dac_scale_get(struct axi_dac_state *st,
			     const struct iio_chan_spec *chan, char *buf,
			     unsigned int tone_2)
{}

static int axi_dac_phase_get(struct axi_dac_state *st,
			     const struct iio_chan_spec *chan, char *buf,
			     unsigned int tone_2)
{}

static int __axi_dac_frequency_set(struct axi_dac_state *st, unsigned int chan,
				   u64 sample_rate, unsigned int freq,
				   unsigned int tone_2)
{}

static int axi_dac_frequency_set(struct axi_dac_state *st,
				 const struct iio_chan_spec *chan,
				 const char *buf, size_t len, unsigned int tone_2)
{}

static int axi_dac_scale_set(struct axi_dac_state *st,
			     const struct iio_chan_spec *chan,
			     const char *buf, size_t len, unsigned int tone_2)
{}

static int axi_dac_phase_set(struct axi_dac_state *st,
			     const struct iio_chan_spec *chan,
			     const char *buf, size_t len, unsigned int tone_2)
{}

static int axi_dac_ext_info_set(struct iio_backend *back, uintptr_t private,
				const struct iio_chan_spec *chan,
				const char *buf, size_t len)
{}

static int axi_dac_ext_info_get(struct iio_backend *back, uintptr_t private,
				const struct iio_chan_spec *chan, char *buf)
{}

static const struct iio_chan_spec_ext_info axi_dac_ext_info[] =;

static int axi_dac_extend_chan(struct iio_backend *back,
			       struct iio_chan_spec *chan)
{}

static int axi_dac_data_source_set(struct iio_backend *back, unsigned int chan,
				   enum iio_backend_data_source data)
{}

static int axi_dac_set_sample_rate(struct iio_backend *back, unsigned int chan,
				   u64 sample_rate)
{}

static const struct iio_backend_ops axi_dac_generic =;

static const struct regmap_config axi_dac_regmap_config =;

static int axi_dac_probe(struct platform_device *pdev)
{}

static unsigned int axi_dac_9_1_b_info =;

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

static struct platform_driver axi_dac_driver =;
module_platform_driver();

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