public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4
@ 2026-03-25  7:06 Nick Xie
  2026-03-25  7:06 ` [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Nick Xie @ 2026-03-25  7:06 UTC (permalink / raw)
  To: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel, Nick Xie

This series adds support for the SARADC IP block found in the Amlogic
Meson S4 (S905Y4) SoC and enables it for the Khadas VIM1S board to
support the onboard ADC 'Function' key.

There are no known hardware differences between the SARADC on the S4
and the previous G12A generation. The S4 bindings utilize a fallback
to G12A, but a dedicated driver match entry is included to ensure the
correct part name is exposed to the userspace ABI.

Changes in v3:
- Patch 1: Updated the commit message to explicitly explain why the
  comment regarding the generic fallback was added.
- Patch 2: Retained the driver patch and updated the commit message to
  clarify that the dedicated match entry is kept specifically for
  userspace ABI naming purposes.
- Link to v2: https://lore.kernel.org/all/20260323013408.429701-1-nick@khadas.com/

Changes in v2:
- Addressed feedback from Krzysztof Kozlowski:
  - Updated dt-bindings commit message to explain the hardware compatibility.
  - Separated the S4 compatible string in the YAML bindings to ensure it
    correctly falls back to the specific "amlogic,meson-g12a-saradc" rather
    than the generic "amlogic,meson-saradc".
  - Updated the S4 SoC dtsi to use the correct G12A fallback.
- Added Martin's Reviewed-by tags where appropriate.
- Link to v1: https://lore.kernel.org/all/20260228065840.702651-1-nick@khadas.com/


Nick Xie (4):
  dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
  iio: adc: meson-saradc: add support for Meson S4
  arm64: dts: amlogic: meson-s4: add internal SARADC controller
  arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key
    support

 .../iio/adc/amlogic,meson-saradc.yaml         |  4 ++++
 .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 19 +++++++++++++++++++
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi     | 14 ++++++++++++++
 drivers/iio/adc/meson_saradc.c                |  8 ++++++++
 4 files changed, 45 insertions(+)

-- 
2.34.1


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

* [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
@ 2026-03-25  7:06 ` Nick Xie
  2026-03-26  8:19   ` Krzysztof Kozlowski
  2026-03-25  7:06 ` [PATCH v3 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Nick Xie @ 2026-03-25  7:06 UTC (permalink / raw)
  To: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel, Nick Xie

Add the compatible string for the SARADC (Successive Approximation
Register ADC) IP block found in the Amlogic Meson S4 SoC.

There are no known differences between the SARADC on S4 and the one
on G12A. Therefore, it uses "amlogic,meson-g12a-saradc" as a proper
specific fallback.

Also add a comment indicating that "amlogic,meson-saradc" must not be
used for new devices. It's a made up compatible string that does not
correspond to a specific hardware generation and is not used to match
any driver. For old devices we keep it as it's part of the ABI.

Signed-off-by: Nick Xie <nick@khadas.com>
---
 .../devicetree/bindings/iio/adc/amlogic,meson-saradc.yaml     | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.yaml
index bb9825e7346dd..70ab4e140e71b 100644
--- a/Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/amlogic,meson-saradc.yaml
@@ -27,7 +27,11 @@ properties:
               - amlogic,meson-gxm-saradc
               - amlogic,meson-axg-saradc
               - amlogic,meson-g12a-saradc
+          # Usage of this generic fallback is not allowed for new devices
           - const: amlogic,meson-saradc
+      - items:
+          - const: amlogic,meson-s4-saradc
+          - const: amlogic,meson-g12a-saradc
 
   reg:
     maxItems: 1
-- 
2.34.1


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

* [PATCH v3 2/4] iio: adc: meson-saradc: add support for Meson S4
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
  2026-03-25  7:06 ` [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
@ 2026-03-25  7:06 ` Nick Xie
  2026-03-25  7:06 ` [PATCH v3 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Nick Xie @ 2026-03-25  7:06 UTC (permalink / raw)
  To: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel, Nick Xie

Add support for the SARADC found on the Amlogic Meson S4 SoC.
According to the documentation and current testing, it is fully
compatible with the G12A parameter set, so we reuse
`meson_sar_adc_g12a_data` for this new compatible string.

Although the device tree fallback mechanism could handle the match,
a dedicated entry is added to ensure the userspace ABI correctly
reports the specific part name ("meson-s4-saradc"). This allows
userspace to accurately identify the exact device and maintains
consistency across different firmware types where automatic fallback
parsing might be problematic.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Nick Xie <nick@khadas.com>
---
 drivers/iio/adc/meson_saradc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 47cd350498a0d..3ac48b7842c4f 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1313,6 +1313,11 @@ static const struct meson_sar_adc_data meson_sar_adc_g12a_data = {
 	.name = "meson-g12a-saradc",
 };
 
+static const struct meson_sar_adc_data meson_sar_adc_s4_data = {
+	.param = &meson_sar_adc_g12a_param,
+	.name = "meson-s4-saradc",
+};
+
 static const struct of_device_id meson_sar_adc_of_match[] = {
 	{
 		.compatible = "amlogic,meson8-saradc",
@@ -1341,6 +1346,9 @@ static const struct of_device_id meson_sar_adc_of_match[] = {
 	}, {
 		.compatible = "amlogic,meson-g12a-saradc",
 		.data = &meson_sar_adc_g12a_data,
+	}, {
+		.compatible = "amlogic,meson-s4-saradc",
+		.data = &meson_sar_adc_s4_data,
 	},
 	{ }
 };
-- 
2.34.1


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

* [PATCH v3 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
  2026-03-25  7:06 ` [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
  2026-03-25  7:06 ` [PATCH v3 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
@ 2026-03-25  7:06 ` Nick Xie
  2026-03-25  7:06 ` [PATCH v3 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Nick Xie @ 2026-03-25  7:06 UTC (permalink / raw)
  To: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel, Nick Xie

Add the SARADC (Successive Approximation Register ADC) controller
node to the Meson S4 SoC dtsi.

It uses the S4-specific compatible string with a fallback to the
G12A generation, as there are no known hardware differences.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Nick Xie <nick@khadas.com>
---
 arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
index 4a3e9ad82d280..936a5c1353d15 100644
--- a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
@@ -77,6 +77,20 @@ pwrc: power-controller {
 		};
 	};
 
+	saradc: adc@fe026000 {
+		compatible = "amlogic,meson-s4-saradc",
+			     "amlogic,meson-g12a-saradc";
+		reg = <0x0 0xfe026000 0x0 0x48>;
+		#io-channel-cells = <1>;
+		interrupts = <GIC_SPI 181 IRQ_TYPE_EDGE_RISING>;
+		clocks = <&xtal>,
+			 <&clkc_periphs CLKID_SAR_ADC>,
+			 <&clkc_periphs CLKID_SARADC>,
+			 <&clkc_periphs CLKID_SARADC_SEL>;
+		clock-names = "clkin", "core", "adc_clk", "adc_sel";
+		status = "disabled";
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <2>;
-- 
2.34.1


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

* [PATCH v3 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
                   ` (2 preceding siblings ...)
  2026-03-25  7:06 ` [PATCH v3 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
@ 2026-03-25  7:06 ` Nick Xie
  2026-03-26 19:57 ` [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Jonathan Cameron
  2026-03-27  8:31 ` (subset) " Neil Armstrong
  5 siblings, 0 replies; 8+ messages in thread
From: Nick Xie @ 2026-03-25  7:06 UTC (permalink / raw)
  To: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel, Nick Xie

Enable the SARADC controller and add the adc-keys node to support
the Function key found on the Khadas VIM1S board.

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Nick Xie <nick@khadas.com>
---
 .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts b/arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts
index 664d64a267f2d..792ab45c4c944 100644
--- a/arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-s4-s905y4-khadas-vim1s.dts
@@ -40,6 +40,20 @@ secmon_reserved: secmon@5000000 {
 		};
 	};
 
+	adc-keys {
+		compatible = "adc-keys";
+		io-channels = <&saradc 0>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <1710000>;
+		poll-interval = <100>;
+
+		button-function {
+			label = "Function";
+			linux,code = <KEY_FN>;
+			press-threshold-microvolt = <10000>;
+		};
+	};
+
 	emmc_pwrseq: emmc-pwrseq {
 		compatible = "mmc-pwrseq-emmc";
 		reset-gpios = <&gpio GPIOB_9 GPIO_ACTIVE_LOW>;
@@ -278,6 +292,11 @@ brcmf: wifi@1 {
 	};
 };
 
+&saradc {
+	status = "okay";
+	vref-supply = <&vddio_ao1v8>;
+};
+
 &spicc0 {
 	status = "okay";
 	pinctrl-names = "default";
-- 
2.34.1


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

* Re: [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
  2026-03-25  7:06 ` [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
@ 2026-03-26  8:19   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-26  8:19 UTC (permalink / raw)
  To: Nick Xie
  Cc: neil.armstrong, khilman, martin.blumenstingl, jbrunet, jic23,
	dlechner, andy, krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel

On Wed, Mar 25, 2026 at 03:06:15PM +0800, Nick Xie wrote:
> Add the compatible string for the SARADC (Successive Approximation
> Register ADC) IP block found in the Amlogic Meson S4 SoC.
> 
> There are no known differences between the SARADC on S4 and the one
> on G12A. Therefore, it uses "amlogic,meson-g12a-saradc" as a proper
> specific fallback.
> 
> Also add a comment indicating that "amlogic,meson-saradc" must not be
> used for new devices. It's a made up compatible string that does not
> correspond to a specific hardware generation and is not used to match
> any driver. For old devices we keep it as it's part of the ABI.
> 
> Signed-off-by: Nick Xie <nick@khadas.com>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


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

* Re: [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
                   ` (3 preceding siblings ...)
  2026-03-25  7:06 ` [PATCH v3 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
@ 2026-03-26 19:57 ` Jonathan Cameron
  2026-03-27  8:31 ` (subset) " Neil Armstrong
  5 siblings, 0 replies; 8+ messages in thread
From: Jonathan Cameron @ 2026-03-26 19:57 UTC (permalink / raw)
  To: Nick Xie
  Cc: neil.armstrong, khilman, martin.blumenstingl, jbrunet, dlechner,
	andy, krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel

On Wed, 25 Mar 2026 15:06:14 +0800
Nick Xie <nick@khadas.com> wrote:

> This series adds support for the SARADC IP block found in the Amlogic
> Meson S4 (S905Y4) SoC and enables it for the Khadas VIM1S board to
> support the onboard ADC 'Function' key.
> 
> There are no known hardware differences between the SARADC on the S4
> and the previous G12A generation. The S4 bindings utilize a fallback
> to G12A, but a dedicated driver match entry is included to ensure the
> correct part name is exposed to the userspace ABI.
> 
Applied patches 1 and 2 to the togreg branch of iio.git.

> Changes in v3:
> - Patch 1: Updated the commit message to explicitly explain why the
>   comment regarding the generic fallback was added.
> - Patch 2: Retained the driver patch and updated the commit message to
>   clarify that the dedicated match entry is kept specifically for
>   userspace ABI naming purposes.
> - Link to v2: https://lore.kernel.org/all/20260323013408.429701-1-nick@khadas.com/
> 
> Changes in v2:
> - Addressed feedback from Krzysztof Kozlowski:
>   - Updated dt-bindings commit message to explain the hardware compatibility.
>   - Separated the S4 compatible string in the YAML bindings to ensure it
>     correctly falls back to the specific "amlogic,meson-g12a-saradc" rather
>     than the generic "amlogic,meson-saradc".
>   - Updated the S4 SoC dtsi to use the correct G12A fallback.
> - Added Martin's Reviewed-by tags where appropriate.
> - Link to v1: https://lore.kernel.org/all/20260228065840.702651-1-nick@khadas.com/
> 
> 
> Nick Xie (4):
>   dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
>   iio: adc: meson-saradc: add support for Meson S4
>   arm64: dts: amlogic: meson-s4: add internal SARADC controller
>   arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key
>     support
> 
>  .../iio/adc/amlogic,meson-saradc.yaml         |  4 ++++
>  .../amlogic/meson-s4-s905y4-khadas-vim1s.dts  | 19 +++++++++++++++++++
>  arch/arm64/boot/dts/amlogic/meson-s4.dtsi     | 14 ++++++++++++++
>  drivers/iio/adc/meson_saradc.c                |  8 ++++++++
>  4 files changed, 45 insertions(+)
> 


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

* Re: (subset) [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4
  2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
                   ` (4 preceding siblings ...)
  2026-03-26 19:57 ` [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Jonathan Cameron
@ 2026-03-27  8:31 ` Neil Armstrong
  5 siblings, 0 replies; 8+ messages in thread
From: Neil Armstrong @ 2026-03-27  8:31 UTC (permalink / raw)
  To: khilman, martin.blumenstingl, jbrunet, jic23, dlechner, andy,
	Nick Xie
  Cc: krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
	linux-arm-kernel, devicetree, linux-kernel

Hi,

On Wed, 25 Mar 2026 15:06:14 +0800, Nick Xie wrote:
> This series adds support for the SARADC IP block found in the Amlogic
> Meson S4 (S905Y4) SoC and enables it for the Khadas VIM1S board to
> support the onboard ADC 'Function' key.
> 
> There are no known hardware differences between the SARADC on the S4
> and the previous G12A generation. The S4 bindings utilize a fallback
> to G12A, but a dedicated driver match entry is included to ensure the
> correct part name is exposed to the userspace ABI.
> 
> [...]

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v7.1/arm64-dt)

[3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller
      https://git.kernel.org/amlogic/c/3b095e9b3674da0666aea3021167ca44097ed7fa
[4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support
      https://git.kernel.org/amlogic/c/97c4d4b7de6ef264fbd45300a168c2a0874d6c75

These changes has been applied on the intermediate git tree [1].

The v7.1/arm64-dt branch will then be sent via a formal Pull Request to the Linux SoC maintainers
for inclusion in their intermediate git branches in order to be sent to Linus during
the next merge window, or sooner if it's a set of fixes.

In the cases of fixes, those will be merged in the current release candidate
kernel and as soon they appear on the Linux master branch they will be
backported to the previous Stable and Long-Stable kernels [2].

The intermediate git branches are merged daily in the linux-next tree [3],
people are encouraged testing these pre-release kernels and report issues on the
relevant mailing-lists.

If problems are discovered on those changes, please submit a signed-off-by revert
patch followed by a corrective changeset.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

-- 
Neil


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

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

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  7:06 [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-25  7:06 ` [PATCH v3 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
2026-03-26  8:19   ` Krzysztof Kozlowski
2026-03-25  7:06 ` [PATCH v3 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-25  7:06 ` [PATCH v3 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
2026-03-25  7:06 ` [PATCH v3 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
2026-03-26 19:57 ` [PATCH v3 0/4] iio: adc: meson-saradc: add support for Meson S4 Jonathan Cameron
2026-03-27  8:31 ` (subset) " Neil Armstrong

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