@@ -43,6 +43,7 @@
#include <linux/types.h>
#include <linux/iio/backend.h>
+#include <linux/iio/iio.h>
struct iio_backend {
struct list_head entry;
@@ -186,6 +187,16 @@ int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan,
}
EXPORT_SYMBOL_NS_GPL(iio_backend_data_format_set, IIO_BACKEND);
+int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan,
+ enum iio_backend_data_source data)
+{
+ if (data >= IIO_BACKEND_DATA_SOURCE_MAX)
+ return -EINVAL;
+
+ return iio_backend_op_call(back, data_source_set, chan, data);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_data_source_set, IIO_BACKEND);
+
static void iio_backend_free_buffer(void *arg)
{
struct iio_backend_buffer_pair *pair = arg;
@@ -231,6 +242,60 @@ int devm_iio_backend_request_buffer(struct device *dev,
}
EXPORT_SYMBOL_NS_GPL(devm_iio_backend_request_buffer, IIO_BACKEND);
+int iio_backend_read_phase(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx)
+{
+ return iio_backend_op_call(back, read_phase, chan, val, val2, tone_idx);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_read_phase, IIO_BACKEND);
+
+int iio_backend_write_phase(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx)
+{
+ return iio_backend_op_call(back, write_phase, chan, val, val2,
+ tone_idx);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_write_phase, IIO_BACKEND);
+
+int iio_backend_read_scale(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx)
+{
+ return iio_backend_op_call(back, read_scale, chan, val, val2, tone_idx);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_read_scale, IIO_BACKEND);
+
+int iio_backend_write_scale(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx)
+{
+ return iio_backend_op_call(back, write_scale, chan, val, val2,
+ tone_idx);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_write_scale, IIO_BACKEND);
+
+int iio_backend_read_frequency(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx,
+ unsigned long long sample_freq)
+{
+ return iio_backend_op_call(back, read_frequency, chan, val, val2,
+ tone_idx, sample_freq);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_read_frequency, IIO_BACKEND);
+
+int iio_backend_write_frequency(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx,
+ unsigned long long sample_freq)
+{
+ return iio_backend_op_call(back, write_frequency, chan, val, val2,
+ tone_idx, sample_freq);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_write_frequency, IIO_BACKEND);
+
static void iio_backend_release(void *arg)
{
struct iio_backend *back = arg;
@@ -4,6 +4,7 @@
#include <linux/types.h>
+struct iio_chan_spec;
struct fwnode_handle;
struct iio_backend;
struct device;
@@ -15,6 +16,12 @@ enum iio_backend_data_type {
IIO_BACKEND_DATA_TYPE_MAX
};
+enum iio_backend_data_source {
+ IIO_BACKEND_INTERNAL_CW,
+ IIO_BACKEND_EXTERNAL,
+ IIO_BACKEND_DATA_SOURCE_MAX
+};
+
/**
* struct iio_backend_data_fmt - Backend data format
* @type: Data type.
@@ -45,10 +52,33 @@ struct iio_backend_ops {
int (*chan_disable)(struct iio_backend *back, unsigned int chan);
int (*data_format_set)(struct iio_backend *back, unsigned int chan,
const struct iio_backend_data_fmt *data);
+ int (*data_source_set)(struct iio_backend *back, unsigned int chan,
+ enum iio_backend_data_source data);
+
struct iio_buffer *(*request_buffer)(struct iio_backend *back,
struct iio_dev *indio_dev);
void (*free_buffer)(struct iio_backend *back,
struct iio_buffer *buffer);
+ int (*read_phase)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val, int *val2,
+ unsigned int tone_idx);
+ int (*write_phase)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val, int val2,
+ unsigned int tone_idx);
+ int (*read_scale)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val, int *val2,
+ unsigned int tone_idx);
+ int (*write_scale)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val, int val2,
+ unsigned int tone_idx);
+ int (*read_frequency)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx,
+ unsigned long long sample_freq);
+ int (*write_frequency)(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx,
+ unsigned long long sample_freq);
};
int iio_backend_chan_enable(struct iio_backend *back, unsigned int chan);
@@ -56,10 +86,31 @@ int iio_backend_chan_disable(struct iio_backend *back, unsigned int chan);
int devm_iio_backend_enable(struct device *dev, struct iio_backend *back);
int iio_backend_data_format_set(struct iio_backend *back, unsigned int chan,
const struct iio_backend_data_fmt *data);
+int iio_backend_data_source_set(struct iio_backend *back, unsigned int chan,
+ enum iio_backend_data_source data);
int devm_iio_backend_request_buffer(struct device *dev,
struct iio_backend *back,
struct iio_dev *indio_dev);
-
+int iio_backend_read_phase(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx);
+int iio_backend_write_phase(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx);
+int iio_backend_read_scale(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx);
+int iio_backend_write_scale(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx);
+int iio_backend_read_frequency(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int *val,
+ int *val2, unsigned int tone_idx,
+ unsigned long long sample_freq);
+int iio_backend_write_frequency(struct iio_backend *back,
+ const struct iio_chan_spec *chan, int val,
+ int val2, unsigned int tone_idx,
+ unsigned long long sample_freq);
void *iio_backend_get_priv(const struct iio_backend *conv);
struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name);
struct iio_backend *