[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241014094154.9439-2-antoniu.miclaus@analog.com>
Date: Mon, 14 Oct 2024 12:40:36 +0300
From: Antoniu Miclaus <antoniu.miclaus@...log.com>
To: Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich
<Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>, Rob
Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor
Dooley <conor+dt@...nel.org>, Nuno Sa <nuno.sa@...log.com>,
Olivier Moysan
<olivier.moysan@...s.st.com>,
Uwe Kleine-König
<ukleinek@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
David Lechner
<dlechner@...libre.com>,
Marcelo Schmitt <marcelo.schmitt@...log.com>,
Ivan
Mikhaylov <fr0st61te@...il.com>,
Mike Looijmans <mike.looijmans@...ic.nl>,
Dumitru Ceclan <mitrutzceclan@...il.com>,
Antoniu Miclaus
<antoniu.miclaus@...log.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Alisa-Dariana Roman
<alisadariana@...il.com>,
Sergiu Cuciurean <sergiu.cuciurean@...log.com>,
Dragos Bogdan <dragos.bogdan@...log.com>, <linux-iio@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-pwm@...r.kernel.org>
Subject: [PATCH v3 2/6] iio: backend: add support for data size set
Add backend support for setting the data size used.
This setting can be adjusted within the IP cores interfacing devices.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@...log.com>
---
no changes in v3.
drivers/iio/industrialio-backend.c | 21 +++++++++++++++++++++
include/linux/iio/backend.h | 3 +++
2 files changed, 24 insertions(+)
diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index ef1fd4cb0b24..2cb97c294ba7 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -473,6 +473,27 @@ int iio_backend_interface_type_get(struct iio_backend *back,
}
EXPORT_SYMBOL_NS_GPL(iio_backend_interface_type_get, IIO_BACKEND);
+/**
+ * iio_backend_data_size_set - set the data width/size in the data bus.
+ * @back: Backend device
+ * @size: Size in bits
+ *
+ * Some frontend devices can dynamically control the word/data size on the
+ * interface/data bus. Hence, the backend device needs to be aware of it so
+ * data can be correctly transferred.
+ *
+ * Return:
+ * 0 on success, negative error number on failure.
+ */
+size_t iio_backend_data_size_set(struct iio_backend *back, size_t size)
+{
+ if (!size)
+ return -EINVAL;
+
+ return iio_backend_op_call(back, data_size_set, size);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_data_size_set, IIO_BACKEND);
+
/**
* iio_backend_extend_chan_spec - Extend an IIO channel
* @indio_dev: IIO device
diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
index ad9fa0ada9b2..c2ffb61c5a92 100644
--- a/include/linux/iio/backend.h
+++ b/include/linux/iio/backend.h
@@ -90,6 +90,7 @@ enum iio_backend_interface_type {
* @ext_info_set: Extended info setter.
* @ext_info_get: Extended info getter.
* @interface_type_get: Interface type.
+ * @data_size_set: Data size.
**/
struct iio_backend_ops {
int (*enable)(struct iio_backend *back);
@@ -124,6 +125,7 @@ struct iio_backend_ops {
const struct iio_chan_spec *chan, char *buf);
int (*interface_type_get)(struct iio_backend *back,
enum iio_backend_interface_type *type);
+ int (*data_size_set)(struct iio_backend *back, ssize_t size);
};
int iio_backend_chan_enable(struct iio_backend *back, unsigned int chan);
@@ -155,6 +157,7 @@ ssize_t iio_backend_ext_info_get(struct iio_dev *indio_dev, uintptr_t private,
int iio_backend_interface_type_get(struct iio_backend *back,
enum iio_backend_interface_type *type);
+size_t iio_backend_data_size_set(struct iio_backend *back, size_t size);
int iio_backend_extend_chan_spec(struct iio_dev *indio_dev,
struct iio_backend *back,
struct iio_chan_spec *chan);
--
2.46.2
Powered by blists - more mailing lists