From: Marcelo Schmitt <marcelo.schmitt@analog.com>
To: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux@analog.com>
Cc: <jic23@kernel.org>, <Michael.Hennerich@analog.com>,
<nuno.sa@analog.com>, <eblanc@baylibre.com>,
<dlechner@baylibre.com>, <andy@kernel.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
<olivier.moysan@foss.st.com>, <marcelo.schmitt1@gmail.com>
Subject: [PATCH v1 1/5] iio: backend: Add calibration source interface
Date: Wed, 18 Nov 2026 10:03:17 -0300 [thread overview]
Message-ID: <67582938820d6f206006b16de71ad6bcdacfa863.1795003864.git.marcelo.schmitt@analog.com> (raw)
In-Reply-To: <cover.1795003864.git.marcelo.schmitt@analog.com>
Some ADC front-ends send data over a configurable number of LVDS serial
lanes and may also need to have the data frame calibrated before capture
can start.
Add a backend operation for selecting the calibration source (data lane or
data frame) so that device drivers can perform the calibration of both the
data frame and data lanes.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
drivers/iio/industrialio-backend.c | 23 +++++++++++++++++++++++
include/linux/iio/backend.h | 22 ++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index fbf5c39d7655..682d5f735071 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -869,6 +869,29 @@ int iio_backend_interface_data_align(struct iio_backend *back, u32 timeout_us)
}
EXPORT_SYMBOL_NS_GPL(iio_backend_interface_data_align, "IIO_BACKEND");
+/**
+ * iio_backend_calibration_source_set - Select the monitored error source
+ * @back: Backend device
+ * @source: Error source to monitor.
+ * @lane: Data lane to monitor. Only meaningful for
+ * %IIO_BACKEND_CALIB_SOURCE_DATA_LANE.
+ *
+ * Restrict the error reported through iio_backend_chan_status() to a single
+ * source of the digital interface so that each lane can be calibrated
+ * independently. Backends are expected to report every error source again
+ * once %IIO_BACKEND_CALIB_SOURCE_NONE is selected.
+ *
+ * RETURNS:
+ * 0 on success, negative error number on failure.
+ */
+int iio_backend_calibration_source_set(struct iio_backend *back,
+ enum iio_backend_calib_source source,
+ unsigned int lane)
+{
+ return iio_backend_op_call(back, calibration_source_set, source, lane);
+}
+EXPORT_SYMBOL_NS_GPL(iio_backend_calibration_source_set, "IIO_BACKEND");
+
/**
* iio_backend_num_lanes_set - Number of lanes enabled.
* @back: Backend device
diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h
index 9c16b695a602..6f28e2d016f7 100644
--- a/include/linux/iio/backend.h
+++ b/include/linux/iio/backend.h
@@ -76,6 +76,20 @@ enum iio_backend_interface_type {
IIO_BACKEND_INTERFACE_MAX
};
+/**
+ * enum iio_backend_calib_source - Digital interface error source
+ * @IIO_BACKEND_CALIB_SOURCE_NONE: Report every error source.
+ * @IIO_BACKEND_CALIB_SOURCE_DATA_LANE: Report errors of a single data lane.
+ * @IIO_BACKEND_CALIB_SOURCE_FRAME: Report errors of the frame signal.
+ * @IIO_BACKEND_CALIB_SOURCE_MAX: Number of error sources.
+ */
+enum iio_backend_calib_source {
+ IIO_BACKEND_CALIB_SOURCE_NONE,
+ IIO_BACKEND_CALIB_SOURCE_DATA_LANE,
+ IIO_BACKEND_CALIB_SOURCE_FRAME,
+ IIO_BACKEND_CALIB_SOURCE_MAX
+};
+
enum iio_backend_filter_type {
IIO_BACKEND_FILTER_TYPE_DISABLED,
IIO_BACKEND_FILTER_TYPE_SINC1,
@@ -132,6 +146,8 @@ enum iio_backend_capabilities {
* @debugfs_reg_access: Read or write register value of backend.
* @filter_type_set: Set filter type.
* @interface_data_align: Perform the data alignment process.
+ * @calibration_source_set: Select the error source monitored during
+ * interface calibration.
* @num_lanes_set: Set the number of lanes enabled.
* @crc_enable: Enable direction-specific CRC handling.
* @crc_disable: Disable direction-specific CRC handling.
@@ -190,6 +206,9 @@ struct iio_backend_ops {
int (*filter_type_set)(struct iio_backend *back,
enum iio_backend_filter_type type);
int (*interface_data_align)(struct iio_backend *back, u32 timeout_us);
+ int (*calibration_source_set)(struct iio_backend *back,
+ enum iio_backend_calib_source source,
+ unsigned int lane);
int (*num_lanes_set)(struct iio_backend *back, unsigned int num_lanes);
int (*crc_enable)(struct iio_backend *back);
int (*crc_disable)(struct iio_backend *back);
@@ -240,6 +259,9 @@ int devm_iio_backend_request_buffer(struct device *dev,
int iio_backend_filter_type_set(struct iio_backend *back,
enum iio_backend_filter_type type);
int iio_backend_interface_data_align(struct iio_backend *back, u32 timeout_us);
+int iio_backend_calibration_source_set(struct iio_backend *back,
+ enum iio_backend_calib_source source,
+ unsigned int lane);
int iio_backend_num_lanes_set(struct iio_backend *back, unsigned int num_lanes);
int iio_backend_crc_enable(struct iio_backend *back);
int iio_backend_crc_disable(struct iio_backend *back);
--
2.39.2
next prev parent reply other threads:[~2026-11-18 13:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 13:02 [PATCH v1 0/5] Add support for ADA4355 Marcelo Schmitt
2026-11-18 13:03 ` Marcelo Schmitt [this message]
2026-11-19 2:57 ` [PATCH v1 1/5] iio: backend: Add calibration source interface Jonathan Cameron
2026-11-19 20:33 ` Marcelo Schmitt
2026-11-18 13:03 ` [PATCH v1 2/5] dt-bindings: iio: adc: Add AXI ADA4355 IP CORE Marcelo Schmitt
2026-11-18 17:38 ` Conor Dooley
2026-11-18 13:03 ` [PATCH v1 3/5] iio: adc: adi-axi-adc: Support AXI ADA4355 IP core Marcelo Schmitt
2026-11-18 13:04 ` [PATCH v1 4/5] dt-bindings: iio: adc: Add ADA4355 Marcelo Schmitt
2026-11-18 17:39 ` Conor Dooley
2026-11-19 2:59 ` Jonathan Cameron
2026-11-19 14:53 ` Marcelo Schmitt
2026-11-18 13:04 ` [PATCH v1 5/5] iio: adc: Add support for ADA4355 and similar ADCs Marcelo Schmitt
2026-11-19 3:16 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67582938820d6f206006b16de71ad6bcdacfa863.1795003864.git.marcelo.schmitt@analog.com \
--to=marcelo.schmitt@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=eblanc@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@analog.com \
--cc=marcelo.schmitt1@gmail.com \
--cc=nuno.sa@analog.com \
--cc=olivier.moysan@foss.st.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®