Fix RV1106 SAR-ADC support
Subsystems (3)
v2 cover Fix RV1106 SAR-ADC support
This series fixes the support for the RV1106 SAR-ADC in the rockchip_saradc driver and its device tree bindings.
Changes in v2:
- Combined the driver patch and the dt-binding fix into a series, as requested by Jonathan.
- Introduced a new patch (2/3) to group single-entries into an enum list, as suggested by Krzysztof.
- Added missing Suggested-by tag to the patch 3/3
- rockchip,rv1106-saradc compatible moved from the single-entry to enum list in the patch 3/3
Vladislav Leonov (3):
iio: adc: rockchip_saradc: Add support for RV1106
dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an
enum list
dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible
.../bindings/iio/adc/rockchip-saradc.yaml | 18 +++++++++--------- drivers/iio/adc/rockchip_saradc.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-)
Signature · 7 lines
2.47.3 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 1/3 iio: adc: rockchip_saradc: Add support for RV1106
The Successive Approximation ADC (SARADC) in RV1106 uses the v2 controller and supports:
- 10-bit resolution
- Up to 1MS/s sampling rate
- 2 single-ended input channels
"dt-bindings: iio: adc: rockchip-saradc: Add RV1106 compatible" documents "rockchip,rv1106-saradc" as falling back to "rockchip,rk3588-saradc" (see Link below). The two IP blocks are not equivalent, though: per the RV1106 TRM v0.3, chapter 20 (SAR-ADC), RV1106 only has 2 channels at 10-bit resolution, versus 8 channels at 12-bit on RK3588. Without a dedicated match entry, the driver binds via the fallback compatible and uses the RK3588 channel table, which reports 8 channels instead of 2, and an in_voltage_scale that is off by exactly 4x (4096 vs 1024 full-scale).
Add a dedicated compatible/data pair for RV1106 with the correct 2-channel, 10-bit layout.
Tested on a custom RV1106-based board, with:
&saradc {
vref-supply = <&vcc_saradc>; /* 1.8V fixed regulator */
status = "okay";};
Before this patch:
# ls /sys/bus/iio/devices/iio:device0/in_voltage*_raw | wc -l 8 # cat /sys/bus/iio/devices/iio:device0/in_voltage_scale 0.439453125
After this patch:
# ls /sys/bus/iio/devices/iio:device0/in_voltage*_raw | wc -l 2 # cat /sys/bus/iio/devices/iio:device0/in_voltage_scale 1.757812500
---
No changes in v2.
v1 https://lore.kernel.org/all/[email protected]
drivers/iio/adc/rockchip_saradc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/iio/adc/rockchip_saradc.c +16 -0
@@ -348,6 +348,19 @@ static const struct rockchip_saradc_data rk3588_saradc_data = { .read = rockchip_saradc_read_v2, }; +static const struct iio_chan_spec rockchip_rv1106_saradc_iio_channels[] = { +SARADC_CHANNEL (0 ,"adc0" ,10 ), +SARADC_CHANNEL (1 ,"adc1" ,10 ), +}; + +static const struct rockchip_saradc_data rv1106_saradc_data = { + .channels = rockchip_rv1106_saradc_iio_channels, + .num_channels =ARRAY_SIZE (rockchip_rv1106_saradc_iio_channels), + .clk_rate =1000000 , + .start = rockchip_saradc_start_v2, + .read = rockchip_saradc_read_v2, +}; +static const struct of_device_id rockchip_saradc_match[] = { { .compatible ="rockchip,saradc" ,
@@ -370,6 +383,9 @@ static const struct of_device_id rockchip_saradc_match[] = { }, { .compatible = "rockchip,rk3588-saradc", .data = &rk3588_saradc_data, + }, { + .compatible = "rockchip,rv1106-saradc", + .data = &rv1106_saradc_data, }, { } };
Signature · 7 lines
2.47.3 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 2/3 dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list
In reply to Vladislav LeonovGroup single-entries into an enum list
---
Changes in v2:
- Patch introduced in v2.
.../bindings/iio/adc/rockchip-saradc.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml +7 -6
@@ -12,15 +12,16 @@ maintainers: properties: compatible: oneOf: - - const: rockchip,saradc - - const: rockchip,rk3066-tsadc - - const: rockchip,rk3399-saradc - - const: rockchip,rk3528-saradc + - enum: + - rockchip,saradc + - rockchip,rk3066-tsadc + - rockchip,rk3399-saradc + - rockchip,rk3528-saradc + - rockchip,rk3562-saradc + - rockchip,rk3588-saradc - items: - const: rockchip,rk3506-saradc - const: rockchip,rk3528-saradc - - const: rockchip,rk3562-saradc - - const: rockchip,rk3588-saradc - items: - enum: - rockchip,rk3576-saradc
Signature · 1 line
2.47.3
Re: [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list
pw-bot: not-applicable
PATCH v2 3/3 dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible
In reply to Vladislav Leonovrockchip,rv1106-saradc was folded into the fallback enum together with rockchip,rk3576-saradc, falling back to rockchip,rk3588-saradc. The two IP blocks are not equivalent, though: per the RV1106 TRM v0.3, chapter 20 (SAR-ADC), RV1106 only has 2 channels at 10-bit resolution, versus 8 channels at 12-bit on RK3588. Documenting it as falling back to rk3588-saradc allows device trees that would bind against the wrong channel table and report an incorrect voltage scale.
Remove rockchip,rv1106-saradc from the RK3588 fallback enum and give it its own standalone compatible entry, matching the dedicated match table entry added by the driver patch.
---
Changes in v2:
- Added missing Suggested-by tag.
- rockchip,rv1106-saradc compatible moved from the single-entry to enum list.
v1 https://lore.kernel.org/all/[email protected]
.../devicetree/bindings/iio/adc/rockchip-saradc.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml +2 -3
@@ -19,13 +19,12 @@ properties: - rockchip,rk3528-saradc - rockchip,rk3562-saradc - rockchip,rk3588-saradc + - rockchip,rv1106-saradc - items: - const: rockchip,rk3506-saradc - const: rockchip,rk3528-saradc - items: - - enum: - - rockchip,rk3576-saradc - - rockchip,rv1106-saradc + - const: rockchip,rk3576-saradc - const: rockchip,rk3588-saradc - items: - enum:
Signature · 1 line
2.47.3
Re: [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible
pw-bot: not-applicable
Jonathan Cameron
maintainerQuoted 2 lines · On Sun, 23 Aug 2026 15:20:31 +0300 Vladislav Leonov <[email protected]> wrote:
This series fixes the support for the RV1106 SAR-ADC in the
rockchip_saradcdriver and its device tree bindings.
I debated how to apply this. Technically patch 3 is a fix, 2 is an enabler and 1 is also a fix, but one for something that we just effectively patched out from running in patch 3.
So in the end I'm thinking take this the slow path for next cycle. Shout if anyone thinks this should go in during the -RCs and whether all 3 should do so or just patches 2 and 3 (leaving us without driver support for now).
Applied to the testing branch of iio.git
Thanks,
Jonathan
Quoted 20 lines
Changes in v2:
- Combined the driver patch and the dt-binding fix into a series, as requested by Jonathan.
- Introduced a new patch (2/3) to group single-entries into an enum list, as suggested by Krzysztof.
- Added missing Suggested-by tag to the patch 3/3
- rockchip,rv1106-saradc compatible moved from the single-entry to enum list in the patch 3/3Vladislav Leonov (3):
iio: adc:rockchip_saradc: Add support for RV1106
dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an
enum list
dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible.../bindings/iio/adc/rockchip-saradc.yaml | 18 +++++++++--------- drivers/iio/adc/rockchip_saradc.c | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-)
Heiko Stübner
maintainerHi Jonathan,
Am Montag, 31. August 2026, 03:55:57 Mitteleuropäische Sommerzeit schrieb Jonathan Cameron:
Quoted 10 lines
Quoted 2 lines · On Sun, 23 Aug 2026 15:20:31 +0300 Vladislav Leonov <[email protected]> wrote:
This series fixes the support for the RV1106 SAR-ADC in the
rockchip_saradcdriver and its device tree bindings.I debated how to apply this. Technically patch 3 is a fix, 2 is an enabler and 1 is also a fix, but one for something that we just effectively patched out from running in patch 3.
Quoted 6 lines
So in the end I'm thinking take this the slow path for next cycle. Shout if anyone thinks this should go in during the -RCs and whether all 3 should do so or just patches 2 and 3 (leaving us without driver support for now).
Applied to the testing branch of iio.git
I guess I should shout then ;-) .
DT-Binding patches are sort of independent of the driver change and are considered API which should not change after the fact.
Our DTs (but also ones possibly contained in firmware somewhere) are validated against the binding and it seems the correct compartible goes from
"rockchip,rv1106-saradc", " rockchip,rk3588-saradc"
to
"rockchip,rv1106-saradc"As the fixed commit is part of 7.3-rc1, I guess it would be nice to have patches 2+3 in 7.3 and patch 1 can wait for 7.4 .
We don't need the driver support (dt-nodes just doesn't bind to anything), but it would be nice to not proliferate the wrong binding in an actual release.
my 2ct :-)
Heiko
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Jonathan Cameron
maintainerQuoted 32 lines · On Mon, 31 Aug 2026 10:17:17 +0200 Heiko Stübner <[email protected]> wrote:
Hi Jonathan,
Am Montag, 31. August 2026, 03:55:57 Mitteleuropäische Sommerzeit schrieb Jonathan Cameron:
Quoted 10 lines
Quoted 2 lines · On Sun, 23 Aug 2026 15:20:31 +0300 Vladislav Leonov <[email protected]> wrote:
This series fixes the support for the RV1106 SAR-ADC in the
rockchip_saradcdriver and its device tree bindings.I debated how to apply this. Technically patch 3 is a fix, 2 is an enabler and 1 is also a fix, but one for something that we just effectively patched out from running in patch 3.
Quoted 6 lines
So in the end I'm thinking take this the slow path for next cycle. Shout if anyone thinks this should go in during the -RCs and whether all 3 should do so or just patches 2 and 3 (leaving us without driver support for now).
Applied to the testing branch of iio.git
I guess I should shout then ;-) .
DT-Binding patches are sort of independent of the driver change and are considered API which should not change after the fact.
Our DTs (but also ones possibly contained in firmware somewhere) are validated against the binding and it seems the correct compartible goes from
"rockchip,rv1106-saradc", " rockchip,rk3588-saradc" to "rockchip,rv1106-saradc"
Quoted 6 lines
As the fixed commit is part of 7.3-rc1, I guess it would be nice to have patches 2+3 in 7.3 and patch 1 can wait for 7.4 .
We don't need the driver support (dt-nodes just doesn't bind to anything), but it would be nice to not proliferate the wrong binding in an actual release.
Ah. I should have checked when the original bug went in. As it's this current cycle, what you say is indeed an easy fix.
Applied 2-3 to the fixes-togreg branch and left 1 in the testing branch for 7.4.
Thanks
Jonathan
Quoted 7 lines
my 2ct :-)
Heiko