#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
#include <linux/err.h>
#include <linux/module.h>
#include <asm/div64.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include "dds.h"
#include "ad9834.h"
#define AD9834_REG_CMD …
#define AD9834_REG_FREQ0 …
#define AD9834_REG_FREQ1 …
#define AD9834_REG_PHASE0 …
#define AD9834_REG_PHASE1 …
#define AD9834_B28 …
#define AD9834_HLB …
#define AD9834_FSEL …
#define AD9834_PSEL …
#define AD9834_PIN_SW …
#define AD9834_RESET …
#define AD9834_SLEEP1 …
#define AD9834_SLEEP12 …
#define AD9834_OPBITEN …
#define AD9834_SIGN_PIB …
#define AD9834_DIV2 …
#define AD9834_MODE …
#define AD9834_FREQ_BITS …
#define AD9834_PHASE_BITS …
#define RES_MASK(bits) …
struct ad9834_state { … };
enum ad9834_supported_device_ids { … };
static unsigned int ad9834_calc_freqreg(unsigned long mclk, unsigned long fout)
{ … }
static int ad9834_write_frequency(struct ad9834_state *st,
unsigned long addr, unsigned long fout)
{ … }
static int ad9834_write_phase(struct ad9834_state *st,
unsigned long addr, unsigned long phase)
{ … }
static ssize_t ad9834_write(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static ssize_t ad9834_store_wavetype(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static
ssize_t ad9834_show_out0_wavetype_available(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(out_altvoltage0_out0_wavetype_available, 0444,
ad9834_show_out0_wavetype_available, NULL, 0);
static
ssize_t ad9834_show_out1_wavetype_available(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static IIO_DEVICE_ATTR(out_altvoltage0_out1_wavetype_available, 0444,
ad9834_show_out1_wavetype_available, NULL, 0);
static IIO_DEV_ATTR_FREQ(0, 0, 0200, NULL, ad9834_write, AD9834_REG_FREQ0);
static IIO_DEV_ATTR_FREQ(0, 1, 0200, NULL, ad9834_write, AD9834_REG_FREQ1);
static IIO_DEV_ATTR_FREQSYMBOL(0, 0200, NULL, ad9834_write, AD9834_FSEL);
static IIO_CONST_ATTR_FREQ_SCALE(0, "1");
static IIO_DEV_ATTR_PHASE(0, 0, 0200, NULL, ad9834_write, AD9834_REG_PHASE0);
static IIO_DEV_ATTR_PHASE(0, 1, 0200, NULL, ad9834_write, AD9834_REG_PHASE1);
static IIO_DEV_ATTR_PHASESYMBOL(0, 0200, NULL, ad9834_write, AD9834_PSEL);
static IIO_CONST_ATTR_PHASE_SCALE(0, "0.0015339808");
static IIO_DEV_ATTR_PINCONTROL_EN(0, 0200, NULL, ad9834_write, AD9834_PIN_SW);
static IIO_DEV_ATTR_OUT_ENABLE(0, 0200, NULL, ad9834_write, AD9834_RESET);
static IIO_DEV_ATTR_OUTY_ENABLE(0, 1, 0200, NULL, ad9834_write, AD9834_OPBITEN);
static IIO_DEV_ATTR_OUT_WAVETYPE(0, 0, ad9834_store_wavetype, 0);
static IIO_DEV_ATTR_OUT_WAVETYPE(0, 1, ad9834_store_wavetype, 1);
static struct attribute *ad9834_attributes[] = …;
static struct attribute *ad9833_attributes[] = …;
static const struct attribute_group ad9834_attribute_group = …;
static const struct attribute_group ad9833_attribute_group = …;
static const struct iio_info ad9834_info = …;
static const struct iio_info ad9833_info = …;
static void ad9834_disable_reg(void *data)
{ … }
static int ad9834_probe(struct spi_device *spi)
{ … }
static const struct spi_device_id ad9834_id[] = …;
MODULE_DEVICE_TABLE(spi, ad9834_id);
static const struct of_device_id ad9834_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad9834_of_match);
static struct spi_driver ad9834_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;