* Re: [PATCH 4/5] dt-bindings: arm: mediatek: Add MT8127 Amazon ford
From: sashiko-bot @ 2026-06-17 2:29 UTC (permalink / raw)
To: Zakariya Hadrami via B4 Relay; +Cc: devicetree, linux-watchdog, robh, conor+dt
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-4-d02ad15ac359@proton.me>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The device tree compatible block for `amazon,ford` is incorrectly sorted. The file specifies that entries should be sorted by SoC compatible and then alphabetically by board compatible. Because `amazon,ford` and `mediatek,mt8127-moose` share the same SoC compatible (`mediatek,mt8127`), `amazon,ford` should be placed before `mediatek,mt8127-moose`.
--
commit 5d4dd6329b44b144dcfbe78c4a1cf82524b51ef6
Author: Zakariya Hadrami <zkh1@proton.me>
dt-bindings: arm: mediatek: Add MT8127 Amazon ford
This commit adds the device tree binding for the Amazon ford tablet based
on the MediaTek MT8127 SoC.
> diff --git a/Documentation/devicetree/bindings/arm/mediatek.yaml b/Documentation/devicetree/bindings/arm/mediatek.yaml
> index 382d0eb4d0af6..5ddc79689df91 100644
> --- a/Documentation/devicetree/bindings/arm/mediatek.yaml
> +++ b/Documentation/devicetree/bindings/arm/mediatek.yaml
> @@ -124,6 +124,10 @@ properties:
> - enum:
> - mediatek,mt8127-moose
> - const: mediatek,mt8127
> + - items:
> + - enum:
> + - amazon,ford
> + - const: mediatek,mt8127
[Severity: Low]
This isn't a bug, but should the amazon,ford board compatible block be
inserted alphabetically before mediatek,mt8127-moose? Since both share the
mediatek,mt8127 SoC compatible, sorting alphabetically by the board
compatible would usually place amazon,ford first.
> - items:
> - enum:
> - mediatek,mt8135-evbp1
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me?part=4
^ permalink raw reply
* [PATCH 5/5] dt-bindings: watchdog: mediatek: Add MT8127
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me>
From: Zakariya Hadrami <zkh1@proton.me>
Add entry for MT8127 SoC's watchdog which is compatible with MT6589's
one.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
index 953629cb9558..e6e4546da0aa 100644
--- a/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/mediatek,mtk-wdt.yaml
@@ -40,6 +40,7 @@ properties:
- mediatek,mt7622-wdt
- mediatek,mt7623-wdt
- mediatek,mt7629-wdt
+ - mediatek,mt8127-wdt
- mediatek,mt8173-wdt
- mediatek,mt8188-wdt
- mediatek,mt8189-wdt
--
2.54.0
^ permalink raw reply related
* [PATCH 4/5] dt-bindings: arm: mediatek: Add MT8127 Amazon ford
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me>
From: Zakariya Hadrami <zkh1@proton.me>
Add entry for the MT8127 based Amazon ford tablet.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
Documentation/devicetree/bindings/arm/mediatek.yaml | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/mediatek.yaml b/Documentation/devicetree/bindings/arm/mediatek.yaml
index 382d0eb4d0af..5ddc79689df9 100644
--- a/Documentation/devicetree/bindings/arm/mediatek.yaml
+++ b/Documentation/devicetree/bindings/arm/mediatek.yaml
@@ -124,6 +124,10 @@ properties:
- enum:
- mediatek,mt8127-moose
- const: mediatek,mt8127
+ - items:
+ - enum:
+ - amazon,ford
+ - const: mediatek,mt8127
- items:
- enum:
- mediatek,mt8135-evbp1
--
2.54.0
^ permalink raw reply related
* [PATCH 0/5] ARM: Basic support for Amazon ford tablet (MT8127)
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
This series of patches adds basic support for MT8127 SoC based Amazon ford
tablet and fixes a small indentation error in the dtsi file.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
Zakariya Hadrami (5):
ARM: dts: mediatek: mt8127: Fix indentation error
ARM: dts: mediatek: mt8127: Add watchdog support
ARM: dts: mediatek: Add basic support for Amazon ford board
dt-bindings: arm: mediatek: Add MT8127 Amazon ford
dt-bindings: watchdog: mediatek: Add MT8127
.../devicetree/bindings/arm/mediatek.yaml | 4 ++
.../bindings/watchdog/mediatek,mtk-wdt.yaml | 1 +
arch/arm/boot/dts/mediatek/Makefile | 1 +
arch/arm/boot/dts/mediatek/mt8127-amazon-ford.dts | 46 ++++++++++++++++++++++
arch/arm/boot/dts/mediatek/mt8127.dtsi | 9 ++++-
5 files changed, 60 insertions(+), 1 deletion(-)
---
base-commit: 8cd9520d35a6c38db6567e97dd93b1f11f185dc6
change-id: 20260616-mt8127-amazon-ford-basic-1509d7052f7e
Best regards,
--
Zakariya Hadrami <zkh1@proton.me>
^ permalink raw reply
* [PATCH 2/5] ARM: dts: mediatek: mt8127: Add watchdog support
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me>
From: Zakariya Hadrami <zkh1@proton.me>
Add watchdog node and disable it by default as it was not present
initially.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
arch/arm/boot/dts/mediatek/mt8127.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/boot/dts/mediatek/mt8127.dtsi b/arch/arm/boot/dts/mediatek/mt8127.dtsi
index bd61ec7e70c0..1855dda42710 100644
--- a/arch/arm/boot/dts/mediatek/mt8127.dtsi
+++ b/arch/arm/boot/dts/mediatek/mt8127.dtsi
@@ -159,5 +159,12 @@ uart3: serial@11005000 {
clocks = <&uart_clk>;
status = "disabled";
};
+
+ watchdog: watchdog@10007000 {
+ compatible = "mediatek,mt8127-wdt","mediatek,mt6589-wdt";
+ reg = <0 0x10007000 0 0x100>;
+ interrupts = <GIC_SPI 88 IRQ_TYPE_LEVEL_LOW>;
+ status = "disabled";
+ };
};
};
--
2.54.0
^ permalink raw reply related
* [PATCH 1/5] ARM: dts: mediatek: mt8127: Fix indentation error
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me>
From: Zakariya Hadrami <zkh1@proton.me>
Fix an indentation error caused by a space at the start of a line.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
arch/arm/boot/dts/mediatek/mt8127.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/mediatek/mt8127.dtsi b/arch/arm/boot/dts/mediatek/mt8127.dtsi
index aced173c2a52..bd61ec7e70c0 100644
--- a/arch/arm/boot/dts/mediatek/mt8127.dtsi
+++ b/arch/arm/boot/dts/mediatek/mt8127.dtsi
@@ -75,7 +75,7 @@ uart_clk: dummy26m {
compatible = "fixed-clock";
clock-frequency = <26000000>;
#clock-cells = <0>;
- };
+ };
};
timer {
--
2.54.0
^ permalink raw reply related
* [PATCH 3/5] ARM: dts: mediatek: Add basic support for Amazon ford board
From: Zakariya Hadrami via B4 Relay @ 2026-06-17 2:20 UTC (permalink / raw)
To: Matthias Brugger, AngeloGioacchino Del Regno, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Sean Wang, Wim Van Sebroeck,
Guenter Roeck
Cc: linux-kernel, linux-arm-kernel, linux-mediatek, devicetree,
linux-watchdog, Zakariya Hadrami
In-Reply-To: <20260617-mt8127-amazon-ford-basic-v1-0-d02ad15ac359@proton.me>
From: Zakariya Hadrami <zkh1@proton.me>
This tablet uses a MediaTek MT8127 system-on-chip with 1GB of RAM.
It can currently boot into initramfs with a working UART and
Simple Framebuffer using already initialized panel by the bootloader.
Signed-off-by: Zakariya Hadrami <zkh1@proton.me>
---
arch/arm/boot/dts/mediatek/Makefile | 1 +
arch/arm/boot/dts/mediatek/mt8127-amazon-ford.dts | 46 +++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/arch/arm/boot/dts/mediatek/Makefile b/arch/arm/boot/dts/mediatek/Makefile
index 37c4cded0eae..a610bc75c7d9 100644
--- a/arch/arm/boot/dts/mediatek/Makefile
+++ b/arch/arm/boot/dts/mediatek/Makefile
@@ -14,5 +14,6 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7623n-rfb-emmc.dtb \
mt7623n-bananapi-bpi-r2.dtb \
mt7629-rfb.dtb \
+ mt8127-amazon-ford.dtb \
mt8127-moose.dtb \
mt8135-evbp1.dtb
diff --git a/arch/arm/boot/dts/mediatek/mt8127-amazon-ford.dts b/arch/arm/boot/dts/mediatek/mt8127-amazon-ford.dts
new file mode 100644
index 000000000000..21bdab0e43f8
--- /dev/null
+++ b/arch/arm/boot/dts/mediatek/mt8127-amazon-ford.dts
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/dts-v1/;
+#include "mt8127.dtsi"
+
+/ {
+ model = "MediaTek MT8127 Amazon Ford";
+ compatible = "amazon,ford", "mediatek,mt8127";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:921600n8";
+
+ framebuffer0: framebuffer@b7a00000 {
+ compatible = "simple-framebuffer";
+ memory-region = <&framebuffer_reserved>;
+ width = <1024>;
+ height = <600>;
+ stride = <(1024 * 2)>;
+ format = "r5g6b5";
+ };
+ };
+
+ memory@80000000 {
+ device_type = "memory";
+ reg = <0 0x80000000 0 0x40000000>;
+ };
+
+ reserved-memory {
+ framebuffer_reserved: framebuffer@b7a00000 {
+ reg = <0 0xb7a00000 0 0x1000000>;
+ no-map;
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&watchdog {
+ status = "okay";
+};
--
2.54.0
^ permalink raw reply related
* Re: [PATCH v3 5/5] iio: adc: ltc2378: Enable triggered buffer data capture
From: sashiko-bot @ 2026-06-17 2:18 UTC (permalink / raw)
To: Marcelo Schmitt; +Cc: conor+dt, robh, devicetree
In-Reply-To: <22248e8ba646fbe8edfc87e2b9be527632d5b48c.1781661028.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Triggered buffer setup fallback is unreachable when SPI offload support is compiled in, causing driver probe to fail on systems without SPI offload hardware.
- [High] The triggered buffer pushes misaligned data on big-endian architectures, yielding constant zero readings for 16-bit parts.
- [Low] The newly added file `ltc2378-triggered-buffer.c` uses `#include <ltc2378.h>` instead of `#include "ltc2378.h"`, causing a compile error.
--
commit 975300646e8809a19fe7c482edd698d128476317
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
iio: adc: ltc2378: Enable triggered buffer data capture
Enable users to run triggered data captures with LTC2378 and similar ADCs.
> diff --git a/drivers/iio/adc/ltc2378-lib-core.c b/drivers/iio/adc/ltc2378-lib-core.c
> index 1160f4324d019..ec83e9f2ae81c 100644
> --- a/drivers/iio/adc/ltc2378-lib-core.c
> +++ b/drivers/iio/adc/ltc2378-lib-core.c
> @@ -18,7 +18,7 @@ int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st
>
> ret = __ltc2378_set_offload_ops(st);
> if (ret == -EOPNOTSUPP)
> - return 0; /* Let device setup complete without buffer support */
> + goto trigger_buf_setup;
>
> if (!ret)
> ret = st->ops->buffer_setup(indio_dev, st);
>
> if (ret)
> return dev_err_probe(dev, ret, "error on SPI offload setup\n");
[Severity: High]
If CONFIG_LTC2378_LIB_OFFLOAD_BUFFER is enabled, does __ltc2378_set_offload_ops()
unconditionally return 0?
If so, the fallback condition if (ret == -EOPNOTSUPP) is never met. The driver
then calls st->ops->buffer_setup(), which maps to ltc2378_offload_buffer_setup.
If the device lacks an SPI offload engine in the device tree,
devm_spi_offload_get() will return -ENODEV, failing the probe entirely.
Does this code prevent the driver from gracefully falling back to triggered
buffers on non-offload setups?
[ ... ]
> diff --git a/drivers/iio/adc/ltc2378-triggered-buffer.c b/drivers/iio/adc/ltc2378-triggered-buffer.c
> new file mode 100644
> index 0000000000000..d1d788fb5cb4f
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378-triggered-buffer.c
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2026 Analog Devices, Inc.
> + * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
> + */
> +
> +#include <linux/iio/buffer.h>
> +#include <linux/iio/triggered_buffer.h>
> +#include <linux/iio/trigger_consumer.h>
> +
> +#include <ltc2378.h>
[Severity: Low]
Does this include directive cause a compile error because it uses angle
brackets?
In C, #include <...> instructs the preprocessor to search standard system
directories. Because ltc2378.h resides in the local subsystem directory
drivers/iio/adc/ and the IIO Makefile does not add -I$(src), compilation
fails with a missing file error.
> +static irqreturn_t ltc2378_trigger_handler(int irq, void *p)
> +{
> + struct iio_poll_func *pf = p;
> + struct iio_dev *indio_dev = pf->indio_dev;
> + struct ltc2378_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + ret = ltc2378_convert_and_acquire(st);
> + if (ret < 0)
> + goto err_out;
> +
> + iio_push_to_buffers_with_ts(indio_dev, &st->scan, sizeof(st->scan),
> + pf->timestamp);
[Severity: High]
Does this code push misaligned data on big-endian architectures, resulting
in constant zero readings for 16-bit parts?
The IIO channel specifies storagebits = 32 and shift = 0, so consumers expect
a 32-bit native-endian value with data in the lowest 16 bits.
During ltc2378_trigger_handler(), spi_sync_transfer() with bits_per_word = 16
stores the 16-bit sample in CPU byte order at the start of the st->scan.data
union (sample_buf16).
On little-endian systems, this natively aligns with the lower 16 bits of the
32-bit container. However, on big-endian systems, the 16-bit sample occupies
the most significant bytes of the 32-bit word.
When the IIO core processes this as a 32-bit word, the data sits in the upper
16 bits while the lower 16 bits remain zero. Since scan_type.shift is 0,
masking the lower 16 bits results in the consumer incorrectly receiving zero
for every sample.
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1781661028.git.marcelo.schmitt@analog.com?part=5
^ permalink raw reply
* Re: [PATCH v3 4/5] iio: adc: ltc2378: Enable high-speed data capture
From: sashiko-bot @ 2026-06-17 2:17 UTC (permalink / raw)
To: Marcelo Schmitt; +Cc: devicetree, conor+dt, robh
In-Reply-To: <9f173c47928446aa3e900cf0becb6130dd76846b.1781661028.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Unconditional propagation of -ENODEV breaks driver probe on systems without SPI offload
- [High] Silent failure in SPI offload trigger offset validation loop risks data corruption
- [Medium] Incomplete state rollback on failed conversion rate validation corrupts driver state
- [Low] Missing source file causes build failure
- [Low] Accumulative drift of PWM period due to reusing modified waveform structure
--
commit 0bb089e96af6d65eeaa13775a0321f6c17a80b75
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
iio: adc: ltc2378: Enable high-speed data capture
Make use of SPI transfer offloading to speed up data capture, enabling data
acquisition at faster sample rates (up to 2 MSPS).
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index 2b82034513673..f96d9262b891d 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -944,6 +944,9 @@ config LTC2378
> tristate "Analog Devices LTC2378 ADC driver"
> depends on SPI
> depends on GPIOLIB
> + select LTC2378_LIB
> + select LTC2378_LIB_OFFLOAD_BUFFER if SPI_OFFLOAD && PWM && SPI_OFFLOAD_TRIGGER_PWM && IIO_BUFFER && IIO_BUFFER_DMAENGINE
> + select LTC2378_LIB_TRIGGERED_BUFFER if IIO_BUFFER
[ ... ]
> diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
> index 1814fb78dde30..109cd39237c9d 100644
> --- a/drivers/iio/adc/Makefile
> +++ b/drivers/iio/adc/Makefile
> @@ -82,6 +82,12 @@ obj-$(CONFIG_LPC18XX_ADC) += lpc18xx_adc.o
> obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o
> obj-$(CONFIG_LTC2309) += ltc2309.o
> obj-$(CONFIG_LTC2378) += ltc2378.o
> +
> +ltc2378_lib-y += ltc2378-lib-core.o
> +ltc2378_lib-$(CONFIG_LTC2378_LIB_OFFLOAD_BUFFER) += ltc2378-offload-buffer.o
> +ltc2378_lib-$(CONFIG_LTC2378_LIB_TRIGGERED_BUFFER) += ltc2378-triggered-buffer.o
[Severity: Low]
Will this break the build since ltc2378-triggered-buffer.c is not included
in this patch?
The patch adds CONFIG_LTC2378_LIB_TRIGGERED_BUFFER and references
ltc2378-triggered-buffer.o in the Makefile, which is automatically selected if
IIO_BUFFER is enabled. However, the corresponding ltc2378-triggered-buffer.c
file is missing.
This regression was fixed later in the series in commit
975300646e8809a19fe7c482edd698d128476317 ("iio: adc: ltc2378: Enable triggered
buffer data capture"), but shouldn't each patch in the series compile
independently to preserve bisectability?
[ ... ]
> diff --git a/drivers/iio/adc/ltc2378-lib-core.c b/drivers/iio/adc/ltc2378-lib-core.c
> new file mode 100644
> index 0000000000000..1160f4324d019
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378-lib-core.c
> @@ -0,0 +1,35 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Analog Devices LTC2378 ADC series driver
> + *
> + * Copyright (C) 2026 Analog Devices Inc.
> + * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
> + */
> +
> +#include <linux/err.h>
> +#include <linux/iio/iio.h>
> +
> +#include "ltc2378.h"
> +
> +int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st)
> +{
> + struct device *dev = &st->spi->dev;
> + int ret;
> +
> + ret = __ltc2378_set_offload_ops(st);
> + if (ret == -EOPNOTSUPP)
> + return 0; /* Let device setup complete without buffer support */
> +
> + if (!ret)
> + ret = st->ops->buffer_setup(indio_dev, st);
> +
> + if (ret)
> + return dev_err_probe(dev, ret, "error on SPI offload setup\n");
> +
> + return 0;
> +}
[ ... ]
> diff --git a/drivers/iio/adc/ltc2378-offload-buffer.c b/drivers/iio/adc/ltc2378-offload-buffer.c
> new file mode 100644
> index 0000000000000..3e8c7ab64a54b
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378-offload-buffer.c
> @@ -0,0 +1,305 @@
[ ... ]
> +static int ltc2378_offload_buffer_setup(struct iio_dev *indio_dev,
> + struct ltc2378_state *st)
> +{
> + struct spi_device *spi = st->spi;
> + struct device *dev = &spi->dev;
> + int ret;
> +
> + st->offload = devm_spi_offload_get(dev, spi, <c2378_offload_config);
> + ret = PTR_ERR_OR_ZERO(st->offload);
> + if (ret)
> + return ret;
[Severity: High]
Does this unconditionally propagate -ENODEV and break the driver probe on
systems without SPI offload?
When CONFIG_LTC2378_LIB_OFFLOAD_BUFFER is enabled, the driver attempts to set
up the SPI offload buffer. If the system hardware does not support SPI offload,
devm_spi_offload_get() returns -ENODEV.
Because ltc2378_offload_buffer_setup() returns this error,
ltc2378_lib_buffer_setup() will pass it to dev_err_probe() and fail the entire
ADC probe. Should the driver treat -ENODEV as a signal to bypass offload setup
and gracefully fall back to triggered buffer or direct mode?
[ ... ]
> +static int ltc2378_update_conversion_rate(struct ltc2378_state *st, int freq_Hz)
> +{
> + struct spi_offload_trigger_config *config = &st->offload_trigger_config;
> + unsigned int min_read_offset, offload_period_ns;
> + struct pwm_waveform cnv_wf = { };
> + u64 target = LTC2378_TCNV_HIGH_NS;
> + unsigned int count = 0;
> + u64 offload_offset_ns;
> + int ret;
> +
> + if (freq_Hz == 0)
> + return -EINVAL;
> +
> + if (freq_Hz < 1 || freq_Hz > st->info->max_sample_rate_hz)
> + return -ERANGE;
> +
> + /* Configure CNV PWM waveform */
> + cnv_wf.period_length_ns = DIV_ROUND_CLOSEST(NSEC_PER_SEC, freq_Hz);
> +
> + /*
> + * Ensure CNV high time meets minimum requirement (20ns). The PWM
> + * hardware may round the duty cycle, so iterate until we get at least
> + * the minimum required high time.
> + */
> + do {
> + cnv_wf.duty_length_ns = target;
> + ret = pwm_round_waveform_might_sleep(st->cnv_trigger, &cnv_wf);
> + if (ret)
> + return ret;
> + target += 10; /* Increment by PWM duty cycle period */
> + } while (count++ < 100 && cnv_wf.duty_length_ns < LTC2378_TCNV_HIGH_NS);
[Severity: Low]
Could this cause an accumulative drift of the PWM period?
In this loop, pwm_round_waveform_might_sleep(&cnv_wf) can modify fields in
cnv_wf based on hardware rounding capabilities. Because cnv_wf.period_length_ns
is not reset to the original target period at the beginning of each iteration,
any rounding applied to the period in one iteration is passed into the next,
which might drift the PWM period away from the requested frequency.
> +
> + /* Double check the minimum CNV high time is met */
> + if (cnv_wf.duty_length_ns < LTC2378_TCNV_HIGH_NS)
> + return -EIO;
> +
> + /*
> + * Configure SPI offload PWM trigger.
> + * The trigger should fire after tBUSYLH + tCONV + tDSDOBUSYL.
> + * Minimum time needed: TBUSYLH (13ns) + TCONV (part-specific) + TDSDOBUSYL (5ns)
> + *
> + * Use the same period as CNV PWM to avoid timing issues.
> + * Convert back from period to frequency for the SPI offload API.
> + */
> + offload_period_ns = cnv_wf.period_length_ns;
> + config->periodic.frequency_hz = DIV_ROUND_UP(HZ_PER_GHZ, offload_period_ns);
> + min_read_offset = LTC2378_TBUSYLH_NS + st->info->tconv_ns + LTC2378_TDSDOBUSYL_NS;
> + offload_offset_ns = min_read_offset;
> + count = 0;
> + do {
> + config->periodic.offset_ns = offload_offset_ns;
> + ret = spi_offload_trigger_validate(st->offload_trigger, config);
> + if (ret)
> + return ret;
[Severity: Medium]
Does returning here leave the driver in an inconsistent state?
The pointer config directly points to the device state
st->offload_trigger_config. If validation fails, returning an error immediately
leaves st->offload_trigger_config containing the rejected values, while
st->cnv_wf and st->cnv_Hz retain their old values.
Subsequent buffer enable operations might try to pair the old PWM waveform
with the corrupted offload trigger config. Shouldn't the state be modified
on a local copy and only committed upon success?
> + offload_offset_ns += 10;
> + } while (count++ < 100 && config->periodic.offset_ns < min_read_offset);
> +
> + st->cnv_wf = cnv_wf;
> + st->cnv_Hz = DIV_ROUND_CLOSEST_ULL(HZ_PER_GHZ, cnv_wf.period_length_ns);
> +
> + return 0;
[Severity: High]
Is it possible for this to silently return 0 on a failed loop condition?
The loop iterates up to 100 times to find an SPI offload trigger offset >=
min_read_offset. If the underlying hardware driver continually rounds the
offset down such that it never reaches min_read_offset, the loop drops out
after 100 iterations.
The function then unconditionally returns 0 (success). This would configure
the SPI offload to trigger an SPI read before the ADC finishes its conversion,
leading to corrupted data. Should this check if
config->periodic.offset_ns >= min_read_offset after the loop and return an
error if it fails?
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1781661028.git.marcelo.schmitt@analog.com?part=4
^ permalink raw reply
* Re: [PATCH v3 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
From: sashiko-bot @ 2026-06-17 2:16 UTC (permalink / raw)
To: Marcelo Schmitt; +Cc: robh, conor+dt, devicetree
In-Reply-To: <5c18e7a370119ddfd5faefe147b294b39f78894a.1781661028.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Unsupported SPI bits_per_word values for 18-bit and 20-bit ADCs.
- [High] Logic Error: Keeping CNV high during SPI transfer outputs BUSY flags instead of data.
- [High] Data Corruption: Buffered reads for 16-bit parts always return 0 on big-endian architectures.
- [Medium] ABI Violation: Non-standard sysfs attribute name without channel index.
- [Medium] Missing Kconfig dependency on REGULATOR causes unconditional probe failure.
--
commit 30af41465781d1df468bbb782a984208c0789b78
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
Support for LTC2378-20 and similar analog-to-digital converters. Co-developed
by Ioan-Daniel Pop.
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index a3a93a47b43d9..2b82034513673 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
[ ... ]
> @@ -940,6 +940,17 @@ config LTC2309
> This driver can also be built as a module. If so, the module will
> be called ltc2309.
>
> +config LTC2378
> + tristate "Analog Devices LTC2378 ADC driver"
> + depends on SPI
> + depends on GPIOLIB
[Severity: Medium]
Should this Kconfig entry also depend on REGULATOR?
The probe function unconditionally calls devm_regulator_get_enable_read_voltage()
and fails if it returns an error. If the kernel is built with CONFIG_REGULATOR
disabled, the regulator API is stubbed out to return -ENODEV, making it
structurally impossible for the driver to successfully probe.
> diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
> new file mode 100644
> index 0000000000000..88582bdcd6a62
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378.c
[ ... ]
> +static int ltc2378_probe(struct spi_device *spi)
> +{
[ ... ]
> + st->chans[st->num_iio_chans++] = (struct iio_chan_spec) {
> + .type = IIO_VOLTAGE,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_SCALE),
> + .scan_index = 0,
[Severity: Medium]
Does this channel specification need .indexed = 1 and .channel = 0?
Without the index, the IIO core exposes the sysfs attribute as in_voltage_raw
instead of in_voltage0_raw. The IIO ABI documentation strictly mandates that
the number must always be specified and unique to allow association with event
codes, so this non-standard naming breaks compatibility with generic userspace
clients.
> + .scan_type = {
> + .format = st->info->bipolar ? IIO_SCAN_FORMAT_SIGNED_INT :
> + IIO_SCAN_FORMAT_UNSIGNED_INT,
> + .realbits = st->info->resolution,
> + /*
> + * Buffer elements could be 16-bit for low precision
> + * parts. Though, using more storage bits allows keeping
> + * the same scan_type configuration for both types of
> + * buffer support.
> + */
> + .storagebits = 32,
> + },
[Severity: High]
Will this configuration cause buffered reads for 16-bit parts to return 0 on
big-endian architectures?
For 16-bit parts, the SPI transfer writes 2 bytes to the 32-bit union. On
big-endian architectures, these 2 bytes are written to the most significant
bytes of the 32-bit space. However, setting storagebits = 32 with an implicit
shift of 0 causes the IIO core to extract the lower 16 bits (which remain 0).
This causes the IIO core to persistently push 0 to the buffers.
> + };
> +
> + st->xfer.rx_buf = &st->scan.data;
> + st->xfer.len = st->info->resolution > 16 ? 4 : 2;
> + st->xfer.bits_per_word = st->info->resolution;
[Severity: High]
Is it safe to set bits_per_word directly to 18 or 20?
The SPI core validates bits_per_word against the controller's bits_per_word_mask
during transfer. Since the vast majority of SPI controllers only support 8, 16,
or 32 bits per word, setting this to 18 or 20 will cause spi_sync_transfer() to
immediately fail with -EINVAL, breaking data capture on standard hardware.
> diff --git a/drivers/iio/adc/ltc2378.h b/drivers/iio/adc/ltc2378.h
> new file mode 100644
> index 0000000000000..a3a69351de6ce
> --- /dev/null
> +++ b/drivers/iio/adc/ltc2378.h
[ ... ]
> +static inline int ltc2378_convert_and_acquire(struct ltc2378_state *st)
> +{
> + int ret;
> +
> + /* Cause a rising edge of CNV to initiate a new ADC conversion */
> + gpiod_set_value_cansleep(st->cnv_gpio, 1);
> + fsleep(4);
> + ret = spi_sync_transfer(st->spi, &st->xfer, 1);
> + gpiod_set_value_cansleep(st->cnv_gpio, 0);
> +
> + return ret;
> +}
[Severity: High]
Does keeping the CNV pin high during the SPI transfer cause the ADC to output
BUSY flags instead of conversion data?
For the LTC2378 series, bringing the Chip Select low while CNV is still high
places the ADC into a BUSY indicator mode instead of shifting out the sampled
data. Should CNV be brought low before initiating the SPI transfer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1781661028.git.marcelo.schmitt@analog.com?part=2
^ permalink raw reply
* Re: [RFC PATCH v3 3/5] iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs attributes
From: sashiko-bot @ 2026-06-17 2:13 UTC (permalink / raw)
To: Marcelo Schmitt; +Cc: robh, conor+dt, devicetree
In-Reply-To: <a09f2cac2d26fe385f1f7790b0db64b7d9953ac6.1781661028.git.marcelo.schmitt@analog.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [Critical] Unconditional assignment of `buffer->attrs` overwrites the default DMAengine buffer attributes, removing `length_align_bytes` from sysfs and breaking the userspace ABI.
Pre-existing issues:
- [High] The ad4691 driver manually overwrites the IIO buffer's `attrs` field after setup, clobbering the generic DMAengine buffer attributes.
--
commit e15805cbfeb85d6ab2a3f8819279738d4402da62
Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs attributes
This patch extends the IIO DMAengine buffer setup interfaces to accept an
additional parameter for extra sysfs attributes. It updates all existing
callers to pass NULL for this new parameter.
> diff --git a/drivers/iio/adc/ad4691.c b/drivers/iio/adc/ad4691.c
> --- a/drivers/iio/adc/ad4691.c
> +++ b/drivers/iio/adc/ad4691.c
> @@ -1980,7 +1980,8 @@ static int ad4691_setup_offload(struct iio_dev *indio_dev,
> indio_dev->setup_ops = &ad4691_cnv_burst_offload_buffer_setup_ops;
>
> ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
> - IIO_BUFFER_DIRECTION_IN);
> + IIO_BUFFER_DIRECTION_IN,
> + NULL);
[Severity: High]
This is a pre-existing issue, but does manually assigning the buffer attributes
further down in this function clobber the generic DMAengine buffer attributes?
Following this setup call in ad4691_setup_offload(), the driver manually
assigns:
indio_dev->buffer->attrs = ad4691_buffer_attrs;
Could this overwrite the default DMAengine buffer attributes like
length_align_bytes? Since the new API allows injecting custom attributes,
should this driver be updated to pass ad4691_buffer_attrs into
devm_iio_dmaengine_buffer_setup_with_handle() rather than passing NULL and
manually overwriting it afterwards?
> if (ret)
> return ret;
>
[ ... ]
> diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> --- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> +++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
> @@ -289,7 +289,8 @@ EXPORT_SYMBOL_NS_GPL(iio_dmaengine_buffer_teardown, "IIO_DMAENGINE_BUFFER");
> static struct iio_buffer
> *__iio_dmaengine_buffer_setup_ext(struct iio_dev *indio_dev,
> struct dma_chan *chan,
> - enum iio_buffer_direction dir)
> + enum iio_buffer_direction dir,
> + const struct iio_dev_attr **buffer_attrs)
> {
> struct iio_buffer *buffer;
> int ret;
> @@ -301,6 +302,7 @@ static struct iio_buffer
> indio_dev->modes |= INDIO_BUFFER_HARDWARE;
>
> buffer->direction = dir;
> + buffer->attrs = buffer_attrs;
[Severity: Critical]
Does unconditionally overwriting buffer->attrs here remove the default
DMAengine buffer attributes?
Since iio_dmaengine_buffer_alloc() sets up the default attributes array
(which exposes length_align_bytes to userspace), and all current callers
updated in this patch pass NULL for buffer_attrs, it appears this will
silently delete length_align_bytes from sysfs for all IIO DMAengine buffers.
Could this break the userspace ABI, as applications might rely on
length_align_bytes to determine the required memory alignment for DMA
buffers?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1781661028.git.marcelo.schmitt@analog.com?part=3
^ permalink raw reply
* Re: [PATCH v3 2/2] drm/tiny: add support for PIXPAPER 4.26 monochrome e-ink panel
From: LiangCheng Wang @ 2026-06-17 2:09 UTC (permalink / raw)
To: Devarsh Thakkar, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Wig Cheng
Cc: dri-devel, devicetree, linux-kernel, Tomi Valkeinen,
LiangCheng Wang
In-Reply-To: <423c3dca-9589-488d-8462-c3d51f05ee4a@ti.com>
Hi Devarsh,
Thanks, that sounds great -- let's converge on panel-ssd16xx.c.
> Yes, I will be adding SSD1677 controller support in V2 of my series,
> hopefully that should help and after that it's just a matter of adding
> panel entry for your pixpaper panel. I can share you my branch with
> ssd1677 support once I have it ready.
That would be very helpful, please do share the branch once it's ready. I
have the PIXPAPER 4.26 hardware here, so I can validate the SSD1677 support
and the panel on real hardware and report back any quirks.
> additionally I can quickly add boilerplate pixpaper 4.26 panel entries on
> top of my V2 series referring from your patch so that it switches to using
> standard ssd16xx commands and ssd1677 quirks wherever necessary and you can
> then validate and modify.
Thanks for offering. If it's alright with you, I'd like to take the
pixpaper-426m panel entry through review myself on top of your series, using
your boilerplate as a starting point, since I can carry the validation on
real hardware. I'll credit your help with Co-developed-by/Suggested-by as
appropriate. Happy to arrange it whichever way is easiest for you.
I'll also follow up with the 0xF7/0xFF test result so we can capture the
correct SSD1677 update-sequence quirk.
Regards,
LiangCheng
^ permalink raw reply
* [PATCH v3 5/5] iio: adc: ltc2378: Enable triggered buffer data capture
From: Marcelo Schmitt @ 2026-06-17 2:04 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
In-Reply-To: <cover.1781661028.git.marcelo.schmitt@analog.com>
Enable users to run triggered data captures with LTC2378 and similar ADCs.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
Change log v2 -> v3:
- Extracted from main driver file into a separate buffer-specific containment.
drivers/iio/adc/ltc2378-lib-core.c | 17 +++++++-
drivers/iio/adc/ltc2378-triggered-buffer.c | 49 ++++++++++++++++++++++
drivers/iio/adc/ltc2378.h | 15 +++++++
3 files changed, 80 insertions(+), 1 deletion(-)
create mode 100644 drivers/iio/adc/ltc2378-triggered-buffer.c
diff --git a/drivers/iio/adc/ltc2378-lib-core.c b/drivers/iio/adc/ltc2378-lib-core.c
index 1160f4324d01..ec83e9f2ae81 100644
--- a/drivers/iio/adc/ltc2378-lib-core.c
+++ b/drivers/iio/adc/ltc2378-lib-core.c
@@ -18,7 +18,7 @@ int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st
ret = __ltc2378_set_offload_ops(st);
if (ret == -EOPNOTSUPP)
- return 0; /* Let device setup complete without buffer support */
+ goto trigger_buf_setup;
if (!ret)
ret = st->ops->buffer_setup(indio_dev, st);
@@ -27,6 +27,21 @@ int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st
return dev_err_probe(dev, ret, "error on SPI offload setup\n");
return 0;
+
+trigger_buf_setup:
+ ret = __ltc2378_set_triggered_buf_ops(st);
+ if (ret == -EOPNOTSUPP)
+ return 0; /* Let device setup complete without buffer support */
+
+ if (!ret)
+ ret = st->ops->buffer_setup(indio_dev, st);
+
+ if (ret)
+ return dev_err_probe(dev, ret, "error on buffer setup\n");
+
+ st->chans[st->num_iio_chans++] = IIO_CHAN_SOFT_TIMESTAMP(1);
+
+ return 0;
}
EXPORT_SYMBOL_NS_GPL(ltc2378_lib_buffer_setup, "IIO_LTC2378");
diff --git a/drivers/iio/adc/ltc2378-triggered-buffer.c b/drivers/iio/adc/ltc2378-triggered-buffer.c
new file mode 100644
index 000000000000..d1d788fb5cb4
--- /dev/null
+++ b/drivers/iio/adc/ltc2378-triggered-buffer.c
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2026 Analog Devices, Inc.
+ * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
+ */
+
+#include <linux/iio/buffer.h>
+#include <linux/iio/triggered_buffer.h>
+#include <linux/iio/trigger_consumer.h>
+
+#include <ltc2378.h>
+
+static irqreturn_t ltc2378_trigger_handler(int irq, void *p)
+{
+ struct iio_poll_func *pf = p;
+ struct iio_dev *indio_dev = pf->indio_dev;
+ struct ltc2378_state *st = iio_priv(indio_dev);
+ int ret;
+
+ ret = ltc2378_convert_and_acquire(st);
+ if (ret < 0)
+ goto err_out;
+
+ iio_push_to_buffers_with_ts(indio_dev, &st->scan, sizeof(st->scan),
+ pf->timestamp);
+
+err_out:
+ iio_trigger_notify_done(indio_dev->trig);
+ return IRQ_HANDLED;
+}
+
+static int ltc2378_triggered_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st)
+{
+ return devm_iio_triggered_buffer_setup(&st->spi->dev, indio_dev,
+ &iio_pollfunc_store_time,
+ <c2378_trigger_handler,
+ NULL);
+}
+
+static const struct ltc2378_ops ltc2378_triggered_buf_ops = {
+ .buffer_setup = ltc2378_triggered_buffer_setup,
+};
+
+int ltc2378_set_triggered_buf_ops(struct ltc2378_state *st)
+{
+ st->ops = <c2378_triggered_buf_ops;
+ return 0;
+}
+EXPORT_SYMBOL_NS_GPL(ltc2378_set_triggered_buf_ops, "IIO_LTC2378");
diff --git a/drivers/iio/adc/ltc2378.h b/drivers/iio/adc/ltc2378.h
index f6e10f9a83e0..4241b1e79ac0 100644
--- a/drivers/iio/adc/ltc2378.h
+++ b/drivers/iio/adc/ltc2378.h
@@ -89,6 +89,8 @@ int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st
#define __ltc2378_set_offload_ops(st) ltc2378_set_offload_ops((st))
+#define __ltc2378_set_triggered_buf_ops(st) ltc2378_set_triggered_buf_ops((st))
+
#ifdef CONFIG_LTC2378_LIB_OFFLOAD_BUFFER
int ltc2378_set_offload_ops(struct ltc2378_state *st);
@@ -102,4 +104,17 @@ static inline int ltc2378_set_offload_ops(struct ltc2378_state *st)
#endif /* CONFIG_LTC2378_LIB_OFFLOAD_BUFFER */
+#ifdef CONFIG_LTC2378_LIB_TRIGGERED_BUFFER
+
+int ltc2378_set_triggered_buf_ops(struct ltc2378_state *st);
+
+#else
+
+static inline int ltc2378_set_triggered_buf_ops(struct ltc2378_state *st)
+{
+ return -EOPNOTSUPP;
+}
+
+#endif /* CONFIG_LTC2378_LIB_TRIGGERED_BUFFER */
+
#endif /* __DRIVERS_IIO_ADC_LTC2378_H__ */
--
2.53.0
^ permalink raw reply related
* [PATCH v3 4/5] iio: adc: ltc2378: Enable high-speed data capture
From: Marcelo Schmitt @ 2026-06-17 2:04 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
In-Reply-To: <cover.1781661028.git.marcelo.schmitt@analog.com>
Make use of SPI transfer offloading to speed up data capture, enabling data
acquisition at faster sample rates (up to 2 MSPS).
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
Change log v2 -> v3:
- Fixed the evaluation loop conditions for CNV PWM and SPI Engine trigger PWM,
avoiding potential infinite loop if and CPU stall.
- Added comment to about initial PWM disable.
- Adjusted SPI offload setup initialization to not print error on a valid condition.
- Fully initialize IIO channel scan_type.
- Reworked to make offload support not imply all dependencies to be built in.
- Made sampling_frequency a buffer attribute.
- Made offload support not require DMA and other features to be built in.
- Now using same scan_type configuration for all use cases.
drivers/iio/adc/Kconfig | 19 ++
drivers/iio/adc/Makefile | 6 +
drivers/iio/adc/ltc2378-lib-core.c | 35 +++
drivers/iio/adc/ltc2378-offload-buffer.c | 305 +++++++++++++++++++++++
drivers/iio/adc/ltc2378.c | 46 ++++
drivers/iio/adc/ltc2378.h | 42 ++++
6 files changed, 453 insertions(+)
create mode 100644 drivers/iio/adc/ltc2378-lib-core.c
create mode 100644 drivers/iio/adc/ltc2378-offload-buffer.c
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index 2b8203451367..f96d9262b891 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -944,6 +944,9 @@ config LTC2378
tristate "Analog Devices LTC2378 ADC driver"
depends on SPI
depends on GPIOLIB
+ select LTC2378_LIB
+ select LTC2378_LIB_OFFLOAD_BUFFER if SPI_OFFLOAD && PWM && SPI_OFFLOAD_TRIGGER_PWM && IIO_BUFFER && IIO_BUFFER_DMAENGINE
+ select LTC2378_LIB_TRIGGERED_BUFFER if IIO_BUFFER
help
Say yes here to build support for Analog Devices LTC2378-20 and
similar analog to digital converters.
@@ -2027,3 +2030,19 @@ config XILINX_AMS
xilinx-ams.
endmenu
+
+config LTC2378_LIB
+ tristate
+ help
+ Say yes here to build support for buffered data capture with LTC2378
+
+config LTC2378_LIB_OFFLOAD_BUFFER
+ bool
+ help
+ Say yes here to build support for high speed data capture with LTC2378
+
+config LTC2378_LIB_TRIGGERED_BUFFER
+ bool
+ select IIO_TRIGGERED_BUFFER
+ help
+ Say yes here to build support for buffered data capture with LTC2378
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index 1814fb78dde3..109cd39237c9 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -82,6 +82,12 @@ obj-$(CONFIG_LPC18XX_ADC) += lpc18xx_adc.o
obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o
obj-$(CONFIG_LTC2309) += ltc2309.o
obj-$(CONFIG_LTC2378) += ltc2378.o
+
+ltc2378_lib-y += ltc2378-lib-core.o
+ltc2378_lib-$(CONFIG_LTC2378_LIB_OFFLOAD_BUFFER) += ltc2378-offload-buffer.o
+ltc2378_lib-$(CONFIG_LTC2378_LIB_TRIGGERED_BUFFER) += ltc2378-triggered-buffer.o
+obj-$(CONFIG_LTC2378_LIB) += ltc2378_lib.o
+
obj-$(CONFIG_LTC2471) += ltc2471.o
obj-$(CONFIG_LTC2485) += ltc2485.o
obj-$(CONFIG_LTC2496) += ltc2496.o ltc2497-core.o
diff --git a/drivers/iio/adc/ltc2378-lib-core.c b/drivers/iio/adc/ltc2378-lib-core.c
new file mode 100644
index 000000000000..1160f4324d01
--- /dev/null
+++ b/drivers/iio/adc/ltc2378-lib-core.c
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Analog Devices LTC2378 ADC series driver
+ *
+ * Copyright (C) 2026 Analog Devices Inc.
+ * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
+ */
+
+#include <linux/err.h>
+#include <linux/iio/iio.h>
+
+#include "ltc2378.h"
+
+int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st)
+{
+ struct device *dev = &st->spi->dev;
+ int ret;
+
+ ret = __ltc2378_set_offload_ops(st);
+ if (ret == -EOPNOTSUPP)
+ return 0; /* Let device setup complete without buffer support */
+
+ if (!ret)
+ ret = st->ops->buffer_setup(indio_dev, st);
+
+ if (ret)
+ return dev_err_probe(dev, ret, "error on SPI offload setup\n");
+
+ return 0;
+}
+EXPORT_SYMBOL_NS_GPL(ltc2378_lib_buffer_setup, "IIO_LTC2378");
+
+MODULE_AUTHOR("Marcelo Schmitt <marcelo.schmitt@analog.com>");
+MODULE_DESCRIPTION("Analog Devices LTC2378 ADC series driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/iio/adc/ltc2378-offload-buffer.c b/drivers/iio/adc/ltc2378-offload-buffer.c
new file mode 100644
index 000000000000..3e8c7ab64a54
--- /dev/null
+++ b/drivers/iio/adc/ltc2378-offload-buffer.c
@@ -0,0 +1,305 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2026 Analog Devices, Inc.
+ * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
+ */
+
+#include <linux/cleanup.h>
+#include <linux/err.h>
+#include <linux/math.h>
+#include <linux/math64.h>
+#include <linux/pwm.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/offload/consumer.h>
+#include <linux/spi/offload/types.h>
+#include <linux/time64.h>
+
+#include <linux/iio/buffer.h>
+#include <linux/iio/buffer-dmaengine.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/iio/types.h>
+
+#include "ltc2378.h"
+
+/*
+ * SPI offload wiring schema
+ *
+ * +-------------+ +-------------+
+ * | CNV |<-----+--| GPIO |
+ * | | +--| PWM0 |
+ * | | | |
+ * | | +--| PWM1 |
+ * | | | +-------------+
+ * | | +->| TRIGGER |
+ * | | | |
+ * | ADC | | SPI |
+ * | | | controller |
+ * | | | |
+ * | SDI |<--------| SDO |
+ * | SDO |-------->| SDI |
+ * | SCLK |<--------| SCLK |
+ * +-------------+ +-------------+
+ *
+ */
+static int ltc2378_update_conversion_rate(struct ltc2378_state *st, int freq_Hz)
+{
+ struct spi_offload_trigger_config *config = &st->offload_trigger_config;
+ unsigned int min_read_offset, offload_period_ns;
+ struct pwm_waveform cnv_wf = { };
+ u64 target = LTC2378_TCNV_HIGH_NS;
+ unsigned int count = 0;
+ u64 offload_offset_ns;
+ int ret;
+
+ if (freq_Hz == 0)
+ return -EINVAL;
+
+ if (freq_Hz < 1 || freq_Hz > st->info->max_sample_rate_hz)
+ return -ERANGE;
+
+ /* Configure CNV PWM waveform */
+ cnv_wf.period_length_ns = DIV_ROUND_CLOSEST(NSEC_PER_SEC, freq_Hz);
+
+ /*
+ * Ensure CNV high time meets minimum requirement (20ns). The PWM
+ * hardware may round the duty cycle, so iterate until we get at least
+ * the minimum required high time.
+ */
+ do {
+ cnv_wf.duty_length_ns = target;
+ ret = pwm_round_waveform_might_sleep(st->cnv_trigger, &cnv_wf);
+ if (ret)
+ return ret;
+ target += 10; /* Increment by PWM duty cycle period */
+ } while (count++ < 100 && cnv_wf.duty_length_ns < LTC2378_TCNV_HIGH_NS);
+
+ /* Double check the minimum CNV high time is met */
+ if (cnv_wf.duty_length_ns < LTC2378_TCNV_HIGH_NS)
+ return -EIO;
+
+ /*
+ * Configure SPI offload PWM trigger.
+ * The trigger should fire after tBUSYLH + tCONV + tDSDOBUSYL.
+ * Minimum time needed: TBUSYLH (13ns) + TCONV (part-specific) + TDSDOBUSYL (5ns)
+ *
+ * Use the same period as CNV PWM to avoid timing issues.
+ * Convert back from period to frequency for the SPI offload API.
+ */
+ offload_period_ns = cnv_wf.period_length_ns;
+ config->periodic.frequency_hz = DIV_ROUND_UP(HZ_PER_GHZ, offload_period_ns);
+ min_read_offset = LTC2378_TBUSYLH_NS + st->info->tconv_ns + LTC2378_TDSDOBUSYL_NS;
+ offload_offset_ns = min_read_offset;
+ count = 0;
+ do {
+ config->periodic.offset_ns = offload_offset_ns;
+ ret = spi_offload_trigger_validate(st->offload_trigger, config);
+ if (ret)
+ return ret;
+ offload_offset_ns += 10;
+ } while (count++ < 100 && config->periodic.offset_ns < min_read_offset);
+
+ st->cnv_wf = cnv_wf;
+ st->cnv_Hz = DIV_ROUND_CLOSEST_ULL(HZ_PER_GHZ, cnv_wf.period_length_ns);
+
+ return 0;
+}
+
+static ssize_t sampling_frequency_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct ltc2378_state *st = iio_priv(dev_to_iio_dev(dev));
+
+ return sysfs_emit(buf, "%u\n", st->cnv_Hz);
+}
+
+static ssize_t sampling_frequency_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t len)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct ltc2378_state *st = iio_priv(indio_dev);
+ unsigned int val;
+ int ret;
+
+ IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
+ if (IIO_DEV_ACQUIRE_FAILED(claim))
+ return -EBUSY;
+
+ ret = kstrtouint(buf, 10, &val);
+ if (ret)
+ return ret;
+
+ ret = ltc2378_update_conversion_rate(st, val);
+
+ return ret ?: len;
+}
+
+static ssize_t sampling_frequency_available_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct iio_dev *indio_dev = dev_to_iio_dev(dev);
+ struct ltc2378_state *st = iio_priv(indio_dev);
+
+ return sysfs_emit(buf, "[%u %u %u]\n",
+ 1, 1, st->info->max_sample_rate_hz);
+}
+
+static IIO_DEVICE_ATTR_RO(sampling_frequency_available, 0);
+static IIO_DEVICE_ATTR(sampling_frequency, 0644,
+ sampling_frequency_show, sampling_frequency_store, 0);
+
+static const struct iio_dev_attr *ltc2378_offload_buffer_attrs[] = {
+ &iio_dev_attr_sampling_frequency_available,
+ &iio_dev_attr_sampling_frequency,
+ NULL
+};
+
+static int ltc2378_prepare_offload_message(struct device *dev,
+ struct ltc2378_state *st)
+{
+ st->offload_xfer.bits_per_word = st->info->resolution;
+ st->offload_xfer.len = st->info->resolution > 16 ? 4 : 2;
+ st->offload_xfer.offload_flags = SPI_OFFLOAD_XFER_RX_STREAM;
+
+ /* Initialize message with offload */
+ spi_message_init_with_transfers(&st->offload_msg, &st->offload_xfer, 1);
+ st->offload_msg.offload = st->offload;
+
+ return devm_spi_optimize_message(dev, st->spi, &st->offload_msg);
+}
+
+static int ltc2378_offload_buffer_postenable(struct iio_dev *indio_dev)
+{
+ struct ltc2378_state *st = iio_priv(indio_dev);
+ int ret;
+
+ ret = pwm_set_waveform_might_sleep(st->cnv_trigger, &st->cnv_wf, false);
+ if (ret)
+ return ret;
+
+ ret = spi_offload_trigger_enable(st->offload, st->offload_trigger,
+ &st->offload_trigger_config);
+ if (ret)
+ goto out_pwm_disable;
+
+ return 0;
+
+out_pwm_disable:
+ pwm_disable(st->cnv_trigger);
+ return ret;
+}
+
+static int ltc2378_offload_buffer_predisable(struct iio_dev *indio_dev)
+{
+ struct ltc2378_state *st = iio_priv(indio_dev);
+
+ spi_offload_trigger_disable(st->offload, st->offload_trigger);
+ pwm_disable(st->cnv_trigger);
+
+ return 0;
+}
+
+static const struct iio_buffer_setup_ops ltc2378_offload_buffer_ops = {
+ .postenable = <c2378_offload_buffer_postenable,
+ .predisable = <c2378_offload_buffer_predisable,
+};
+
+static int ltc2378_spi_offload_setup(struct iio_dev *indio_dev,
+ struct ltc2378_state *st)
+{
+ struct device *dev = &st->spi->dev;
+ struct dma_chan *rx_dma;
+
+ indio_dev->setup_ops = <c2378_offload_buffer_ops;
+
+ st->offload_trigger = devm_spi_offload_trigger_get(dev, st->offload,
+ SPI_OFFLOAD_TRIGGER_PERIODIC);
+ if (IS_ERR(st->offload_trigger))
+ return dev_err_probe(dev, PTR_ERR(st->offload_trigger),
+ "failed to get offload trigger\n");
+
+ st->offload_trigger_config.type = SPI_OFFLOAD_TRIGGER_PERIODIC;
+
+ rx_dma = devm_spi_offload_rx_stream_request_dma_chan(dev, st->offload);
+ if (IS_ERR(rx_dma))
+ return dev_err_probe(dev, PTR_ERR(rx_dma), "failed to get offload RX DMA\n");
+
+ return devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
+ IIO_BUFFER_DIRECTION_IN,
+ ltc2378_offload_buffer_attrs);
+}
+
+static int ltc2378_pwm_get(struct ltc2378_state *st)
+{
+ struct device *dev = &st->spi->dev;
+
+ st->cnv_trigger = devm_pwm_get(dev, NULL);
+ if (IS_ERR(st->cnv_trigger))
+ return dev_err_probe(dev, PTR_ERR(st->cnv_trigger),
+ "failed to get cnv pwm\n");
+
+ /*
+ * Disable the PWM connected to CNV in case it was left running by
+ * something else.
+ */
+ pwm_disable(st->cnv_trigger);
+
+ return 0;
+}
+
+static const struct spi_offload_config ltc2378_offload_config = {
+ .capability_flags = SPI_OFFLOAD_CAP_TRIGGER |
+ SPI_OFFLOAD_CAP_RX_STREAM_DMA,
+};
+
+static int ltc2378_offload_buffer_setup(struct iio_dev *indio_dev,
+ struct ltc2378_state *st)
+{
+ struct spi_device *spi = st->spi;
+ struct device *dev = &spi->dev;
+ int ret;
+
+ st->offload = devm_spi_offload_get(dev, spi, <c2378_offload_config);
+ ret = PTR_ERR_OR_ZERO(st->offload);
+ if (ret)
+ return ret;
+
+ ret = ltc2378_spi_offload_setup(indio_dev, st);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to setup SPI offload\n");
+
+ ret = ltc2378_pwm_get(st);
+ if (ret)
+ return ret;
+
+ /*
+ * Start with a slower sampling rate so there is some room for
+ * adjusting the sampling frequency without hitting the maximum
+ * conversion rate.
+ */
+ ret = ltc2378_update_conversion_rate(st, st->info->max_sample_rate_hz >> 4);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to sampling frequency\n");
+
+ ret = ltc2378_prepare_offload_message(&spi->dev, st);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to optimize SPI message\n");
+
+ return 0;
+}
+
+static const struct ltc2378_ops ltc2378_offload_ops = {
+ .buffer_setup = ltc2378_offload_buffer_setup,
+};
+
+int ltc2378_set_offload_ops(struct ltc2378_state *st)
+{
+ st->ops = <c2378_offload_ops;
+ return 0;
+}
+EXPORT_SYMBOL_NS_GPL(ltc2378_set_offload_ops, "IIO_LTC2378");
+
+MODULE_IMPORT_NS("IIO_DMAENGINE_BUFFER");
diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
index 88582bdcd6a6..bf17b202230b 100644
--- a/drivers/iio/adc/ltc2378.c
+++ b/drivers/iio/adc/ltc2378.c
@@ -17,6 +17,7 @@
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/types.h>
+#include <linux/units.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>
@@ -26,120 +27,160 @@
static const struct ltc2378_chip_info ltc2338_18_chip_info = {
.name = "ltc2338-18",
.resolution = 18,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 527,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2364_16_chip_info = {
.name = "ltc2364-16",
.resolution = 16,
+ .max_sample_rate_hz = 250 * HZ_PER_KHZ,
+ .tconv_ns = 3000,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2364_18_chip_info = {
.name = "ltc2364-18",
.resolution = 18,
+ .max_sample_rate_hz = 250 * HZ_PER_KHZ,
+ .tconv_ns = 3000,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2367_16_chip_info = {
.name = "ltc2367-16",
.resolution = 16,
+ .max_sample_rate_hz = 500 * HZ_PER_KHZ,
+ .tconv_ns = 1500,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2367_18_chip_info = {
.name = "ltc2367-18",
.resolution = 18,
+ .max_sample_rate_hz = 500 * HZ_PER_KHZ,
+ .tconv_ns = 1500,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2368_16_chip_info = {
.name = "ltc2368-16",
.resolution = 16,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 527,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2368_18_chip_info = {
.name = "ltc2368-18",
.resolution = 18,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 527,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2369_18_chip_info = {
.name = "ltc2369-18",
.resolution = 18,
+ .max_sample_rate_hz = 1600 * HZ_PER_KHZ,
+ .tconv_ns = 412,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2370_16_chip_info = {
.name = "ltc2370-16",
.resolution = 16,
+ .max_sample_rate_hz = 2 * HZ_PER_MHZ,
+ .tconv_ns = 322,
.bipolar = false,
};
static const struct ltc2378_chip_info ltc2376_16_chip_info = {
.name = "ltc2376-16",
.resolution = 16,
+ .max_sample_rate_hz = 250 * HZ_PER_KHZ,
+ .tconv_ns = 3000,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2376_18_chip_info = {
.name = "ltc2376-18",
.resolution = 18,
+ .max_sample_rate_hz = 250 * HZ_PER_KHZ,
+ .tconv_ns = 3000,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2376_20_chip_info = {
.name = "ltc2376-20",
.resolution = 20,
+ .max_sample_rate_hz = 250 * HZ_PER_KHZ,
+ .tconv_ns = 3000,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2377_16_chip_info = {
.name = "ltc2377-16",
.resolution = 16,
+ .max_sample_rate_hz = 500 * HZ_PER_KHZ,
+ .tconv_ns = 1500,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2377_18_chip_info = {
.name = "ltc2377-18",
.resolution = 18,
+ .max_sample_rate_hz = 500 * HZ_PER_KHZ,
+ .tconv_ns = 1500,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2377_20_chip_info = {
.name = "ltc2377-20",
.resolution = 20,
+ .max_sample_rate_hz = 500 * HZ_PER_KHZ,
+ .tconv_ns = 1500,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2378_16_chip_info = {
.name = "ltc2378-16",
.resolution = 16,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 527,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2378_18_chip_info = {
.name = "ltc2378-18",
.resolution = 18,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 527,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2378_20_chip_info = {
.name = "ltc2378-20",
.resolution = 20,
+ .max_sample_rate_hz = HZ_PER_MHZ,
+ .tconv_ns = 675,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2379_18_chip_info = {
.name = "ltc2379-18",
.resolution = 18,
+ .max_sample_rate_hz = 1600 * HZ_PER_KHZ,
+ .tconv_ns = 412,
.bipolar = true,
};
static const struct ltc2378_chip_info ltc2380_16_chip_info = {
.name = "ltc2380-16",
.resolution = 16,
+ .max_sample_rate_hz = 2 * HZ_PER_MHZ,
+ .tconv_ns = 322,
.bipolar = true,
};
@@ -266,6 +307,10 @@ static int ltc2378_probe(struct spi_device *spi)
st->xfer.len = st->info->resolution > 16 ? 4 : 2;
st->xfer.bits_per_word = st->info->resolution;
+ ret = ltc2378_lib_buffer_setup(indio_dev, st);
+ if (ret)
+ return ret;
+
indio_dev->channels = st->chans;
indio_dev->num_channels = st->num_iio_chans;
@@ -336,3 +381,4 @@ MODULE_AUTHOR("Ioan-Daniel Pop <pop.ioan-daniel@analog.com>");
MODULE_AUTHOR("Marcelo Schmitt <marcelo.schmitt@analog.com>");
MODULE_DESCRIPTION("Analog Devices LTC2378 ADC series driver");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("IIO_LTC2378");
diff --git a/drivers/iio/adc/ltc2378.h b/drivers/iio/adc/ltc2378.h
index a3a69351de6c..f6e10f9a83e0 100644
--- a/drivers/iio/adc/ltc2378.h
+++ b/drivers/iio/adc/ltc2378.h
@@ -8,10 +8,14 @@
#ifndef __DRIVERS_IIO_ADC_LTC2378_H__
#define __DRIVERS_IIO_ADC_LTC2378_H__
+#include <linux/errno.h>
#include <linux/iio/iio.h>
#include <linux/gpio/consumer.h>
#include <linux/delay.h>
+#include <linux/pwm.h>
#include <linux/spi/spi.h>
+#include <linux/spi/offload/consumer.h>
+#include <linux/spi/offload/types.h>
#include <linux/types.h>
#include <linux/units.h>
@@ -19,12 +23,24 @@
#define LTC2378_TBUSYLH_NS 13
#define LTC2378_TCNV_HIGH_NS 20
+struct ltc2378_state;
+
struct ltc2378_chip_info {
const char *name;
int resolution;
+ unsigned int max_sample_rate_hz;
+ unsigned int tconv_ns;
bool bipolar;
};
+/**
+ * struct ltc2378_ops: Setup specific procedures for ltc2378 devices.
+ * @ltc2378_buffer_setup: Custom buffer setup implementation.
+ */
+struct ltc2378_ops {
+ int (*buffer_setup)(struct iio_dev *indio_dev, struct ltc2378_state *st);
+};
+
struct ltc2378_state {
const struct ltc2378_chip_info *info;
struct gpio_desc *cnv_gpio;
@@ -33,6 +49,15 @@ struct ltc2378_state {
unsigned int num_iio_chans;
struct iio_chan_spec chans[2]; /* 1 physical chan + 1 timestamp chan */
int ref_uV;
+ const struct ltc2378_ops *ops;
+ unsigned int cnv_Hz;
+ struct pwm_waveform cnv_wf;
+ struct spi_offload *offload;
+ struct spi_offload_trigger *offload_trigger;
+ struct spi_message offload_msg;
+ struct spi_transfer offload_xfer;
+ struct spi_offload_trigger_config offload_trigger_config;
+ struct pwm_device *cnv_trigger;
/*
* DMA (thus cache coherency maintenance) requires the
@@ -60,4 +85,21 @@ static inline int ltc2378_convert_and_acquire(struct ltc2378_state *st)
return ret;
}
+int ltc2378_lib_buffer_setup(struct iio_dev *indio_dev, struct ltc2378_state *st);
+
+#define __ltc2378_set_offload_ops(st) ltc2378_set_offload_ops((st))
+
+#ifdef CONFIG_LTC2378_LIB_OFFLOAD_BUFFER
+
+int ltc2378_set_offload_ops(struct ltc2378_state *st);
+
+#else
+
+static inline int ltc2378_set_offload_ops(struct ltc2378_state *st)
+{
+ return -EOPNOTSUPP;
+}
+
+#endif /* CONFIG_LTC2378_LIB_OFFLOAD_BUFFER */
+
#endif /* __DRIVERS_IIO_ADC_LTC2378_H__ */
--
2.53.0
^ permalink raw reply related
* [RFC PATCH v3 3/5] iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs attributes
From: Marcelo Schmitt @ 2026-06-17 2:03 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
In-Reply-To: <cover.1781661028.git.marcelo.schmitt@analog.com>
Some devices using DMAengine buffers are connected to extra hardware that
allows setting how fast data is transferred to/from the buffer. However,
those extra pieces of harwdware are external to the sensor chip such that
supporting the transfer speed as a sensor property is a bit of an
inaccuracy. Expand IIO DMAengine buffer interfaces to take arguments for
extra sysfs attributes, enabling the transfer speed to be configured
through the buffer interface.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
New patch.
Now that I've come to this buffer "solution", I have pretty much convinced
myself it would be better to instead have some sort of IIO trigger to control
the signal source connected to SPI offloading trigger module.
drivers/iio/adc/ad4000.c | 3 ++-
drivers/iio/adc/ad4030.c | 3 ++-
drivers/iio/adc/ad4691.c | 3 ++-
drivers/iio/adc/ad4695.c | 2 +-
drivers/iio/adc/ad7380.c | 2 +-
drivers/iio/adc/ad7606_spi.c | 2 +-
drivers/iio/adc/ad7768-1.c | 3 ++-
drivers/iio/adc/ad7944.c | 2 +-
drivers/iio/adc/ad_sigma_delta.c | 2 +-
.../buffer/industrialio-buffer-dmaengine.c | 19 ++++++++++++-------
drivers/iio/dac/ad5791.c | 2 +-
drivers/iio/dac/ad8460.c | 2 +-
drivers/iio/dac/adi-axi-dac.c | 2 +-
include/linux/iio/buffer-dmaengine.h | 16 ++++++++++------
14 files changed, 38 insertions(+), 25 deletions(-)
diff --git a/drivers/iio/adc/ad4000.c b/drivers/iio/adc/ad4000.c
index fd3d79fca785..b79b627310af 100644
--- a/drivers/iio/adc/ad4000.c
+++ b/drivers/iio/adc/ad4000.c
@@ -871,7 +871,8 @@ static int ad4000_spi_offload_setup(struct iio_dev *indio_dev,
"Failed to get offload RX DMA\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
- IIO_BUFFER_DIRECTION_IN);
+ IIO_BUFFER_DIRECTION_IN,
+ NULL);
if (ret)
return dev_err_probe(dev, ret, "Failed to setup DMA buffer\n");
diff --git a/drivers/iio/adc/ad4030.c b/drivers/iio/adc/ad4030.c
index 9c5f19321e3b..713fe95176c0 100644
--- a/drivers/iio/adc/ad4030.c
+++ b/drivers/iio/adc/ad4030.c
@@ -1400,7 +1400,8 @@ static int ad4030_spi_offload_setup(struct iio_dev *indio_dev,
"failed to get offload RX DMA\n");
return devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
- IIO_BUFFER_DIRECTION_IN);
+ IIO_BUFFER_DIRECTION_IN,
+ NULL);
}
static int ad4030_setup_pga(struct device *dev, struct iio_dev *indio_dev,
diff --git a/drivers/iio/adc/ad4691.c b/drivers/iio/adc/ad4691.c
index 548678adc2a4..9845fe9c4725 100644
--- a/drivers/iio/adc/ad4691.c
+++ b/drivers/iio/adc/ad4691.c
@@ -1980,7 +1980,8 @@ static int ad4691_setup_offload(struct iio_dev *indio_dev,
indio_dev->setup_ops = &ad4691_cnv_burst_offload_buffer_setup_ops;
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
- IIO_BUFFER_DIRECTION_IN);
+ IIO_BUFFER_DIRECTION_IN,
+ NULL);
if (ret)
return ret;
diff --git a/drivers/iio/adc/ad4695.c b/drivers/iio/adc/ad4695.c
index 53642de7330d..78faeade19f5 100644
--- a/drivers/iio/adc/ad4695.c
+++ b/drivers/iio/adc/ad4695.c
@@ -1779,7 +1779,7 @@ static int ad4695_probe_spi_offload(struct iio_dev *indio_dev,
}
return devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
- rx_dma, IIO_BUFFER_DIRECTION_IN);
+ rx_dma, IIO_BUFFER_DIRECTION_IN, NULL);
}
static const struct spi_offload_config ad4695_spi_offload_config = {
diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c
index 9f77990a03f9..415b8e1be920 100644
--- a/drivers/iio/adc/ad7380.c
+++ b/drivers/iio/adc/ad7380.c
@@ -1874,7 +1874,7 @@ static int ad7380_probe_spi_offload(struct iio_dev *indio_dev,
"failed to get offload RX DMA\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
- rx_dma, IIO_BUFFER_DIRECTION_IN);
+ rx_dma, IIO_BUFFER_DIRECTION_IN, NULL);
if (ret)
return dev_err_probe(dev, ret, "cannot setup dma buffer\n");
diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c
index 7e17ccbcedd0..760b54bfe208 100644
--- a/drivers/iio/adc/ad7606_spi.c
+++ b/drivers/iio/adc/ad7606_spi.c
@@ -317,7 +317,7 @@ static int ad7606_spi_offload_probe(struct device *dev,
"failed to get offload RX DMA\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
- rx_dma, IIO_BUFFER_DIRECTION_IN);
+ rx_dma, IIO_BUFFER_DIRECTION_IN, NULL);
if (ret)
return dev_err_probe(dev, ret,
"failed to setup offload RX DMA\n");
diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
index 598936e47fd2..a13ac31281d8 100644
--- a/drivers/iio/adc/ad7768-1.c
+++ b/drivers/iio/adc/ad7768-1.c
@@ -1792,7 +1792,8 @@ static int ad7768_spi_offload_probe(struct iio_dev *indio_dev,
return dev_err_probe(dev, PTR_ERR(rx_dma), "failed to get offload RX DMA\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev, rx_dma,
- IIO_BUFFER_DIRECTION_IN);
+ IIO_BUFFER_DIRECTION_IN,
+ NULL);
if (ret)
return dev_err_probe(dev, ret, "failed to setup offload RX DMA\n");
diff --git a/drivers/iio/adc/ad7944.c b/drivers/iio/adc/ad7944.c
index 7722cf9e8214..63852a6c2acc 100644
--- a/drivers/iio/adc/ad7944.c
+++ b/drivers/iio/adc/ad7944.c
@@ -843,7 +843,7 @@ static int ad7944_probe(struct spi_device *spi)
*/
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev,
- indio_dev, rx_dma, IIO_BUFFER_DIRECTION_IN);
+ indio_dev, rx_dma, IIO_BUFFER_DIRECTION_IN, NULL);
if (ret)
return ret;
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
index a955556f9ec8..4b88e1c72c87 100644
--- a/drivers/iio/adc/ad_sigma_delta.c
+++ b/drivers/iio/adc/ad_sigma_delta.c
@@ -820,7 +820,7 @@ int devm_ad_sd_setup_buffer_and_trigger(struct device *dev, struct iio_dev *indi
"Failed to get RX DMA channel\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(dev, indio_dev,
- rx_dma, IIO_BUFFER_DIRECTION_IN);
+ rx_dma, IIO_BUFFER_DIRECTION_IN, NULL);
if (ret)
return dev_err_probe(dev, ret, "Cannot setup DMA buffer\n");
diff --git a/drivers/iio/buffer/industrialio-buffer-dmaengine.c b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
index 98acce909854..343dbb6d1446 100644
--- a/drivers/iio/buffer/industrialio-buffer-dmaengine.c
+++ b/drivers/iio/buffer/industrialio-buffer-dmaengine.c
@@ -289,7 +289,8 @@ EXPORT_SYMBOL_NS_GPL(iio_dmaengine_buffer_teardown, "IIO_DMAENGINE_BUFFER");
static struct iio_buffer
*__iio_dmaengine_buffer_setup_ext(struct iio_dev *indio_dev,
struct dma_chan *chan,
- enum iio_buffer_direction dir)
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs)
{
struct iio_buffer *buffer;
int ret;
@@ -301,6 +302,7 @@ static struct iio_buffer
indio_dev->modes |= INDIO_BUFFER_HARDWARE;
buffer->direction = dir;
+ buffer->attrs = buffer_attrs;
ret = iio_device_attach_buffer(indio_dev, buffer);
if (ret) {
@@ -329,7 +331,8 @@ static struct iio_buffer
struct iio_buffer *iio_dmaengine_buffer_setup_ext(struct device *dev,
struct iio_dev *indio_dev,
const char *channel,
- enum iio_buffer_direction dir)
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs)
{
struct dma_chan *chan;
struct iio_buffer *buffer;
@@ -338,7 +341,7 @@ struct iio_buffer *iio_dmaengine_buffer_setup_ext(struct device *dev,
if (IS_ERR(chan))
return ERR_CAST(chan);
- buffer = __iio_dmaengine_buffer_setup_ext(indio_dev, chan, dir);
+ buffer = __iio_dmaengine_buffer_setup_ext(indio_dev, chan, dir, buffer_attrs);
if (IS_ERR(buffer))
dma_release_channel(chan);
@@ -366,11 +369,12 @@ static void devm_iio_dmaengine_buffer_teardown(void *buffer)
int devm_iio_dmaengine_buffer_setup_ext(struct device *dev,
struct iio_dev *indio_dev,
const char *channel,
- enum iio_buffer_direction dir)
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs)
{
struct iio_buffer *buffer;
- buffer = iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel, dir);
+ buffer = iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel, dir, buffer_attrs);
if (IS_ERR(buffer))
return PTR_ERR(buffer);
@@ -403,11 +407,12 @@ static void devm_iio_dmaengine_buffer_free(void *buffer)
int devm_iio_dmaengine_buffer_setup_with_handle(struct device *dev,
struct iio_dev *indio_dev,
struct dma_chan *chan,
- enum iio_buffer_direction dir)
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs)
{
struct iio_buffer *buffer;
- buffer = __iio_dmaengine_buffer_setup_ext(indio_dev, chan, dir);
+ buffer = __iio_dmaengine_buffer_setup_ext(indio_dev, chan, dir, buffer_attrs);
if (IS_ERR(buffer))
return PTR_ERR(buffer);
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index ae7297f08398..024607adb915 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -448,7 +448,7 @@ static int ad5791_offload_setup(struct iio_dev *indio_dev)
"failed to get offload TX DMA\n");
ret = devm_iio_dmaengine_buffer_setup_with_handle(&spi->dev,
- indio_dev, tx_dma, IIO_BUFFER_DIRECTION_OUT);
+ indio_dev, tx_dma, IIO_BUFFER_DIRECTION_OUT, NULL);
if (ret)
return ret;
diff --git a/drivers/iio/dac/ad8460.c b/drivers/iio/dac/ad8460.c
index 6e45686902dd..3c5fd71d5add 100644
--- a/drivers/iio/dac/ad8460.c
+++ b/drivers/iio/dac/ad8460.c
@@ -921,7 +921,7 @@ static int ad8460_probe(struct spi_device *spi)
indio_dev->setup_ops = &ad8460_buffer_setup_ops;
ret = devm_iio_dmaengine_buffer_setup_ext(dev, indio_dev, "tx",
- IIO_BUFFER_DIRECTION_OUT);
+ IIO_BUFFER_DIRECTION_OUT, NULL);
if (ret)
return dev_err_probe(dev, ret,
"Failed to get DMA buffer\n");
diff --git a/drivers/iio/dac/adi-axi-dac.c b/drivers/iio/dac/adi-axi-dac.c
index 451fad34e7ee..23028a92ceba 100644
--- a/drivers/iio/dac/adi-axi-dac.c
+++ b/drivers/iio/dac/adi-axi-dac.c
@@ -162,7 +162,7 @@ static struct iio_buffer *axi_dac_request_buffer(struct iio_backend *back,
dma_name = "tx";
return iio_dmaengine_buffer_setup_ext(st->dev, indio_dev, dma_name,
- IIO_BUFFER_DIRECTION_OUT);
+ IIO_BUFFER_DIRECTION_OUT, NULL);
}
static void axi_dac_free_buffer(struct iio_backend *back,
diff --git a/include/linux/iio/buffer-dmaengine.h b/include/linux/iio/buffer-dmaengine.h
index 37f27545f69f..bb7a348db72d 100644
--- a/include/linux/iio/buffer-dmaengine.h
+++ b/include/linux/iio/buffer-dmaengine.h
@@ -10,6 +10,7 @@
#include <linux/iio/buffer.h>
struct iio_dev;
+struct iio_dev_attr;
struct device;
struct dma_chan;
@@ -17,23 +18,26 @@ void iio_dmaengine_buffer_teardown(struct iio_buffer *buffer);
struct iio_buffer *iio_dmaengine_buffer_setup_ext(struct device *dev,
struct iio_dev *indio_dev,
const char *channel,
- enum iio_buffer_direction dir);
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs);
#define iio_dmaengine_buffer_setup(dev, indio_dev, channel) \
- iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel, \
- IIO_BUFFER_DIRECTION_IN)
+ iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel, \
+ IIO_BUFFER_DIRECTION_IN, NULL)
int devm_iio_dmaengine_buffer_setup_ext(struct device *dev,
struct iio_dev *indio_dev,
const char *channel,
- enum iio_buffer_direction dir);
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs);
int devm_iio_dmaengine_buffer_setup_with_handle(struct device *dev,
struct iio_dev *indio_dev,
struct dma_chan *chan,
- enum iio_buffer_direction dir);
+ enum iio_buffer_direction dir,
+ const struct iio_dev_attr **buffer_attrs);
#define devm_iio_dmaengine_buffer_setup(dev, indio_dev, channel) \
devm_iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel, \
- IIO_BUFFER_DIRECTION_IN)
+ IIO_BUFFER_DIRECTION_IN, NULL)
#endif
--
2.53.0
^ permalink raw reply related
* [PATCH v3 2/5] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
From: Marcelo Schmitt @ 2026-06-17 2:03 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
In-Reply-To: <cover.1781661028.git.marcelo.schmitt@analog.com>
Support for LTC2378-20 and similar analog-to-digital converters.
Co-developed-by: Ioan-Daniel Pop <pop.ioan-daniel@analog.com>
Signed-off-by: Ioan-Daniel Pop <pop.ioan-daniel@analog.com>
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
Change log v2 -> v3:
- Restricted LTC2378 dependency list to require GPIO
- Use datasheet terminology to indicate polarity/output code.
- Added missing block scope to IIO_DEV_ACQUIRE_DIRECT_MODE.
MAINTAINERS | 1 +
drivers/iio/adc/Kconfig | 11 ++
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/ltc2378.c | 338 ++++++++++++++++++++++++++++++++++++++
drivers/iio/adc/ltc2378.h | 63 +++++++
5 files changed, 414 insertions(+)
create mode 100644 drivers/iio/adc/ltc2378.c
create mode 100644 drivers/iio/adc/ltc2378.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 205acb4b0789..a11c00a78c13 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15226,6 +15226,7 @@ L: linux-iio@vger.kernel.org
S: Supported
W: https://ez.analog.com/linux-software-drivers
F: Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
+F: drivers/iio/adc/ltc2378*
LTC2664 IIO DAC DRIVER
M: Michael Hennerich <michael.hennerich@analog.com>
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index a3a93a47b43d..2b8203451367 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -940,6 +940,17 @@ config LTC2309
This driver can also be built as a module. If so, the module will
be called ltc2309.
+config LTC2378
+ tristate "Analog Devices LTC2378 ADC driver"
+ depends on SPI
+ depends on GPIOLIB
+ help
+ Say yes here to build support for Analog Devices LTC2378-20 and
+ similar analog to digital converters.
+
+ This driver can also be built as a module. If so, the module will
+ be called ltc2378.
+
config LTC2471
tristate "Linear Technology LTC2471 and LTC2473 ADC driver"
depends on I2C
diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
index 707dd708912f..1814fb78dde3 100644
--- a/drivers/iio/adc/Makefile
+++ b/drivers/iio/adc/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
obj-$(CONFIG_LPC18XX_ADC) += lpc18xx_adc.o
obj-$(CONFIG_LPC32XX_ADC) += lpc32xx_adc.o
obj-$(CONFIG_LTC2309) += ltc2309.o
+obj-$(CONFIG_LTC2378) += ltc2378.o
obj-$(CONFIG_LTC2471) += ltc2471.o
obj-$(CONFIG_LTC2485) += ltc2485.o
obj-$(CONFIG_LTC2496) += ltc2496.o ltc2497-core.o
diff --git a/drivers/iio/adc/ltc2378.c b/drivers/iio/adc/ltc2378.c
new file mode 100644
index 000000000000..88582bdcd6a6
--- /dev/null
+++ b/drivers/iio/adc/ltc2378.c
@@ -0,0 +1,338 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Analog Devices LTC2378 ADC series driver
+ *
+ * Copyright (C) 2026 Analog Devices Inc.
+ * Author: Ioan-Daniel Pop <pop.ioan-daniel@analog.com>
+ * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
+ */
+
+#include <linux/bitops.h>
+#include <linux/bits.h>
+#include <linux/cleanup.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/regulator/consumer.h>
+#include <linux/spi/spi.h>
+#include <linux/types.h>
+
+#include <linux/iio/iio.h>
+#include <linux/iio/types.h>
+
+#include "ltc2378.h"
+
+static const struct ltc2378_chip_info ltc2338_18_chip_info = {
+ .name = "ltc2338-18",
+ .resolution = 18,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2364_16_chip_info = {
+ .name = "ltc2364-16",
+ .resolution = 16,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2364_18_chip_info = {
+ .name = "ltc2364-18",
+ .resolution = 18,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2367_16_chip_info = {
+ .name = "ltc2367-16",
+ .resolution = 16,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2367_18_chip_info = {
+ .name = "ltc2367-18",
+ .resolution = 18,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2368_16_chip_info = {
+ .name = "ltc2368-16",
+ .resolution = 16,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2368_18_chip_info = {
+ .name = "ltc2368-18",
+ .resolution = 18,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2369_18_chip_info = {
+ .name = "ltc2369-18",
+ .resolution = 18,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2370_16_chip_info = {
+ .name = "ltc2370-16",
+ .resolution = 16,
+ .bipolar = false,
+};
+
+static const struct ltc2378_chip_info ltc2376_16_chip_info = {
+ .name = "ltc2376-16",
+ .resolution = 16,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2376_18_chip_info = {
+ .name = "ltc2376-18",
+ .resolution = 18,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2376_20_chip_info = {
+ .name = "ltc2376-20",
+ .resolution = 20,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2377_16_chip_info = {
+ .name = "ltc2377-16",
+ .resolution = 16,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2377_18_chip_info = {
+ .name = "ltc2377-18",
+ .resolution = 18,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2377_20_chip_info = {
+ .name = "ltc2377-20",
+ .resolution = 20,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2378_16_chip_info = {
+ .name = "ltc2378-16",
+ .resolution = 16,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2378_18_chip_info = {
+ .name = "ltc2378-18",
+ .resolution = 18,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2378_20_chip_info = {
+ .name = "ltc2378-20",
+ .resolution = 20,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2379_18_chip_info = {
+ .name = "ltc2379-18",
+ .resolution = 18,
+ .bipolar = true,
+};
+
+static const struct ltc2378_chip_info ltc2380_16_chip_info = {
+ .name = "ltc2380-16",
+ .resolution = 16,
+ .bipolar = true,
+};
+
+static int ltc2378_channel_single_read(const struct iio_chan_spec *chan,
+ struct ltc2378_state *st, int *val)
+{
+ const struct iio_scan_type *scan_type = &chan->scan_type;
+ u32 sample;
+ int ret;
+
+ ret = ltc2378_convert_and_acquire(st);
+ if (ret)
+ return ret;
+
+ if (scan_type->realbits > 16)
+ sample = st->scan.data.sample_buf32;
+ else
+ sample = st->scan.data.sample_buf16;
+
+ if (scan_type->format == IIO_SCAN_FORMAT_SIGNED_INT)
+ *val = sign_extend32(sample, scan_type->realbits - 1);
+ else
+ *val = sample;
+
+ return 0;
+}
+
+static int ltc2378_read_raw(struct iio_dev *indio_dev,
+ const struct iio_chan_spec *chan,
+ int *val, int *val2, long info)
+{
+ struct ltc2378_state *st = iio_priv(indio_dev);
+ int ret;
+
+ switch (info) {
+ case IIO_CHAN_INFO_RAW: {
+ IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
+ if (IIO_DEV_ACQUIRE_FAILED(claim))
+ return -EBUSY;
+
+ ret = ltc2378_channel_single_read(chan, st, val);
+ if (ret)
+ return ret;
+
+ return IIO_VAL_INT;
+ }
+ case IIO_CHAN_INFO_SCALE:
+ *val = st->ref_uV / MILLI;
+ /*
+ * For all LTC2378-like devices, the amount of bits that express
+ * voltage magnitude depend on the polarity / output code format:
+ * - straight binary: All precision/resolution bits are used.
+ * - 2's complement: One of the precision bits is used for sign.
+ */
+ if (st->info->bipolar)
+ *val2 = st->info->resolution - 1;
+ else
+ *val2 = st->info->resolution;
+
+ return IIO_VAL_FRACTIONAL_LOG2;
+
+ default:
+ return -EINVAL;
+ }
+}
+
+static const struct iio_info ltc2378_iio_info = {
+ .read_raw = <c2378_read_raw,
+};
+
+static int ltc2378_probe(struct spi_device *spi)
+{
+ struct device *dev = &spi->dev;
+ struct iio_dev *indio_dev;
+ struct ltc2378_state *st;
+ int ret;
+
+ indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
+ if (!indio_dev)
+ return -ENOMEM;
+
+ st = iio_priv(indio_dev);
+ st->spi = spi;
+
+ ret = devm_regulator_get_enable_read_voltage(dev, "ref");
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "failed to read ref regulator\n");
+
+ st->ref_uV = ret;
+ st->info = spi_get_device_match_data(spi);
+ if (!st->info)
+ return -EINVAL;
+
+ indio_dev->name = st->info->name;
+ indio_dev->info = <c2378_iio_info;
+ indio_dev->modes = INDIO_DIRECT_MODE;
+
+ st->cnv_gpio = devm_gpiod_get(dev, "cnv", GPIOD_OUT_LOW);
+ if (IS_ERR(st->cnv_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->cnv_gpio),
+ "failed to get CNV GPIO");
+
+ st->num_iio_chans = 0;
+ st->chans[st->num_iio_chans++] = (struct iio_chan_spec) {
+ .type = IIO_VOLTAGE,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+ BIT(IIO_CHAN_INFO_SCALE),
+ .scan_index = 0,
+ .scan_type = {
+ .format = st->info->bipolar ? IIO_SCAN_FORMAT_SIGNED_INT :
+ IIO_SCAN_FORMAT_UNSIGNED_INT,
+ .realbits = st->info->resolution,
+ /*
+ * Buffer elements could be 16-bit for low precision
+ * parts. Though, using more storage bits allows keeping
+ * the same scan_type configuration for both types of
+ * buffer support.
+ */
+ .storagebits = 32,
+ },
+ };
+
+ st->xfer.rx_buf = &st->scan.data;
+ st->xfer.len = st->info->resolution > 16 ? 4 : 2;
+ st->xfer.bits_per_word = st->info->resolution;
+
+ indio_dev->channels = st->chans;
+ indio_dev->num_channels = st->num_iio_chans;
+
+ return devm_iio_device_register(&spi->dev, indio_dev);
+}
+
+static const struct of_device_id ltc2378_of_match[] = {
+ { .compatible = "adi,ltc2338-18", .data = <c2338_18_chip_info },
+ { .compatible = "adi,ltc2364-16", .data = <c2364_16_chip_info },
+ { .compatible = "adi,ltc2364-18", .data = <c2364_18_chip_info },
+ { .compatible = "adi,ltc2367-16", .data = <c2367_16_chip_info },
+ { .compatible = "adi,ltc2367-18", .data = <c2367_18_chip_info },
+ { .compatible = "adi,ltc2368-16", .data = <c2368_16_chip_info },
+ { .compatible = "adi,ltc2368-18", .data = <c2368_18_chip_info },
+ { .compatible = "adi,ltc2369-18", .data = <c2369_18_chip_info },
+ { .compatible = "adi,ltc2370-16", .data = <c2370_16_chip_info },
+ { .compatible = "adi,ltc2376-16", .data = <c2376_16_chip_info },
+ { .compatible = "adi,ltc2376-18", .data = <c2376_18_chip_info },
+ { .compatible = "adi,ltc2376-20", .data = <c2376_20_chip_info },
+ { .compatible = "adi,ltc2377-16", .data = <c2377_16_chip_info },
+ { .compatible = "adi,ltc2377-18", .data = <c2377_18_chip_info },
+ { .compatible = "adi,ltc2377-20", .data = <c2377_20_chip_info },
+ { .compatible = "adi,ltc2378-16", .data = <c2378_16_chip_info },
+ { .compatible = "adi,ltc2378-18", .data = <c2378_18_chip_info },
+ { .compatible = "adi,ltc2378-20", .data = <c2378_20_chip_info },
+ { .compatible = "adi,ltc2379-18", .data = <c2379_18_chip_info },
+ { .compatible = "adi,ltc2380-16", .data = <c2380_16_chip_info },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ltc2378_of_match);
+
+static const struct spi_device_id ltc2378_spi_id[] = {
+ { .name = "ltc2338-18", .driver_data = (kernel_ulong_t)<c2338_18_chip_info },
+ { .name = "ltc2364-16", .driver_data = (kernel_ulong_t)<c2364_16_chip_info },
+ { .name = "ltc2364-18", .driver_data = (kernel_ulong_t)<c2364_18_chip_info },
+ { .name = "ltc2367-16", .driver_data = (kernel_ulong_t)<c2367_16_chip_info },
+ { .name = "ltc2367-18", .driver_data = (kernel_ulong_t)<c2367_18_chip_info },
+ { .name = "ltc2368-16", .driver_data = (kernel_ulong_t)<c2368_16_chip_info },
+ { .name = "ltc2368-18", .driver_data = (kernel_ulong_t)<c2368_18_chip_info },
+ { .name = "ltc2369-18", .driver_data = (kernel_ulong_t)<c2369_18_chip_info },
+ { .name = "ltc2370-16", .driver_data = (kernel_ulong_t)<c2370_16_chip_info },
+ { .name = "ltc2376-16", .driver_data = (kernel_ulong_t)<c2376_16_chip_info },
+ { .name = "ltc2376-18", .driver_data = (kernel_ulong_t)<c2376_18_chip_info },
+ { .name = "ltc2376-20", .driver_data = (kernel_ulong_t)<c2376_20_chip_info },
+ { .name = "ltc2377-16", .driver_data = (kernel_ulong_t)<c2377_16_chip_info },
+ { .name = "ltc2377-18", .driver_data = (kernel_ulong_t)<c2377_18_chip_info },
+ { .name = "ltc2377-20", .driver_data = (kernel_ulong_t)<c2377_20_chip_info },
+ { .name = "ltc2378-16", .driver_data = (kernel_ulong_t)<c2378_16_chip_info },
+ { .name = "ltc2378-18", .driver_data = (kernel_ulong_t)<c2378_18_chip_info },
+ { .name = "ltc2378-20", .driver_data = (kernel_ulong_t)<c2378_20_chip_info },
+ { .name = "ltc2379-18", .driver_data = (kernel_ulong_t)<c2379_18_chip_info },
+ { .name = "ltc2380-16", .driver_data = (kernel_ulong_t)<c2380_16_chip_info },
+ { }
+};
+MODULE_DEVICE_TABLE(spi, ltc2378_spi_id);
+
+static struct spi_driver ltc2378_driver = {
+ .driver = {
+ .name = "ltc2378",
+ .of_match_table = ltc2378_of_match
+ },
+ .probe = ltc2378_probe,
+ .id_table = ltc2378_spi_id,
+};
+module_spi_driver(ltc2378_driver);
+
+MODULE_AUTHOR("Ioan-Daniel Pop <pop.ioan-daniel@analog.com>");
+MODULE_AUTHOR("Marcelo Schmitt <marcelo.schmitt@analog.com>");
+MODULE_DESCRIPTION("Analog Devices LTC2378 ADC series driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/iio/adc/ltc2378.h b/drivers/iio/adc/ltc2378.h
new file mode 100644
index 000000000000..a3a69351de6c
--- /dev/null
+++ b/drivers/iio/adc/ltc2378.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Analog Devices LTC2378 and similar ADCs common definitions and properties
+ * Copyright (C) 2026 Analog Devices, Inc.
+ * Author: Marcelo Schmitt <marcelo.schmitt@analog.com>
+ */
+
+#ifndef __DRIVERS_IIO_ADC_LTC2378_H__
+#define __DRIVERS_IIO_ADC_LTC2378_H__
+
+#include <linux/iio/iio.h>
+#include <linux/gpio/consumer.h>
+#include <linux/delay.h>
+#include <linux/spi/spi.h>
+#include <linux/types.h>
+#include <linux/units.h>
+
+#define LTC2378_TDSDOBUSYL_NS 5
+#define LTC2378_TBUSYLH_NS 13
+#define LTC2378_TCNV_HIGH_NS 20
+
+struct ltc2378_chip_info {
+ const char *name;
+ int resolution;
+ bool bipolar;
+};
+
+struct ltc2378_state {
+ const struct ltc2378_chip_info *info;
+ struct gpio_desc *cnv_gpio;
+ struct spi_device *spi;
+ struct spi_transfer xfer;
+ unsigned int num_iio_chans;
+ struct iio_chan_spec chans[2]; /* 1 physical chan + 1 timestamp chan */
+ int ref_uV;
+
+ /*
+ * DMA (thus cache coherency maintenance) requires the
+ * transfer buffers to live in their own cache lines.
+ */
+ struct {
+ union {
+ u16 sample_buf16;
+ u32 sample_buf32;
+ } data;
+ aligned_s64 timestamp;
+ } scan __aligned(IIO_DMA_MINALIGN);
+};
+
+static inline int ltc2378_convert_and_acquire(struct ltc2378_state *st)
+{
+ int ret;
+
+ /* Cause a rising edge of CNV to initiate a new ADC conversion */
+ gpiod_set_value_cansleep(st->cnv_gpio, 1);
+ fsleep(4);
+ ret = spi_sync_transfer(st->spi, &st->xfer, 1);
+ gpiod_set_value_cansleep(st->cnv_gpio, 0);
+
+ return ret;
+}
+
+#endif /* __DRIVERS_IIO_ADC_LTC2378_H__ */
--
2.53.0
^ permalink raw reply related
* [PATCH v3 1/5] dt-bindings: iio: adc: Add ltc2378
From: Marcelo Schmitt @ 2026-06-17 2:03 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
In-Reply-To: <cover.1781661028.git.marcelo.schmitt@analog.com>
Document how to describe LTC2378-20 and similar ADCs in device tree.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
---
Change log v2 -> v3:
- Re-added device tree fallback compatibles for LTC2378 chips, now with options
to provide a single compatible string or a pair of single compatible string
plus a fallback string to a slower sample rate spec in case a driver for the
specific part is not found.
.../bindings/iio/adc/adi,ltc2378.yaml | 160 ++++++++++++++++++
MAINTAINERS | 7 +
2 files changed, 167 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml b/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
new file mode 100644
index 000000000000..7d30a2cade8f
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
@@ -0,0 +1,160 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/adi,ltc2378.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC2378 and similar Analog to Digital Converters
+
+maintainers:
+ - Marcelo Schmitt <marcelo.schmitt@analog.com>
+
+description: |
+ Analog Devices LTC2378 series of ADCs.
+ Specifications can be found at:
+ https://www.analog.com/media/en/technical-documentation/data-sheets/233818fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236416fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236418f.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236716fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236718f.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236816f.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236818f.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/236918fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237016fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237616fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237618fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237620fb.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237716fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237718fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237720fb.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237816fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237818fa.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237820fb.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/237918fb.pdf
+ https://www.analog.com/media/en/technical-documentation/data-sheets/238016fb.pdf
+
+$ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ oneOf:
+ # Single compatible string match.
+ - enum:
+ - adi,ltc2338-18
+ - adi,ltc2364-16
+ - adi,ltc2364-18
+ - adi,ltc2367-16
+ - adi,ltc2367-18
+ - adi,ltc2368-16
+ - adi,ltc2368-18
+ - adi,ltc2369-18
+ - adi,ltc2370-16
+ - adi,ltc2376-16
+ - adi,ltc2376-18
+ - adi,ltc2376-20
+ - adi,ltc2377-16
+ - adi,ltc2377-18
+ - adi,ltc2377-20
+ - adi,ltc2378-16
+ - adi,ltc2378-18
+ - adi,ltc2378-20
+ - adi,ltc2379-18
+ - adi,ltc2380-16
+
+ # Low sample rate fallback for 16-bit unipolar sensors.
+ - items:
+ - enum:
+ - adi,ltc2370-16 # 2 MSPS
+ - adi,ltc2368-16 # 1 MSPS
+ - adi,ltc2367-16 # 500 kSPS
+ - const: adi,ltc2364-16 # fallback (250 kSPS)
+
+ # Low sample rate fallback for 18-bit unipolar sensors.
+ - items:
+ - enum:
+ - adi,ltc2369-18 # 1.6 MSPS
+ - adi,ltc2368-18 # 1 MSPS
+ - adi,ltc2367-18 # 500 kSPS
+ - const: adi,ltc2364-18 # fallback (250 kSPS)
+
+ # Low sample rate fallback for 16-bit bipolar sensors.
+ - items:
+ - enum:
+ - adi,ltc2380-16 # 2 MSPS
+ - adi,ltc2378-16 # 1 MSPS
+ - adi,ltc2377-16 # 500 kSPS
+ - const: adi,ltc2376-16 # fallback (250 kSPS)
+
+ # Low sample rate fallback for 18-bit bipolar sensors.
+ - items:
+ - enum:
+ - adi,ltc2379-18 # 1.6 MSPS
+ - adi,ltc2338-18 # 1 MSPS
+ - adi,ltc2378-18 # 1 MSPS
+ - adi,ltc2377-18 # 500 kSPS
+ - const: adi,ltc2376-18 # fallback (250 kSPS)
+
+ # Low sample rate fallback for 20-bit bipolar sensors.
+ - items:
+ - enum:
+ - adi,ltc2378-20 # 1 MSPS
+ - adi,ltc2377-20 # 500 kSPS
+ - const: adi,ltc2376-20 # fallback (250 kSPS)
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 100000000
+
+ vdd-supply:
+ description: A 2.5V supply that powers the chip (VDD).
+
+ ovdd-supply:
+ description:
+ A 1.71V to 5.25V supply that sets the logic level for digital interface.
+
+ ref-supply:
+ description:
+ A 2.5V to 5.1V supply for the reference input (REF).
+
+ cnv-gpios:
+ description:
+ When provided, this property indicates the GPIO that is connected to the
+ CNV pin.
+ maxItems: 1
+
+ interrupts:
+ description:
+ Interrupt for signaling the completion of conversion results. The active
+ low signal provided on the BUSY pin asserts when ADC conversions finish.
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - vdd-supply
+ - ovdd-supply
+ - ref-supply
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ adc@0 {
+ compatible = "adi,ltc2378-20", "adi,ltc2376-20";
+ reg = <0>;
+ spi-max-frequency = <71000000>;
+ vdd-supply = <&supply_2_5V>;
+ ovdd-supply = <&supply_3_3V>;
+ ref-supply = <&supply_5V>;
+ cnv-gpios = <&gpio0 88 GPIO_ACTIVE_HIGH>;
+ interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+ interrupt-parent = <&gpio>;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index b051eccafa60..205acb4b0789 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15220,6 +15220,13 @@ S: Maintained
F: Documentation/devicetree/bindings/iio/dac/lltc,ltc1660.yaml
F: drivers/iio/dac/ltc1660.c
+LTC2378 IIO ADC DRIVER
+M: Marcelo Schmitt <marcelo.schmitt@analog.com>
+L: linux-iio@vger.kernel.org
+S: Supported
+W: https://ez.analog.com/linux-software-drivers
+F: Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
+
LTC2664 IIO DAC DRIVER
M: Michael Hennerich <michael.hennerich@analog.com>
M: Kim Seer Paller <kimseer.paller@analog.com>
--
2.53.0
^ permalink raw reply related
* [PATCH v3 0/5] iio: adc: Add support for LTC2378 and similar ADCs
From: Marcelo Schmitt @ 2026-06-17 2:02 UTC (permalink / raw)
To: linux-iio, devicetree, linux-kernel
Cc: jic23, nuno.sa, Michael.Hennerich, dlechner, andy, robh, krzk+dt,
conor+dt, pop.ioan-daniel, marcelo.schmitt1
This patch series adds support for LTC2378 and similar low noise, low power,
high speed, successive approximation register (SAR) ADCs. These ADCs are similar
among each other, varying mainly on the amount of precision bits, maximum sample
rate, and input configuration (either fully differential or pseudo-differential).
The first patch adds device tree documentation for LTC2378.
The second patch enables single-shot sample read with a GPIO connected
to the LTC2378 CNV pin.
The third patch extends IIO DMAengine buffer interface to make
sampling_frequency and sampling_frequency_available buffer attributes.
The fourth patch enables high-speed data captures with SPI offloading.
The setup is similar to AD4030, with a specialized PWM generator being used both
for SPI offload triggering and conversion start signaling.
The last support patch enables running buffered data captures without SPI offloading.
Even though these parts are somewhat similar to AD4000, the wiring configuration
for LTC parts is different as well as the available HDL for high speed sample
rate mode. Because of that, I propose creating a new device driver for
supporting LTC2378-like devices.
Specifications can be found at:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/233818fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236416fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236418f.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236716fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236718f.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236816f.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236818f.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/236918fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237016fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237616fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237618fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237620fb.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237716fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237718fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237720fb.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237816fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237818fa.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237820fb.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/237918fb.pdf
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/238016fb.pdf
Some structures and variables are introduced earlier to reduce diff in latter patches.
The initial version of the LTC2378 driver was developed by Ioan-Daniel. Though,
despite of the many changes I made to the code, I've kept him as module author
to provide credit for his work.
Previous submissions:
v2: https://lore.kernel.org/linux-iio/cover.1779976379.git.marcelo.schmitt@analog.com/
v1: https://lore.kernel.org/linux-iio/cover.1779117444.git.marcelo.schmitt1@gmail.com/
Change log v2 -> v3:
[DT]
- Re-added device tree fallback compatibles for LTC2378 chips, now with options
to provide a single compatible string or a pair of single compatible string
plus a fallback string to a slower sample rate spec in case a driver for the
specific part is not found.
[IIO]
- Restricted LTC2378 dependency list to require GPIO
- Use datasheet terminology to indicate polarity/output code.
- Added missing block scope to IIO_DEV_ACQUIRE_DIRECT_MODE.
- Added missing static inline modifier to function stubs declared in header file.
- Fixed the evaluation loop conditions for CNV PWM and SPI Engine trigger PWM,
avoiding potential infinite loop if and CPU stall.
- Added comment to about initial PWM disable.
- Adjusted SPI offload setup initialization to not print error on a valid condition.
- Fully initialize IIO channel scan_type.
- Reworked to make offload support not imply all dependencies to be built in.
- Made sampling_frequency a buffer attribute.
- Made offload support not require DMA and other features to be built in.
- Now using same scan_type configuration for all use cases.
With best regards,
Marcelo
Marcelo Schmitt (5):
dt-bindings: iio: adc: Add ltc2378
iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs
iio: buffer: Extend DMAengine buffer interfaces to take extra sysfs
attributes
iio: adc: ltc2378: Enable high-speed data capture
iio: adc: ltc2378: Enable triggered buffer data capture
.../bindings/iio/adc/adi,ltc2378.yaml | 160 ++++++++
MAINTAINERS | 8 +
drivers/iio/adc/Kconfig | 30 ++
drivers/iio/adc/Makefile | 7 +
drivers/iio/adc/ad4000.c | 3 +-
drivers/iio/adc/ad4030.c | 3 +-
drivers/iio/adc/ad4691.c | 3 +-
drivers/iio/adc/ad4695.c | 2 +-
drivers/iio/adc/ad7380.c | 2 +-
drivers/iio/adc/ad7606_spi.c | 2 +-
drivers/iio/adc/ad7768-1.c | 3 +-
drivers/iio/adc/ad7944.c | 2 +-
drivers/iio/adc/ad_sigma_delta.c | 2 +-
drivers/iio/adc/ltc2378-lib-core.c | 50 +++
drivers/iio/adc/ltc2378-offload-buffer.c | 305 ++++++++++++++
drivers/iio/adc/ltc2378-triggered-buffer.c | 49 +++
drivers/iio/adc/ltc2378.c | 384 ++++++++++++++++++
drivers/iio/adc/ltc2378.h | 120 ++++++
.../buffer/industrialio-buffer-dmaengine.c | 19 +-
drivers/iio/dac/ad5791.c | 2 +-
drivers/iio/dac/ad8460.c | 2 +-
drivers/iio/dac/adi-axi-dac.c | 2 +-
include/linux/iio/buffer-dmaengine.h | 16 +-
23 files changed, 1151 insertions(+), 25 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,ltc2378.yaml
create mode 100644 drivers/iio/adc/ltc2378-lib-core.c
create mode 100644 drivers/iio/adc/ltc2378-offload-buffer.c
create mode 100644 drivers/iio/adc/ltc2378-triggered-buffer.c
create mode 100644 drivers/iio/adc/ltc2378.c
create mode 100644 drivers/iio/adc/ltc2378.h
base-commit: a50909aa46dec46de3c73235fc15a7d6f763d996
--
2.53.0
^ permalink raw reply
* Re: [PATCH 4/4] arm64: dts: qcom: Add PMIH0108 haptics device node
From: Fenglin Wu @ 2026-06-17 1:30 UTC (permalink / raw)
To: Konrad Dybcio, linux-arm-msm, Dmitry Torokhov, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Lee Jones, Stephen Boyd,
Bjorn Andersson, Konrad Dybcio
Cc: David Collins, Subbaraman Narayanamurthy, Kamal Wadhwa, kernel,
linux-input, devicetree, linux-kernel
In-Reply-To: <6b3155ea-b583-4f82-8313-7a057fd78066@oss.qualcomm.com>
On 6/16/2026 6:27 PM, Konrad Dybcio wrote:
> On 6/16/26 12:08 PM, Fenglin Wu wrote:
>> Add haptics device node in the PMIH0108 PMIC base dtsi files, and enable
>> it on several boards according to the LRA (Linear Resonant Actuator)
>> component mounted on each of them.
>>
>> Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
>> ---
>> arch/arm64/boot/dts/qcom/kaanapali-mtp.dts | 7 +++++++
>> arch/arm64/boot/dts/qcom/kaanapali-qrd.dts | 7 +++++++
>> arch/arm64/boot/dts/qcom/pmih0108-kaanapali.dtsi | 9 +++++++++
>> arch/arm64/boot/dts/qcom/pmih0108.dtsi | 9 +++++++++
>> arch/arm64/boot/dts/qcom/sm8750-mtp.dts | 7 +++++++
>> arch/arm64/boot/dts/qcom/sm8750-qrd.dts | 7 +++++++
> One commit per board, please
>
>> 6 files changed, 46 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/qcom/kaanapali-mtp.dts b/arch/arm64/boot/dts/qcom/kaanapali-mtp.dts
>> index 07247dc98b70..7e3f59fc008e 100644
>> --- a/arch/arm64/boot/dts/qcom/kaanapali-mtp.dts
>> +++ b/arch/arm64/boot/dts/qcom/kaanapali-mtp.dts
>> @@ -952,6 +952,13 @@ wifi@0 {
>> };
>> };
>>
>> +&pmih0108_e1_haptics {
>> + status = "okay";
> 'status' should go last
>
>> +
>> + qcom,lra-period-us = <6667>;
>> + qcom,vmax-mv = <3600>;
> Do these properties depend on the physical characteristics on what's
> connected to the other end of the haptics driver?
Correct. They are basically the parameters of the LRA that's used on the
board. You can find details of them in the binding document.
>
> Konrad
^ permalink raw reply
* Re: [PATCH v2] dt-bindings: i2c: microchip,corei2c: permit resets
From: Andi Shyti @ 2026-06-16 23:45 UTC (permalink / raw)
To: Conor Dooley
Cc: linux-i2c, Conor Dooley, Krzysztof Kozlowski, Daire McNamara,
Rob Herring, Krzysztof Kozlowski, linux-riscv, devicetree,
linux-kernel
In-Reply-To: <20260506-bronchial-kitten-e3697fb66ba7@spud>
Hi Conor,
On Wed, May 06, 2026 at 04:00:46PM +0100, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> Both CoreI2C and the hardened versions of it on mpfs and pic64gx have a
> reset pin. For the former, usually this is wired to a common fabric
> reset not managed by software and for the latter two the platform
> firmware takes them out of reset on first-party boards (or those using
> modified versions of the vendor firmware), but not all boards may take
> this approach. Permit providing a reset in devicetree for Linux, or
> other devicetree-consuming software, to use.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
merged to i2c/i2c-host.
Thanks,
Andi
^ permalink raw reply
* Re: [PATCH] dt-bindings: i2c: convert axxia i2c to dt-schema
From: Andi Shyti @ 2026-06-16 23:35 UTC (permalink / raw)
To: Chaitanya Sabnis
Cc: wsa, anders.berg, robh, krzk+dt, conor+dt, linux-i2c, devicetree,
linux-kernel
In-Reply-To: <20260505100854.5258-1-chaitanya.msabnis@gmail.com>
Hi Chaitanya,
On Tue, May 05, 2026 at 03:38:54PM +0530, Chaitanya Sabnis wrote:
> Convert the LSI Axxia I2C Controller bindings from legacy text
> format to modern dt-schema (YAML).
>
> During the conversion, the obsolete `device_type = "i2c"` property
> was dropped from the example, as it is deprecated and not utilized
> by the driver. The `clock-names` property is enforced as required
> matching the driver probe behavior. The example node address was
> also updated to a standard 32-bit address.
>
> Signed-off-by: Chaitanya Sabnis <chaitanya.msabnis@gmail.com>
Sorry for the delay, merged to i2c/i2c-for-7.2.
Thanks,
Andi
^ permalink raw reply
* Re: [PATCH v6 2/2] i2c: ls2x: Add clocks property parsing and adjust bus speed
From: Andi Shyti @ 2026-06-16 22:55 UTC (permalink / raw)
To: Hongliang Wang
Cc: Binbin Zhou, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Wolfram Sang, linux-i2c, devicetree, loongarch, Huacai Chen,
stable
In-Reply-To: <20260608024533.32419-3-wanghongliang@loongson.cn>
Hi Hongliang,
On Mon, Jun 08, 2026 at 10:45:33AM +0800, Hongliang Wang wrote:
> The i2c-ls2x driver supports dts and acpi parameter passing.
>
> In dts, uses clock framework, by parsing clocks property to
> get i2c bus reference clock, and define the div of reference
> clock by device data.
>
> In acpi, by passing clocks property to describe i2c bus reference
> clock and clock-div property to describe the div of reference clock.
>
> Based on i2c bus reference clock(clock_a), i2c bus speed(clock_s)
> and div, calculate the prcescale of i2c divider register. The
> calculation formula is
>
> prcescale = (clock_a*10)/(div*clock_s)-1
>
> Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> Cc: stable@vger.kernel.org
what are you fixing exactly? It's not clear from the commit log.
Do we need to add the Fixes tag?
> Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
...
> @@ -96,6 +104,8 @@ static irqreturn_t ls2x_i2c_isr(int this_irq, void *dev_id)
> static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
> {
> u16 val;
> + u32 pclk, div;
> + struct clk *clk;
> struct i2c_timings *t = &priv->i2c_t;
> struct device *dev = priv->adapter.dev.parent;
> u32 acpi_speed = i2c_acpi_find_bus_speed(dev);
> @@ -107,12 +117,30 @@ static void ls2x_i2c_adjust_bus_speed(struct ls2x_i2c_priv *priv)
> else
> t->bus_freq_hz = LS2X_I2C_FREQ_STD;
>
> + if (dev_of_node(dev)) {
> + clk = devm_clk_get_optional_enabled(dev, NULL);
Here you got a valid comment from the sashiko-bot, did you check
it?
There are some other comments that is worth checking.
Thanks,
Andi
> + if (!IS_ERR_OR_NULL(clk))
> + pclk = clk_get_rate(clk);
> + else
> + pclk = LS2X_I2C_PCLK_FREQ;
...
^ permalink raw reply
* Re: [PATCH v2] dt-bindings: arm: xen: Convert to DT schema
From: Rob Herring (Arm) @ 2026-06-16 22:30 UTC (permalink / raw)
To: Tejas; +Cc: conor+dt, sstabellini, krzk+dt, devicetree
In-Reply-To: <20260615130928.10198-1-tejasmutalikdesai@gmail.com>
On Mon, 15 Jun 2026 18:39:28 +0530, Tejas wrote:
> Convert the Xen ARM device tree binding documentation from the legacy
> plain-text format (Documentation/devicetree/bindings/arm/xen.txt) to
> the YAML schema format, as required by the modern DT binding process.
> The old xen.txt is removed as the YAML schema is now the authoritative
> source.
>
> The YAML schema:
> - Uses the preferred dual license (GPL-2.0-only OR BSD-2-Clause)
> - Validates compatible string format as "xen,xen-<major>.<minor>"
> followed by the generic "xen,xen" string
> - Documents reg as accepting 1..N regions (region 0 mandatory for
> grant table mapping; regions 1..N optional extended regions)
> - Documents the uefi subnode with correct types:
> * xen,uefi-system-table: uint64 (guest PA of UEFI System Table)
> * xen,uefi-mmap-start: uint64 (guest PA of UEFI memory map)
> * xen,uefi-mmap-size: uint32 (size of UEFI memory map)
> * xen,uefi-mmap-desc-size: uint32 (size of each mmap entry)
> * xen,uefi-mmap-desc-ver: uint32 (mmap descriptor format version)
> - Marks all five xen,uefi-* properties as required within the uefi
> subnode; the source table lists all of them as unconditionally
> populated by Xen when UEFI is supported
> - 64-bit properties use /bits/ 64 <value> in the example, consistent
> with other bindings carrying uint64 properties (e.g. opp-v2.yaml,
> arm/mali-bifrost.yaml)
>
> The uefi subnode was originally introduced through a multi-version review
> series (v2..v7); the mistakes caught during those reviews (typos,
> duplicated UEFI spec content, insufficient description of Xen-specific
> hypercall semantics) are avoided with deliberate caution here.
>
> Note: the example emits a dtc warning (unit_address_vs_reg) for the
> /hypervisor node. Both the normative text in xen.txt ("Xen ARM virtual
> platforms shall have a top-level 'hypervisor' node") and the example
> in xen.txt mandate this exact node name — the $nodename: const:
> hypervisor in the schema is a direct encoding of that pre-existing
> requirement. A unit address is therefore impossible despite the presence
> of reg. This warning is pre-existing and not introduced by this
> conversion.
>
> Signed-off-by: Tejas Mutalikdesai <tejasmutalikdesai@gmail.com>
> ---
> Changes since v1:
> - Switch to dual license (GPL-2.0-only OR BSD-2-Clause) as required by
> submitting-patches.rst §3
> - Add required: for all five xen,uefi-* properties within the uefi subnode;
> the source table lists them as unconditionally populated by Xen
> - Fix grammar: "an HYPERVISOR_memory_op" -> "a HYPERVISOR_memory_op"
> - Fix subject: s/YAML schema/DT schema/ per submitting-patches.rst
>
> Documentation/devicetree/bindings/arm/xen.txt | 62 ---------
> .../devicetree/bindings/arm/xen.yaml | 120 ++++++++++++++++++
> 2 files changed, 120 insertions(+), 62 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/arm/xen.txt
> create mode 100644 Documentation/devicetree/bindings/arm/xen.yaml
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/arm/xen.example.dts:13.16-26.7: Warning (unit_address_vs_reg): /hypervisor: node has a reg or ranges property, but no unit name
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/xen.example.dtb: /: 'compatible' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/arm/xen.example.dtb: /: 'model' is a required property
from schema $id: http://devicetree.org/schemas/root-node.yaml
doc reference errors (make refcheckdocs):
Warning: arch/arm/xen/enlighten.c references a file that doesn't exist: Documentation/devicetree/bindings/arm/xen.txt
arch/arm/xen/enlighten.c: Documentation/devicetree/bindings/arm/xen.txt
See https://patchwork.kernel.org/project/devicetree/patch/20260615130928.10198-1-tejasmutalikdesai@gmail.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply
* [GIT PULL] Devicetree updates for v7.2
From: Rob Herring @ 2026-06-16 21:32 UTC (permalink / raw)
To: Linus Torvalds
Cc: Saravana Kannan, Krzysztof Kozlowski, Conor Dooley, linux-kernel,
devicetree
Linus,
Please pull DT updates for 7.2.
Rob
The following changes since commit 254f49634ee16a731174d2ae34bc50bd5f45e731:
Linux 7.1-rc1 (2026-04-26 14:19:00 -0700)
are available in the Git repository at:
ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/robh/linux.git tags/devicetree-for-7.2
for you to fetch changes up to faa25db0892135c97a0bfd48d79173db0dd25ab2:
dt-bindings: interrupt-controller: qcom,pdc: Add Maili compatible string (2026-06-16 08:53:12 -0500)
----------------------------------------------------------------
Devicetree updates for v7.2:
DT core:
- Add support for handling multiple cells in "iommu-map" entries.
- Support only 1 entry in /reserved-memory "reg" entries. Support for
more than 1 entry has been broken.
- Fix a UAF on alloc_reserved_mem_array() failure
- Make "ibm,phandle" handling logic specific to PPC
- Use memcpy() instead of strcpy() for known length strings
- Ensure __of_find_n_match_cpu_property() handles malformed "reg"
entries
- Add various checks that expected strings are strings before accessing
them
- Drop redundant memset() when unflattening DT
DT bindings:
- Add a DTS style checker. Currently hooked up to dt_binding_check to
check examples.
- Convert st,nomadik platform, ti,omap-dmm, and ti,irq-crossbar
bindings to DT schema
- Add Apple System Management Controller hwmon, Qualcomm Hamoa Embedded
Controller, Qualcomm IPQ6018 PWM controller, fsl,mc1323, Samsung
SOFEF01-M DDIC panel, Freescale i.MX53 Television Encoder, Samsung S2M
series PMIC extcon, and MT6365 PMIC AuxADC schemas
- Extend bindings for QCom Maili and Nord PDC, QCom Hali fastrpc,
qcom,eliza-imem, qcom,oryon-1-5 CPU, and MT6365 Keys
- Consolidate "sram" property definitions
- Fix constraints on "nvmem" properties which only contain phandles and
no arg cells
- Another pass of fixing "phandle-array" constraints
- Add Gira vendor prefix
----------------------------------------------------------------
Alexander Koskovich (1):
dt-bindings: sram: Document qcom,eliza-imem
Andrew Rembrandt (1):
dt-bindings: arm: st,nomadik: Convert to DT schema
Bhargav Joshi (2):
dt-bindings: soc: ti,omap-dmm: Convert to DT schema
dt-bindings: interrupt-controller: ti,irq-crossbar: Convert to DT schema
Charan Teja Kalla (1):
of: Factor arguments passed to of_map_id() into a struct
Daniel Golle (6):
dt-bindings: misc: fsl,qoriq-mc: drop trailing whitespace
dt-bindings: drop tab characters from DTS examples
dt-bindings: add DTS style checker
scripts/jobserver-exec: propagate child exit status
dt-bindings: wire style checker into dt_binding_check
dt-bindings: add self-test fixtures for style checker
Daniel Palmer (1):
drivers/of: fdt: Make ibm,phandle logic only happen on pseries
David Laight (1):
drivers/of/overlay: Use memcpy() to copy known length strings
Devi Priya (1):
dt-bindings: pwm: add IPQ6018 binding
Frank Li (3):
dt-bindings: display: imx: add deprecated property 'port' and 'display-timings'
dt-bindings: display: imx: Add television encoder (TVE) for imx53
dt-bindings: trivial-devices: add fsl,mc1323
Geert Uytterhoeven (2):
dt-bindings: interrupt-controller: renesas,r9a09g077-icu: Fix reg size in example
dt-bindings: cache: l2c2x0: Add missing power-domains
James Calligeros (1):
dt-bindings: hwmon: Add Apple System Management Controller hwmon schema
Kaustabh Chakraborty (1):
dt-bindings: extcon: document Samsung S2M series PMIC extcon device
Konrad Dybcio (1):
dt-bindings: nvmem: consumer: Make 'nvmem' an array of one-item entries
Krzysztof Kozlowski (4):
docs: dt: writing-bindings: Extend compatible fallbacks guideline
docs: dt: submitting-patches: Remove possible confusion of combining DTS
media: dt-bindings: mediatek: Constrain iommus
docs: dt: writing-schema: Clarify what is required in a schema
Louis-Alexis Eyraud (2):
dt-bindings: input: mediatek,pmic-keys: Add MT6365 support
dt-bindings: iio: adc: mt6359: Add MT6365 PMIC AuxADC
Lucas Stach (1):
dt-bindings: vendor-prefixes: add Gira
Marijn Suijten (1):
dt-bindings: display: panel: Describe Samsung SOFEF01-M DDIC
Maya Matuszczyk (1):
dt-bindings: embedded-controller: Add Qualcomm reference device EC description
Mukesh Ojha (1):
dt-bindings: misc: qcom,fastrpc: Add compatible for Hawi SoC
Pengpeng Hou (2):
drivers/of: validate live-tree string properties before string use
drivers/of: validate status properties in reconfig state changes
Rob Herring (Arm) (2):
dt-bindings: Fix phandle-array constraints, again
dt-bindings: Consolidate "sram" property definition
Robin Murphy (2):
of: Add convenience wrappers for of_map_id()
of: Respect #{iommu,msi}-cells in maps
Sang-Heon Jeon (1):
of/fdt: remove redundant memset in __unflatten_device_tree()
Sergey Shtylyov (1):
of: cpu: add check in __of_find_n_match_cpu_property()
Shawn Guo (2):
dt-bindings: arm: cpus: Add compatible qcom,oryon-1-5
dt-bindings: interrupt-controller: Document PDC for Qualcomm Nord SoC
Svyatoslav Ryhel (2):
dt-bindings: display: bridge: ssd2825: inherit dsi-controller properties
dt-bindings: media: mt9m114: document common video device properties
Wandun Chen (4):
of: reserved_mem: only support one <base size> entry in reg property
of: reserved_mem: avoid post-init UAF when alloc_reserved_mem_array() fails
of: reserved_mem: handle NULL name in of_reserved_mem_lookup()
of: reserved_mem: zero total_reserved_mem_cnt if no valid /reserved-memory entry
Yijie Yang (1):
dt-bindings: interrupt-controller: qcom,pdc: Add Maili compatible string
bui duc phuc (1):
dt-bindings: Remove the redundant 'type: boolean'
Documentation/devicetree/bindings/Makefile | 19 +-
Documentation/devicetree/bindings/arm/cpus.yaml | 1 +
.../devicetree/bindings/arm/omap/crossbar.txt | 55 -
Documentation/devicetree/bindings/arm/omap/dmm.txt | 22 -
.../devicetree/bindings/arm/st,nomadik.yaml | 23 +
.../devicetree/bindings/arm/ste-nomadik.txt | 38 -
.../devicetree/bindings/cache/l2c2x0.yaml | 3 +
.../bindings/display/bridge/solomon,ssd2825.yaml | 3 +-
.../display/imx/fsl,imx-parallel-display.yaml | 11 +
.../bindings/display/imx/fsl,imx53-tve.yaml | 104 ++
.../imx/fsl,imx8qxp-dc-command-sequencer.yaml | 2 +-
.../bindings/display/mediatek/mediatek,ovl-2l.yaml | 5 +-
.../bindings/display/mediatek/mediatek,ovl.yaml | 5 +-
.../bindings/display/mediatek/mediatek,rdma.yaml | 4 +-
.../bindings/display/mediatek/mediatek,wdma.yaml | 4 +-
.../devicetree/bindings/display/msm/gpu.yaml | 6 +-
.../bindings/display/panel/samsung,sofef01-m.yaml | 94 ++
.../display/rockchip/rockchip,rk3399-cdn-dp.yaml | 2 +
.../devicetree/bindings/dma/stericsson,dma40.yaml | 8 +-
.../embedded-controller/qcom,hamoa-crd-ec.yaml | 56 +
.../bindings/extcon/samsung,s2mu005-muic.yaml | 40 +
.../devicetree/bindings/hwmon/apple,smc-hwmon.yaml | 85 ++
.../devicetree/bindings/i2c/i2c-demux-pinctrl.yaml | 1 +
.../bindings/i2c/opencores,i2c-ocores.yaml | 8 +-
.../bindings/iio/adc/mediatek,mt6359-auxadc.yaml | 17 +-
.../bindings/iio/adc/st,spear600-adc.yaml | 2 +-
.../devicetree/bindings/input/atmel,maxtouch.yaml | 3 +-
.../devicetree/bindings/input/imx-keypad.yaml | 32 +-
.../bindings/input/mediatek,pmic-keys.yaml | 21 +-
.../bindings/input/microchip,cap11xx.yaml | 12 +-
.../bindings/input/touchscreen/ti,ads7843.yaml | 4 +-
.../bindings/interrupt-controller/qcom,pdc.yaml | 2 +
.../renesas,r9a09g077-icu.yaml | 2 +-
.../interrupt-controller/ti,irq-crossbar.yaml | 96 ++
.../devicetree/bindings/leds/leds-lp55xx.yaml | 2 +-
.../devicetree/bindings/media/cnm,wave521c.yaml | 2 +-
.../bindings/media/i2c/onnn,mt9m114.yaml | 5 +-
.../bindings/media/mediatek,vcodec-encoder.yaml | 2 +-
.../media/mediatek,vcodec-subdev-decoder.yaml | 2 +-
.../devicetree/bindings/media/nxp,imx8-jpeg.yaml | 6 +-
.../devicetree/bindings/media/rockchip,vdec.yaml | 5 +-
.../devicetree/bindings/media/st,stm32-dcmi.yaml | 6 +-
.../memory-controllers/nvidia,tegra20-mc.yaml | 4 +-
.../memory-controllers/samsung,exynos5422-dmc.yaml | 2 +-
.../devicetree/bindings/mfd/apple,smc.yaml | 36 +
.../devicetree/bindings/mfd/rockchip,rk816.yaml | 3 +-
.../devicetree/bindings/misc/fsl,qoriq-mc.yaml | 2 +-
.../devicetree/bindings/misc/qcom,fastrpc.yaml | 1 +
.../mmc/hisilicon,hi3798cv200-dw-mshc.yaml | 7 +-
.../devicetree/bindings/net/mediatek,net.yaml | 3 +-
.../devicetree/bindings/net/qcom,bam-dmux.yaml | 12 +
.../devicetree/bindings/net/qcom,ipa.yaml | 12 +
.../devicetree/bindings/net/ti,icssg-prueth.yaml | 2 +-
.../devicetree/bindings/net/ti,icssm-prueth.yaml | 2 +-
.../bindings/net/wireless/qcom,ath10k.yaml | 8 +-
.../bindings/net/wireless/qcom,ath11k.yaml | 8 +-
.../bindings/net/wireless/qcom,ipq5332-wifi.yaml | 18 +
.../devicetree/bindings/nvmem/nvmem-consumer.yaml | 2 +
.../bindings/pci/mediatek-pcie-mt7623.yaml | 4 +-
.../bindings/pci/samsung,exynos-pcie.yaml | 2 +-
.../devicetree/bindings/pci/toshiba,tc9563.yaml | 5 +-
.../devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml | 51 +
.../remoteproc/amlogic,meson-mx-ao-arc.yaml | 7 +-
.../bindings/remoteproc/qcom,msm8916-mss-pil.yaml | 6 +
.../bindings/remoteproc/qcom,msm8996-mss-pil.yaml | 7 +
.../bindings/remoteproc/qcom,pas-common.yaml | 6 +
.../bindings/remoteproc/qcom,qcs404-cdsp-pil.yaml | 6 +
.../bindings/remoteproc/qcom,sc7180-mss-pil.yaml | 6 +
.../bindings/remoteproc/qcom,sc7280-adsp-pil.yaml | 6 +
.../bindings/remoteproc/qcom,sc7280-mss-pil.yaml | 6 +
.../bindings/remoteproc/qcom,sc7280-wpss-pil.yaml | 6 +
.../bindings/remoteproc/qcom,sdm845-adsp-pil.yaml | 6 +
.../bindings/remoteproc/qcom,wcnss-pil.yaml | 6 +
.../bindings/remoteproc/ti,k3-dsp-rproc.yaml | 8 -
.../bindings/remoteproc/ti,k3-r5f-rproc.yaml | 8 -
.../bindings/remoteproc/xlnx,zynqmp-r5fss.yaml | 9 +-
.../devicetree/bindings/soc/ti/ti,omap-dmm.yaml | 53 +
.../bindings/sound/davinci-mcasp-audio.yaml | 4 +-
.../devicetree/bindings/sound/samsung,tm2.yaml | 8 +-
.../devicetree/bindings/sound/simple-card.yaml | 6 +-
.../devicetree/bindings/spi/st,stm32-spi.yaml | 10 +-
.../devicetree/bindings/spi/st,stm32mp25-ospi.yaml | 5 +-
.../devicetree/bindings/sram/sram-consumer.yaml | 26 +
Documentation/devicetree/bindings/sram/sram.yaml | 1 +
.../devicetree/bindings/submitting-patches.rst | 7 +-
.../devicetree/bindings/trivial-devices.yaml | 2 +
.../bindings/usb/chipidea,usb2-common.yaml | 2 +
.../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 7 +-
.../devicetree/bindings/usb/richtek,rt1711h.yaml | 3 +-
.../devicetree/bindings/usb/ti,j721e-usb.yaml | 8 +-
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
.../devicetree/bindings/writing-bindings.rst | 12 +-
.../devicetree/bindings/writing-schema.rst | 2 +-
MAINTAINERS | 8 +-
Makefile | 6 +
drivers/cdx/cdx_msi.c | 10 +-
drivers/iommu/of_iommu.c | 6 +-
drivers/irqchip/irq-gic-its-msi-parent.c | 10 +-
drivers/of/base.c | 270 ++++-
drivers/of/cpu.c | 2 +-
drivers/of/dynamic.c | 20 +-
drivers/of/fdt.c | 4 +-
drivers/of/irq.c | 32 +-
drivers/of/of_reserved_mem.c | 79 +-
drivers/of/overlay.c | 4 +-
drivers/of/property.c | 27 +-
drivers/of/unittest.c | 32 +
drivers/pci/controller/dwc/pci-imx6.c | 55 +-
drivers/pci/controller/pcie-apple.c | 6 +-
drivers/xen/grant-dma-ops.c | 5 +-
include/linux/of.h | 32 +-
scripts/dtc/dt-check-style | 1192 ++++++++++++++++++++
scripts/dtc/dt-style-selftest/bad/dts-spaces.dts | 12 +
.../bad/yaml-child-addr-order.yaml | 41 +
.../bad/yaml-child-name-order.yaml | 37 +
.../dtc/dt-style-selftest/bad/yaml-cont-align.yaml | 30 +
.../bad/yaml-digit-node-order.yaml | 37 +
.../dtc/dt-style-selftest/bad/yaml-hex-case.yaml | 29 +
.../dt-style-selftest/bad/yaml-indent-strict.yaml | 29 +
.../bad/yaml-label-in-string.yaml | 30 +
.../dt-style-selftest/bad/yaml-line-length.yaml | 29 +
.../dt-style-selftest/bad/yaml-mixed-indent.yaml | 29 +
.../dt-style-selftest/bad/yaml-multi-close.yaml | 35 +
.../dtc/dt-style-selftest/bad/yaml-node-close.yaml | 31 +
.../dtc/dt-style-selftest/bad/yaml-prop-order.yaml | 29 +
.../dt-style-selftest/bad/yaml-prop-pairing.yaml | 33 +
.../dt-style-selftest/bad/yaml-required-blank.yaml | 33 +
scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml | 29 +
.../bad/yaml-trailing-comment.yaml | 26 +
.../dt-style-selftest/bad/yaml-trailing-ws.yaml | 29 +
.../bad/yaml-unclosed-comment.yaml | 30 +
.../bad/yaml-unit-addr-prefix.yaml | 29 +
.../dtc/dt-style-selftest/bad/yaml-unit-addr.yaml | 29 +
.../dt-style-selftest/bad/yaml-unused-label.yaml | 29 +
.../bad/yaml-value-ws-multiline.yaml | 27 +
.../dtc/dt-style-selftest/bad/yaml-value-ws.yaml | 29 +
.../dt-style-selftest/expected/dts-spaces.dts.txt | 2 +
.../expected/yaml-child-addr-order.yaml.txt | 2 +
.../expected/yaml-child-name-order.yaml.txt | 2 +
.../expected/yaml-cont-align.yaml.txt | 2 +
.../expected/yaml-digit-node-order.yaml.txt | 2 +
.../expected/yaml-hex-case.yaml.txt | 2 +
.../expected/yaml-indent-strict.yaml.txt | 2 +
.../expected/yaml-label-in-string.yaml.txt | 2 +
.../expected/yaml-line-length.yaml.txt | 2 +
.../expected/yaml-mixed-indent.yaml.txt | 3 +
.../expected/yaml-multi-close.yaml.txt | 3 +
.../expected/yaml-node-close.yaml.txt | 2 +
.../expected/yaml-prop-order.yaml.txt | 2 +
.../expected/yaml-prop-pairing.yaml.txt | 3 +
.../expected/yaml-required-blank.yaml.txt | 3 +
.../dt-style-selftest/expected/yaml-tab.yaml.txt | 2 +
.../expected/yaml-trailing-comment.yaml.txt | 2 +
.../expected/yaml-trailing-ws.yaml.txt | 2 +
.../expected/yaml-unclosed-comment.yaml.txt | 2 +
.../expected/yaml-unit-addr-prefix.yaml.txt | 2 +
.../expected/yaml-unit-addr.yaml.txt | 2 +
.../expected/yaml-unused-label.yaml.txt | 2 +
.../expected/yaml-value-ws-multiline.yaml.txt | 2 +
.../expected/yaml-value-ws.yaml.txt | 2 +
.../dtc/dt-style-selftest/good/dts-cont-align.dts | 26 +
scripts/dtc/dt-style-selftest/good/dts-tab.dts | 29 +
.../dtc/dt-style-selftest/good/yaml-4space.yaml | 41 +
.../good/yaml-tricky-parsing.yaml | 57 +
scripts/dtc/dt-style-selftest/run.sh | 71 ++
scripts/jobserver-exec | 4 +-
166 files changed, 3608 insertions(+), 448 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/arm/omap/crossbar.txt
delete mode 100644 Documentation/devicetree/bindings/arm/omap/dmm.txt
create mode 100644 Documentation/devicetree/bindings/arm/st,nomadik.yaml
delete mode 100644 Documentation/devicetree/bindings/arm/ste-nomadik.txt
create mode 100644 Documentation/devicetree/bindings/display/imx/fsl,imx53-tve.yaml
create mode 100644 Documentation/devicetree/bindings/display/panel/samsung,sofef01-m.yaml
create mode 100644 Documentation/devicetree/bindings/embedded-controller/qcom,hamoa-crd-ec.yaml
create mode 100644 Documentation/devicetree/bindings/extcon/samsung,s2mu005-muic.yaml
create mode 100644 Documentation/devicetree/bindings/hwmon/apple,smc-hwmon.yaml
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/ti,irq-crossbar.yaml
create mode 100644 Documentation/devicetree/bindings/pwm/qcom,ipq6018-pwm.yaml
create mode 100644 Documentation/devicetree/bindings/soc/ti/ti,omap-dmm.yaml
create mode 100644 Documentation/devicetree/bindings/sram/sram-consumer.yaml
create mode 100755 scripts/dtc/dt-check-style
create mode 100644 scripts/dtc/dt-style-selftest/bad/dts-spaces.dts
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-child-addr-order.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-child-name-order.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-cont-align.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-digit-node-order.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-hex-case.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-indent-strict.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-label-in-string.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-line-length.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-mixed-indent.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-multi-close.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-node-close.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-prop-order.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-prop-pairing.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-required-blank.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-tab.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-trailing-comment.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-trailing-ws.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-unclosed-comment.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-unit-addr-prefix.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-unit-addr.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-unused-label.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-value-ws-multiline.yaml
create mode 100644 scripts/dtc/dt-style-selftest/bad/yaml-value-ws.yaml
create mode 100644 scripts/dtc/dt-style-selftest/expected/dts-spaces.dts.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-child-addr-order.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-child-name-order.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-cont-align.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-digit-node-order.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-hex-case.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-indent-strict.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-label-in-string.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-line-length.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-mixed-indent.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-multi-close.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-node-close.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-prop-order.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-prop-pairing.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-required-blank.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-tab.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-trailing-comment.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-trailing-ws.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-unclosed-comment.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-unit-addr-prefix.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-unit-addr.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-unused-label.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-value-ws-multiline.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/expected/yaml-value-ws.yaml.txt
create mode 100644 scripts/dtc/dt-style-selftest/good/dts-cont-align.dts
create mode 100644 scripts/dtc/dt-style-selftest/good/dts-tab.dts
create mode 100644 scripts/dtc/dt-style-selftest/good/yaml-4space.yaml
create mode 100644 scripts/dtc/dt-style-selftest/good/yaml-tricky-parsing.yaml
create mode 100755 scripts/dtc/dt-style-selftest/run.sh
^ permalink raw reply
* Re: [PATCH v8 4/7] input: keyboard: Add driver for ASUS Transformer dock multimedia keys
From: Dmitry Torokhov @ 2026-06-16 21:23 UTC (permalink / raw)
To: Svyatoslav Ryhel
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
Pavel Machek, Sebastian Reichel, Ion Agorria,
Michał Mirosław, devicetree, linux-kernel, linux-input,
linux-leds, linux-pm
In-Reply-To: <CAPVz0n2fnM6zYtP9bCtsY9mcLdce_R+1UPmMo0o4JRgjnhuhKA@mail.gmail.com>
On Tue, Jun 16, 2026 at 09:25:25AM +0300, Svyatoslav Ryhel wrote:
> вт, 16 черв. 2026 р. о 07:26 Dmitry Torokhov <dmitry.torokhov@gmail.com> пише:
> >
> > Hi Svyatoslav,
> >
> > On Thu, May 28, 2026 at 08:32:00AM +0300, Svyatoslav Ryhel wrote:
> > > From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> > >
> > > Add support for multimedia top button row of ASUS Transformer's Mobile
> > > Dock keyboard. Driver is made that function keys (F1-F12) are used by
> > > default which suits average Linux use better and with pressing
> > > ScreenLock + AltGr function keys layout is switched to multimedia keys.
> > > Since this only modifies codes sent by asus-ec-keys it doesn't affect
> > > normal keyboards at all.
> >
> > I think using input handler to intercept ScreenLock + AltGr is quite
> > awkward. I think this also passes the original key events (unless you
> > make it a filter not a regular handler).
> >
> > I do not see benefit for reacting to AltGr+ScreenLock on other keyboards
> > to activate the special mode on this one. So given the fact that you
> > already mange the data stream when you split it into "serio" ports,
> > maybe just intercept this key combo right there and create the input
> > device and signal input events right there?
> >
>
> Though it seems awkward at a first glance, media keys are integrated
> with a standard keyboard in a detachable dock. It is highly unlikely
> that media keys will be used with a different keyboard then the one
> that is integrated with dock. Additionally, the ScreenLock key has a
> code specific to this driver and is not in general use, so even if any
> standard keyboard has AltGr but none has ScreenLock specific to this
> driver except the dock itself. Handler is also set as observer so it
> should not interfere with work of other input devices.
I am not concerned about it interfering with other drivers, I am
concerned about it unnecessarily connecting to unrelated devices
(anything that declares EV_KEY).
Again, I think having input handler is not appropriate here. I would
fold this patch into the patch that introduces the 2 serio ports,
enhanced the data stream analysis to detect your key combo, and then
report through this new input device. You do not need to have the round
trip through atkbd and the new input handler for this.
Thanks.
--
Dmitry
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox