Skip to content

Commit d3eeb1a

Browse files
spectrum70jic23
authored andcommitted
iio: backend: extend features
Extend backend features with new calls needed later on this patchset from axi version of ad3552r. The follwoing calls are added: iio_backend_ddr_enable() enable ddr bus transfer iio_backend_ddr_disable() disable ddr bus transfer iio_backend_data_stream_enable() enable data stream over bus interface iio_backend_data_stream_disable() disable data stream over bus interface iio_backend_data_transfer_addr() define the target register address where the DAC sample will be written. Reviewed-by: Nuno Sa <[email protected]> Signed-off-by: Angelo Dureghello <[email protected]> Reviewed-by: David Lechner <[email protected]> Link: https://patch.msgid.link/20241028-wip-bl-ad3552r-axi-v0-iio-testing-v9-3-f6960b4f9719@kernel-space.org Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 043e4e5 commit d3eeb1a

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

drivers/iio/industrialio-backend.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,84 @@ static int __devm_iio_backend_get(struct device *dev, struct iio_backend *back)
718718
return 0;
719719
}
720720

721+
/**
722+
* iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode
723+
* @back: Backend device
724+
*
725+
* Enable DDR, data is generated by the IP at each front (raising and falling)
726+
* of the bus clock signal.
727+
*
728+
* RETURNS:
729+
* 0 on success, negative error number on failure.
730+
*/
731+
int iio_backend_ddr_enable(struct iio_backend *back)
732+
{
733+
return iio_backend_op_call(back, ddr_enable);
734+
}
735+
EXPORT_SYMBOL_NS_GPL(iio_backend_ddr_enable, IIO_BACKEND);
736+
737+
/**
738+
* iio_backend_ddr_disable - Disable interface DDR (Double Data Rate) mode
739+
* @back: Backend device
740+
*
741+
* Disable DDR, setting into SDR mode (Single Data Rate).
742+
*
743+
* RETURNS:
744+
* 0 on success, negative error number on failure.
745+
*/
746+
int iio_backend_ddr_disable(struct iio_backend *back)
747+
{
748+
return iio_backend_op_call(back, ddr_disable);
749+
}
750+
EXPORT_SYMBOL_NS_GPL(iio_backend_ddr_disable, IIO_BACKEND);
751+
752+
/**
753+
* iio_backend_data_stream_enable - Enable data stream
754+
* @back: Backend device
755+
*
756+
* Enable data stream over the bus interface.
757+
*
758+
* RETURNS:
759+
* 0 on success, negative error number on failure.
760+
*/
761+
int iio_backend_data_stream_enable(struct iio_backend *back)
762+
{
763+
return iio_backend_op_call(back, data_stream_enable);
764+
}
765+
EXPORT_SYMBOL_NS_GPL(iio_backend_data_stream_enable, IIO_BACKEND);
766+
767+
/**
768+
* iio_backend_data_stream_disable - Disable data stream
769+
* @back: Backend device
770+
*
771+
* Disable data stream over the bus interface.
772+
*
773+
* RETURNS:
774+
* 0 on success, negative error number on failure.
775+
*/
776+
int iio_backend_data_stream_disable(struct iio_backend *back)
777+
{
778+
return iio_backend_op_call(back, data_stream_disable);
779+
}
780+
EXPORT_SYMBOL_NS_GPL(iio_backend_data_stream_disable, IIO_BACKEND);
781+
782+
/**
783+
* iio_backend_data_transfer_addr - Set data address.
784+
* @back: Backend device
785+
* @address: Data register address
786+
*
787+
* Some devices may need to inform the backend about an address
788+
* where to read or write the data.
789+
*
790+
* RETURNS:
791+
* 0 on success, negative error number on failure.
792+
*/
793+
int iio_backend_data_transfer_addr(struct iio_backend *back, u32 address)
794+
{
795+
return iio_backend_op_call(back, data_transfer_addr, address);
796+
}
797+
EXPORT_SYMBOL_NS_GPL(iio_backend_data_transfer_addr, IIO_BACKEND);
798+
721799
static struct iio_backend *__devm_iio_backend_fwnode_get(struct device *dev, const char *name,
722800
struct fwnode_handle *fwnode)
723801
{

include/linux/iio/backend.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ struct iio_dev;
1414
enum iio_backend_data_type {
1515
IIO_BACKEND_TWOS_COMPLEMENT,
1616
IIO_BACKEND_OFFSET_BINARY,
17+
IIO_BACKEND_DATA_UNSIGNED,
1718
IIO_BACKEND_DATA_TYPE_MAX
1819
};
1920

2021
enum iio_backend_data_source {
2122
IIO_BACKEND_INTERNAL_CONTINUOUS_WAVE,
2223
IIO_BACKEND_EXTERNAL,
24+
IIO_BACKEND_INTERNAL_RAMP_16BIT,
2325
IIO_BACKEND_DATA_SOURCE_MAX
2426
};
2527

@@ -89,6 +91,11 @@ enum iio_backend_sample_trigger {
8991
* @read_raw: Read a channel attribute from a backend device
9092
* @debugfs_print_chan_status: Print channel status into a buffer.
9193
* @debugfs_reg_access: Read or write register value of backend.
94+
* @ddr_enable: Enable interface DDR (Double Data Rate) mode.
95+
* @ddr_disable: Disable interface DDR (Double Data Rate) mode.
96+
* @data_stream_enable: Enable data stream.
97+
* @data_stream_disable: Disable data stream.
98+
* @data_transfer_addr: Set data address.
9299
**/
93100
struct iio_backend_ops {
94101
int (*enable)(struct iio_backend *back);
@@ -129,6 +136,11 @@ struct iio_backend_ops {
129136
size_t len);
130137
int (*debugfs_reg_access)(struct iio_backend *back, unsigned int reg,
131138
unsigned int writeval, unsigned int *readval);
139+
int (*ddr_enable)(struct iio_backend *back);
140+
int (*ddr_disable)(struct iio_backend *back);
141+
int (*data_stream_enable)(struct iio_backend *back);
142+
int (*data_stream_disable)(struct iio_backend *back);
143+
int (*data_transfer_addr)(struct iio_backend *back, u32 address);
132144
};
133145

134146
/**
@@ -164,6 +176,11 @@ int iio_backend_data_sample_trigger(struct iio_backend *back,
164176
int devm_iio_backend_request_buffer(struct device *dev,
165177
struct iio_backend *back,
166178
struct iio_dev *indio_dev);
179+
int iio_backend_ddr_enable(struct iio_backend *back);
180+
int iio_backend_ddr_disable(struct iio_backend *back);
181+
int iio_backend_data_stream_enable(struct iio_backend *back);
182+
int iio_backend_data_stream_disable(struct iio_backend *back);
183+
int iio_backend_data_transfer_addr(struct iio_backend *back, u32 address);
167184
ssize_t iio_backend_ext_info_set(struct iio_dev *indio_dev, uintptr_t private,
168185
const struct iio_chan_spec *chan,
169186
const char *buf, size_t len);

0 commit comments

Comments
 (0)