Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Fix RV1106 SAR-ADC support
@ 2026-08-23 12:20 Vladislav Leonov
  2026-08-23 12:20 ` [PATCH v2 1/3] iio: adc: rockchip_saradc: Add support for RV1106 Vladislav Leonov
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Vladislav Leonov @ 2026-08-23 12:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Vladislav Leonov, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joshua Crofts, Simon Glass, linux-iio, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel

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(-)

-- 
2.47.3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] iio: adc: rockchip_saradc: Add support for RV1106
  2026-08-23 12:20 [PATCH v2 0/3] Fix RV1106 SAR-ADC support Vladislav Leonov
@ 2026-08-23 12:20 ` Vladislav Leonov
  2026-08-23 12:20 ` [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list Vladislav Leonov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Vladislav Leonov @ 2026-08-23 12:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Vladislav Leonov, David Lechner, Nuno Sá, Andy Shevchenko,
	Heiko Stuebner, Simon Glass, linux-iio, linux-arm-kernel,
	linux-rockchip, linux-kernel

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

Link: https://lore.kernel.org/all/20260714131631.v2.1.0b846080833e4b836793c43fc26d1c6d817cf9b4@changeid/
Signed-off-by: Vladislav Leonov <vlad@zlab.su>
---

No changes in v2.

v1 https://lore.kernel.org/all/20260810090826.146758-1-vlad@zlab.su

 drivers/iio/adc/rockchip_saradc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 0f0bf2906af0..5c45fae11890 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -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,
 	},
 	{ }
 };
-- 
2.47.3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list
  2026-08-23 12:20 [PATCH v2 0/3] Fix RV1106 SAR-ADC support Vladislav Leonov
  2026-08-23 12:20 ` [PATCH v2 1/3] iio: adc: rockchip_saradc: Add support for RV1106 Vladislav Leonov
@ 2026-08-23 12:20 ` Vladislav Leonov
  2026-08-24 16:38   ` Conor Dooley
  2026-08-23 12:20 ` [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible Vladislav Leonov
  2026-08-31  1:55 ` [PATCH v2 0/3] Fix RV1106 SAR-ADC support Jonathan Cameron
  3 siblings, 1 reply; 8+ messages in thread
From: Vladislav Leonov @ 2026-08-23 12:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Vladislav Leonov, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joshua Crofts, Simon Glass, linux-iio, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel,
	Krzysztof Kozlowski

Group single-entries into an enum list

Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Vladislav Leonov <vlad@zlab.su>
---

Changes in v2:
- Patch introduced in v2.

 .../bindings/iio/adc/rockchip-saradc.yaml           | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
index f0551d665916..78ec9a33da24 100644
--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
@@ -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
-- 
2.47.3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible
  2026-08-23 12:20 [PATCH v2 0/3] Fix RV1106 SAR-ADC support Vladislav Leonov
  2026-08-23 12:20 ` [PATCH v2 1/3] iio: adc: rockchip_saradc: Add support for RV1106 Vladislav Leonov
  2026-08-23 12:20 ` [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list Vladislav Leonov
@ 2026-08-23 12:20 ` Vladislav Leonov
  2026-08-24 16:38   ` Conor Dooley
  2026-08-31  1:55 ` [PATCH v2 0/3] Fix RV1106 SAR-ADC support Jonathan Cameron
  3 siblings, 1 reply; 8+ messages in thread
From: Vladislav Leonov @ 2026-08-23 12:20 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Vladislav Leonov, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joshua Crofts, Simon Glass, linux-iio, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel

rockchip,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.

Fixes: bdba14f6122c ("dt-bindings: iio: adc: rockchip-saradc: Add RV1106 compatible")
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Vladislav Leonov <vlad@zlab.su>
---

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/20260816113636.33635-1-vlad@zlab.su

 .../devicetree/bindings/iio/adc/rockchip-saradc.yaml         | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
index 78ec9a33da24..0cce357cb01d 100644
--- a/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
@@ -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:
-- 
2.47.3


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible
  2026-08-23 12:20 ` [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible Vladislav Leonov
@ 2026-08-24 16:38   ` Conor Dooley
  0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-08-24 16:38 UTC (permalink / raw)
  To: Vladislav Leonov
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joshua Crofts, Simon Glass, linux-iio, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list
  2026-08-23 12:20 ` [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list Vladislav Leonov
@ 2026-08-24 16:38   ` Conor Dooley
  0 siblings, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2026-08-24 16:38 UTC (permalink / raw)
  To: Vladislav Leonov
  Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner,
	Joshua Crofts, Simon Glass, linux-iio, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel,
	Krzysztof Kozlowski


[-- Attachment #1.1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] Fix RV1106 SAR-ADC support
  2026-08-23 12:20 [PATCH v2 0/3] Fix RV1106 SAR-ADC support Vladislav Leonov
                   ` (2 preceding siblings ...)
  2026-08-23 12:20 ` [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible Vladislav Leonov
@ 2026-08-31  1:55 ` Jonathan Cameron
  2026-08-31  8:17   ` Heiko Stübner
  3 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2026-08-31  1:55 UTC (permalink / raw)
  To: Vladislav Leonov
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, Joshua Crofts,
	Simon Glass, linux-iio, devicetree, linux-arm-kernel,
	linux-rockchip, linux-kernel

On Sun, 23 Aug 2026 15:20:31 +0300
Vladislav Leonov <vlad@zlab.su> wrote:

> This series fixes the support for the RV1106 SAR-ADC in the
> rockchip_saradc driver 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

> 
> 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(-)
> 


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/3] Fix RV1106 SAR-ADC support
  2026-08-31  1:55 ` [PATCH v2 0/3] Fix RV1106 SAR-ADC support Jonathan Cameron
@ 2026-08-31  8:17   ` Heiko Stübner
  0 siblings, 0 replies; 8+ messages in thread
From: Heiko Stübner @ 2026-08-31  8:17 UTC (permalink / raw)
  To: Vladislav Leonov, Jonathan Cameron
  Cc: David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Joshua Crofts, Simon Glass,
	linux-iio, devicetree, linux-arm-kernel, linux-rockchip,
	linux-kernel

Hi Jonathan,

Am Montag, 31. August 2026, 03:55:57 Mitteleuropäische Sommerzeit schrieb Jonathan Cameron:
> On Sun, 23 Aug 2026 15:20:31 +0300
> Vladislav Leonov <vlad@zlab.su> wrote:
> 
> > This series fixes the support for the RV1106 SAR-ADC in the
> > rockchip_saradc driver 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

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
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-31  8:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 12:20 [PATCH v2 0/3] Fix RV1106 SAR-ADC support Vladislav Leonov
2026-08-23 12:20 ` [PATCH v2 1/3] iio: adc: rockchip_saradc: Add support for RV1106 Vladislav Leonov
2026-08-23 12:20 ` [PATCH v2 2/3] dt-bindings: iio: adc: rockchip-saradc: Group single-entries into an enum list Vladislav Leonov
2026-08-24 16:38   ` Conor Dooley
2026-08-23 12:20 ` [PATCH v2 3/3] dt-bindings: iio: adc: rockchip-saradc: Fix RV1106 compatible Vladislav Leonov
2026-08-24 16:38   ` Conor Dooley
2026-08-31  1:55 ` [PATCH v2 0/3] Fix RV1106 SAR-ADC support Jonathan Cameron
2026-08-31  8:17   ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox