* [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4
@ 2026-03-23 1:34 Nick Xie
2026-03-23 1:34 ` [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Nick Xie @ 2026-03-23 1:34 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.
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] 11+ messages in thread
* [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
2026-03-23 1:34 [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
@ 2026-03-23 1:34 ` Nick Xie
2026-03-23 7:53 ` Krzysztof Kozlowski
2026-03-23 1:34 ` [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Nick Xie @ 2026-03-23 1:34 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.
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] 11+ messages in thread
* [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4
2026-03-23 1:34 [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-23 1:34 ` [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
@ 2026-03-23 1:34 ` Nick Xie
2026-03-23 7:54 ` Krzysztof Kozlowski
2026-03-23 1:34 ` [PATCH v2 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
2026-03-23 1:34 ` [PATCH v2 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
3 siblings, 1 reply; 11+ messages in thread
From: Nick Xie @ 2026-03-23 1:34 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.
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] 11+ messages in thread
* [PATCH v2 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller
2026-03-23 1:34 [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-23 1:34 ` [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
2026-03-23 1:34 ` [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
@ 2026-03-23 1:34 ` Nick Xie
2026-03-23 1:34 ` [PATCH v2 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
3 siblings, 0 replies; 11+ messages in thread
From: Nick Xie @ 2026-03-23 1:34 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] 11+ messages in thread
* [PATCH v2 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support
2026-03-23 1:34 [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
` (2 preceding siblings ...)
2026-03-23 1:34 ` [PATCH v2 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
@ 2026-03-23 1:34 ` Nick Xie
3 siblings, 0 replies; 11+ messages in thread
From: Nick Xie @ 2026-03-23 1:34 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] 11+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
2026-03-23 1:34 ` [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
@ 2026-03-23 7:53 ` Krzysztof Kozlowski
2026-03-23 21:39 ` Martin Blumenstingl
0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-23 7:53 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 Mon, Mar 23, 2026 at 09:34:05AM +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.
You should explain here why you are adding that comment.
>
> 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
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4
2026-03-23 1:34 ` [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
@ 2026-03-23 7:54 ` Krzysztof Kozlowski
2026-03-23 20:05 ` Jonathan Cameron
0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-23 7:54 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 Mon, Mar 23, 2026 at 09:34:06AM +0800, Nick Xie wrote:
> 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.
>
> 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",
The point of compatible devices is to not add such entries. Drop.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4
2026-03-23 7:54 ` Krzysztof Kozlowski
@ 2026-03-23 20:05 ` Jonathan Cameron
2026-03-24 7:07 ` Krzysztof Kozlowski
0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Cameron @ 2026-03-23 20:05 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Nick Xie, neil.armstrong, khilman, martin.blumenstingl, jbrunet,
dlechner, andy, krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
linux-arm-kernel, devicetree, linux-kernel
On Mon, 23 Mar 2026 08:54:21 +0100
Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Mon, Mar 23, 2026 at 09:34:06AM +0800, Nick Xie wrote:
> > 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.
> >
> > 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",
>
> The point of compatible devices is to not add such entries. Drop.
It's used for naming in the userspace ABI which is supposed to reflect the part number.
I don't hugely mind the names reported showing the compatible part.
Jonathan
>
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible
2026-03-23 7:53 ` Krzysztof Kozlowski
@ 2026-03-23 21:39 ` Martin Blumenstingl
0 siblings, 0 replies; 11+ messages in thread
From: Martin Blumenstingl @ 2026-03-23 21:39 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Nick Xie, neil.armstrong, khilman, jbrunet, jic23, dlechner, andy,
krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
linux-arm-kernel, devicetree, linux-kernel
On Mon, Mar 23, 2026 at 8:53 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On Mon, Mar 23, 2026 at 09:34:05AM +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.
>
> You should explain here why you are adding that comment.
What do you think about:
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4
2026-03-23 20:05 ` Jonathan Cameron
@ 2026-03-24 7:07 ` Krzysztof Kozlowski
2026-03-24 9:06 ` Jonathan Cameron
0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-24 7:07 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Nick Xie, neil.armstrong, khilman, martin.blumenstingl, jbrunet,
dlechner, andy, krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
linux-arm-kernel, devicetree, linux-kernel
On 23/03/2026 21:05, Jonathan Cameron wrote:
> On Mon, 23 Mar 2026 08:54:21 +0100
> Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
>> On Mon, Mar 23, 2026 at 09:34:06AM +0800, Nick Xie wrote:
>>> 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.
>>>
>>> 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",
>>
>> The point of compatible devices is to not add such entries. Drop.
> It's used for naming in the userspace ABI which is supposed to reflect the part number.
Indeed, I saw this pattern in more places. Does userspace need it? There
is no "compatible" entry shown?
If there is no, then probably this could be automated by taking the name
from compatible after ',', but that would be out of scope for this set,
so here it is fine.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4
2026-03-24 7:07 ` Krzysztof Kozlowski
@ 2026-03-24 9:06 ` Jonathan Cameron
0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Cameron @ 2026-03-24 9:06 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Nick Xie, neil.armstrong, khilman, martin.blumenstingl, jbrunet,
dlechner, andy, krzk+dt, robh, conor+dt, linux-iio, linux-amlogic,
linux-arm-kernel, devicetree, linux-kernel
On Tue, 24 Mar 2026 08:07:15 +0100
Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On 23/03/2026 21:05, Jonathan Cameron wrote:
> > On Mon, 23 Mar 2026 08:54:21 +0100
> > Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> >> On Mon, Mar 23, 2026 at 09:34:06AM +0800, Nick Xie wrote:
> >>> 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.
> >>>
> >>> 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",
> >>
> >> The point of compatible devices is to not add such entries. Drop.
> > It's used for naming in the userspace ABI which is supposed to reflect the part number.
>
> Indeed, I saw this pattern in more places. Does userspace need it? There
> is no "compatible" entry shown?
Yes. Userspace uses this (+ a label) to identify which of multiple devices
it is talking to. Given some of these parts are very specific rather than
covering a general purpose, people tend to be looking at datasheets if there
are multiple parts and they want to know which is which. Knowing whether
it's compatible with something else doesn't help with that identification
part.
>
> If there is no, then probably this could be automated by taking the name
> from compatible after ',', but that would be out of scope for this set,
> so here it is fine.
For DT that works but not for other firmware types. We had a bunch of bugs
where people ended up putting out ACPI IDs (some of which we've had to leave
in place to avoid regressions). Hence I've always been nervous about not
encoding the string explicitly in the driver. Obviously this is a bit
paranoid for DT where it's reasonably tightly defined.
Jonathan
>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-03-24 9:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 1:34 [PATCH v2 0/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-23 1:34 ` [PATCH v2 1/4] dt-bindings: iio: adc: amlogic,meson-saradc: add S4 compatible Nick Xie
2026-03-23 7:53 ` Krzysztof Kozlowski
2026-03-23 21:39 ` Martin Blumenstingl
2026-03-23 1:34 ` [PATCH v2 2/4] iio: adc: meson-saradc: add support for Meson S4 Nick Xie
2026-03-23 7:54 ` Krzysztof Kozlowski
2026-03-23 20:05 ` Jonathan Cameron
2026-03-24 7:07 ` Krzysztof Kozlowski
2026-03-24 9:06 ` Jonathan Cameron
2026-03-23 1:34 ` [PATCH v2 3/4] arm64: dts: amlogic: meson-s4: add internal SARADC controller Nick Xie
2026-03-23 1:34 ` [PATCH v2 4/4] arm64: dts: amlogic: meson-s4-s905y4-khadas-vim1s: add Function key support Nick Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox