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 v2 1/5] iio: backend: Add calibration source interface
Date: Fri, 27 Nov 2026 18:51:57 -0300 [thread overview]
Message-ID: <70219bef7a79a3e47fa80978d8007391dc317d95.1795816065.git.marcelo.schmitt@analog.com> (raw)
In-Reply-To: <cover.1795816065.git.marcelo.schmitt@analog.com>
Some ADC front-ends group and send data from a single channel over a
configurable number of LVDS serial lanes and may also need to perform a
data frame calibration before capture can start. During a channel interface
calibration, the front-end device driver usually requests the channel
status multiple times to find out the optimal calibration point.
However, the backend channel status interface doesn't provide which
specific serial lane or data frame flagged errors when they occur. The lack
of error source information prevents proper calibration of channels
comprised of multiple serial lanes.
Instead, the backend may have a separate error source mask configuration to
restrict which digital interface source will have its errors reported
through iio_backend_chan_status(). With that, each serial lane can be
calibrated independently, enabling multiple lane LVDS channels to be
properly calibrated and supported.
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. Backends are expected to report every error
source when IIO_BACKEND_CALIB_SOURCE_NONE is selected.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
drivers/iio/industrialio-backend.c | 28 ++++++++++++++++++++++++++++
include/linux/iio/backend.h | 22 ++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
index 7cc227818618..aaf11cceb145 100644
--- a/drivers/iio/industrialio-backend.c
+++ b/drivers/iio/industrialio-backend.c
@@ -869,6 +869,34 @@ 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 when
+ * @source == IIO_BACKEND_CALIB_SOURCE_DATA_LANE.
+ *
+ * Some ADC front-ends group and send data from a single channel over a
+ * configurable number of LVDS serial lanes and may also need to perform a data
+ * frame calibration before capture can start. However, the backend channel
+ * status interface doesn't provide which specific serial lane or data frame has
+ * flagged errors when they occur. Instead, the backend may have an error mask
+ * setting to restrict which digital interface source may have errors reported
+ * through iio_backend_chan_status(). This is useful for channels that are made
+ * out of multiple physical data lanes so that each data lane can be calibrated
+ * individually.
+ *
+ * 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 93d5f2073cc3..5a59bc1025da 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.53.0
next prev parent reply other threads:[~2026-11-27 21:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 21:51 [PATCH v2 0/5] Add support for ADA4355 Marcelo Schmitt
2026-11-27 21:51 ` Marcelo Schmitt [this message]
2026-11-27 21:52 ` [PATCH v2 2/5] dt-bindings: iio: adc: Add AXI ADA4355 IP CORE Marcelo Schmitt
2026-11-27 21:52 ` [PATCH v2 3/5] iio: adc: adi-axi-adc: Support AXI ADA4355 IP core Marcelo Schmitt
2026-11-27 21:52 ` [PATCH v2 4/5] dt-bindings: iio: adc: Add ADA4355 Marcelo Schmitt
2026-11-27 23:38 ` Jonathan Cameron
2026-11-27 21:53 ` [PATCH v2 5/5] iio: adc: Add support for ADA4355 and similar ADCs Marcelo Schmitt
2026-11-27 23:33 ` [PATCH v2 0/5] Add support for ADA4355 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=70219bef7a79a3e47fa80978d8007391dc317d95.1795816065.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®