#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/iio/sysfs.h>
#define AD5933_REG_CONTROL_HB …
#define AD5933_REG_CONTROL_LB …
#define AD5933_REG_FREQ_START …
#define AD5933_REG_FREQ_INC …
#define AD5933_REG_INC_NUM …
#define AD5933_REG_SETTLING_CYCLES …
#define AD5933_REG_STATUS …
#define AD5933_REG_TEMP_DATA …
#define AD5933_REG_REAL_DATA …
#define AD5933_REG_IMAG_DATA …
#define AD5933_CTRL_INIT_START_FREQ …
#define AD5933_CTRL_START_SWEEP …
#define AD5933_CTRL_INC_FREQ …
#define AD5933_CTRL_REPEAT_FREQ …
#define AD5933_CTRL_MEASURE_TEMP …
#define AD5933_CTRL_POWER_DOWN …
#define AD5933_CTRL_STANDBY …
#define AD5933_CTRL_RANGE_2000mVpp …
#define AD5933_CTRL_RANGE_200mVpp …
#define AD5933_CTRL_RANGE_400mVpp …
#define AD5933_CTRL_RANGE_1000mVpp …
#define AD5933_CTRL_RANGE(x) …
#define AD5933_CTRL_PGA_GAIN_1 …
#define AD5933_CTRL_PGA_GAIN_5 …
#define AD5933_CTRL_RESET …
#define AD5933_CTRL_INT_SYSCLK …
#define AD5933_CTRL_EXT_SYSCLK …
#define AD5933_STAT_TEMP_VALID …
#define AD5933_STAT_DATA_VALID …
#define AD5933_STAT_SWEEP_DONE …
#define AD5933_I2C_BLOCK_WRITE …
#define AD5933_I2C_BLOCK_READ …
#define AD5933_I2C_ADDR_POINTER …
#define AD5933_INT_OSC_FREQ_Hz …
#define AD5933_MAX_OUTPUT_FREQ_Hz …
#define AD5933_MAX_RETRIES …
#define AD5933_OUT_RANGE …
#define AD5933_OUT_RANGE_AVAIL …
#define AD5933_OUT_SETTLING_CYCLES …
#define AD5933_IN_PGA_GAIN …
#define AD5933_IN_PGA_GAIN_AVAIL …
#define AD5933_FREQ_POINTS …
#define AD5933_POLL_TIME_ms …
#define AD5933_INIT_EXCITATION_TIME_ms …
struct ad5933_state { … };
#define AD5933_CHANNEL(_type, _extend_name, _info_mask_separate, _address, \
_scan_index, _realbits) …
static const struct iio_chan_spec ad5933_channels[] = …;
static int ad5933_i2c_write(struct i2c_client *client, u8 reg, u8 len, u8 *data)
{ … }
static int ad5933_i2c_read(struct i2c_client *client, u8 reg, u8 len, u8 *data)
{ … }
static int ad5933_cmd(struct ad5933_state *st, unsigned char cmd)
{ … }
static int ad5933_reset(struct ad5933_state *st)
{ … }
static int ad5933_wait_busy(struct ad5933_state *st, unsigned char event)
{ … }
static int ad5933_set_freq(struct ad5933_state *st,
unsigned int reg, unsigned long freq)
{ … }
static int ad5933_setup(struct ad5933_state *st)
{ … }
static void ad5933_calc_out_ranges(struct ad5933_state *st)
{ … }
static ssize_t ad5933_show_frequency(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t ad5933_store_frequency(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static IIO_DEVICE_ATTR(out_altvoltage0_frequency_start, 0644,
ad5933_show_frequency,
ad5933_store_frequency,
AD5933_REG_FREQ_START);
static IIO_DEVICE_ATTR(out_altvoltage0_frequency_increment, 0644,
ad5933_show_frequency,
ad5933_store_frequency,
AD5933_REG_FREQ_INC);
static ssize_t ad5933_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{ … }
static ssize_t ad5933_store(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t len)
{ … }
static IIO_DEVICE_ATTR(out_altvoltage0_raw, 0644,
ad5933_show,
ad5933_store,
AD5933_OUT_RANGE);
static IIO_DEVICE_ATTR(out_altvoltage0_scale_available, 0444,
ad5933_show,
NULL,
AD5933_OUT_RANGE_AVAIL);
static IIO_DEVICE_ATTR(in_voltage0_scale, 0644,
ad5933_show,
ad5933_store,
AD5933_IN_PGA_GAIN);
static IIO_DEVICE_ATTR(in_voltage0_scale_available, 0444,
ad5933_show,
NULL,
AD5933_IN_PGA_GAIN_AVAIL);
static IIO_DEVICE_ATTR(out_altvoltage0_frequency_points, 0644,
ad5933_show,
ad5933_store,
AD5933_FREQ_POINTS);
static IIO_DEVICE_ATTR(out_altvoltage0_settling_cycles, 0644,
ad5933_show,
ad5933_store,
AD5933_OUT_SETTLING_CYCLES);
static struct attribute *ad5933_attributes[] = …;
static const struct attribute_group ad5933_attribute_group = …;
static int ad5933_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int *val,
int *val2,
long m)
{ … }
static const struct iio_info ad5933_info = …;
static int ad5933_ring_preenable(struct iio_dev *indio_dev)
{ … }
static int ad5933_ring_postenable(struct iio_dev *indio_dev)
{ … }
static int ad5933_ring_postdisable(struct iio_dev *indio_dev)
{ … }
static const struct iio_buffer_setup_ops ad5933_ring_setup_ops = …;
static void ad5933_work(struct work_struct *work)
{ … }
static int ad5933_probe(struct i2c_client *client)
{ … }
static const struct i2c_device_id ad5933_id[] = …;
MODULE_DEVICE_TABLE(i2c, ad5933_id);
static const struct of_device_id ad5933_of_match[] = …;
MODULE_DEVICE_TABLE(of, ad5933_of_match);
static struct i2c_driver ad5933_driver = …;
module_i2c_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;