* [RFC v2 02/11] of: property: add device link support for io-backends
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
2023-07-27 15:03 ` [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support Olivier Moysan
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Rob Herring, Frank Rowand; +Cc: Olivier Moysan, devicetree, linux-kernel
Add support for creating device links out of more DT properties.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
drivers/of/property.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/of/property.c b/drivers/of/property.c
index ddc75cd50825..864e29e4707c 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1244,6 +1244,7 @@ DEFINE_SIMPLE_PROP(interconnects, "interconnects", "#interconnect-cells")
DEFINE_SIMPLE_PROP(iommus, "iommus", "#iommu-cells")
DEFINE_SIMPLE_PROP(mboxes, "mboxes", "#mbox-cells")
DEFINE_SIMPLE_PROP(io_channels, "io-channel", "#io-channel-cells")
+DEFINE_SIMPLE_PROP(io_backends, "io-backend", "#io-backend-cells")
DEFINE_SIMPLE_PROP(interrupt_parent, "interrupt-parent", NULL)
DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells")
DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells")
@@ -1332,6 +1333,7 @@ static const struct supplier_bindings of_supplier_bindings[] = {
{ .parse_prop = parse_iommu_maps, .optional = true, },
{ .parse_prop = parse_mboxes, },
{ .parse_prop = parse_io_channels, },
+ { .parse_prop = parse_io_backends, },
{ .parse_prop = parse_interrupt_parent, },
{ .parse_prop = parse_dmas, .optional = true, },
{ .parse_prop = parse_power_domains, },
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
2023-07-27 15:03 ` [RFC v2 02/11] of: property: add device link support for io-backends Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
2023-08-11 17:10 ` Rob Herring
2023-07-27 15:03 ` [RFC v2 04/11] dt-bindings: iio: adc: add scaling support to sd modulator Olivier Moysan
` (3 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Olivier Moysan, Arnaud Pouliquen, Jonathan Cameron,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Maxime Coquelin, Alexandre Torgue, Fabrice Gasnier
Cc: alsa-devel, linux-iio, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
Add scaling support to STM32 DFSDM.
This introduces the following changes:
- Add ADC generic channel binding and remove support of deprecated
channel bindings.
- DFSDM is now implemented as a channel provider, so remove io-channels
properties.
- Add iio-backend property to connect DFSDM to an SD modulator.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
.../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 189 ++++++------------
1 file changed, 63 insertions(+), 126 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
index 1970503389aa..128545cedc7f 100644
--- a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
@@ -85,22 +85,14 @@ patternProperties:
description: Specifies the DFSDM filter instance used.
maxItems: 1
- interrupts:
- maxItems: 1
+ '#address-cells':
+ const: 1
- st,adc-channels:
- description: |
- List of single-ended channels muxed for this ADC.
- On stm32h7 and stm32mp1:
- - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
- - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
- $ref: /schemas/types.yaml#/definitions/uint32-array
- items:
- minimum: 0
- maximum: 7
+ '#size-cells':
+ const: 0
- st,adc-channel-names:
- description: List of single-ended channel names.
+ interrupts:
+ maxItems: 1
st,filter-order:
description: |
@@ -111,39 +103,6 @@ patternProperties:
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 5
- "#io-channel-cells":
- const: 1
-
- st,adc-channel-types:
- description: |
- Single-ended channel input type.
- - "SPI_R": SPI with data on rising edge (default)
- - "SPI_F": SPI with data on falling edge
- - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
- - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
- items:
- enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
- $ref: /schemas/types.yaml#/definitions/non-unique-string-array
-
- st,adc-channel-clk-src:
- description: |
- Conversion clock source.
- - "CLKIN": external SPI clock (CLKIN x)
- - "CLKOUT": internal SPI clock (CLKOUT) (default)
- - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
- - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
- items:
- enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
- $ref: /schemas/types.yaml#/definitions/non-unique-string-array
-
- st,adc-alt-channel:
- description:
- Must be defined if two sigma delta modulators are
- connected on same SPI input.
- If not set, channel n is connected to SPI input n.
- If set, channel n is connected to SPI input n + 1.
- type: boolean
-
st,filter0-sync:
description:
Set to 1 to synchronize with DFSDM filter instance 0.
@@ -157,14 +116,68 @@ patternProperties:
items:
- const: rx
+ patternProperties:
+ "^channel@([0-9]|1[0-9])$":
+ type: object
+ $ref: "adc.yaml"
+ description: Represents the external channels which are connected to the DFSDM.
+
+ properties:
+ reg:
+ items:
+ minimum: 0
+ maximum: 19
+
+ label:
+ description: |
+ Unique name to identify channel.
+
+ st,adc-channel-types:
+ description: |
+ Single-ended channel input type.
+ - "SPI_R": SPI with data on rising edge (default)
+ - "SPI_F": SPI with data on falling edge
+ - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
+ - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
+ items:
+ enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+
+ st,adc-channel-clk-src:
+ description: |
+ Conversion clock source.
+ - "CLKIN": external SPI clock (CLKIN x)
+ - "CLKOUT": internal SPI clock (CLKOUT) (default)
+ - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
+ - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
+ items:
+ enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
+ $ref: /schemas/types.yaml#/definitions/non-unique-string-array
+
+ st,adc-alt-channel:
+ description:
+ Must be defined if two sigma delta modulators are
+ connected on same SPI input.
+ If not set, channel n is connected to SPI input n.
+ If set, channel n is connected to SPI input n + 1.
+ type: boolean
+
+ io-backends:
+ description: |
+ phandle to an external sigma delta modulator or internal ADC output.
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ required:
+ - reg
+ - io-backends
+
+ additionalProperties: false
+
required:
- compatible
- reg
- interrupts
- - st,adc-channels
- - st,adc-channel-names
- st,filter-order
- - "#io-channel-cells"
allOf:
- if:
@@ -175,14 +188,6 @@ patternProperties:
then:
properties:
- st,adc-channels:
- minItems: 1
- maxItems: 8
-
- st,adc-channel-names:
- minItems: 1
- maxItems: 8
-
st,adc-channel-types:
minItems: 1
maxItems: 8
@@ -191,14 +196,6 @@ patternProperties:
minItems: 1
maxItems: 8
- io-channels:
- description:
- From common IIO binding. Used to pipe external sigma delta
- modulator or internal ADC output to DFSDM channel.
-
- required:
- - io-channels
-
- if:
properties:
compatible:
@@ -207,12 +204,6 @@ patternProperties:
then:
properties:
- st,adc-channels:
- maxItems: 1
-
- st,adc-channel-names:
- maxItems: 1
-
st,adc-channel-types:
maxItems: 1
@@ -237,15 +228,9 @@ patternProperties:
"#sound-dai-cells":
const: 0
- io-channels:
- description:
- From common IIO binding. Used to pipe external sigma delta
- modulator or internal ADC output to DFSDM channel.
-
required:
- compatible
- "#sound-dai-cells"
- - io-channels
allOf:
- if:
@@ -278,52 +263,4 @@ allOf:
minimum: 0
maximum: 5
-examples:
- - |
- #include <dt-bindings/interrupt-controller/arm-gic.h>
- #include <dt-bindings/clock/stm32mp1-clks.h>
- dfsdm: dfsdm@4400d000 {
- compatible = "st,stm32mp1-dfsdm";
- reg = <0x4400d000 0x800>;
- clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
- clock-names = "dfsdm", "audio";
- #address-cells = <1>;
- #size-cells = <0>;
-
- dfsdm0: filter@0 {
- compatible = "st,stm32-dfsdm-dmic";
- reg = <0>;
- interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
- dmas = <&dmamux1 101 0x400 0x01>;
- dma-names = "rx";
- #io-channel-cells = <1>;
- st,adc-channels = <1>;
- st,adc-channel-names = "dmic0";
- st,adc-channel-types = "SPI_R";
- st,adc-channel-clk-src = "CLKOUT";
- st,filter-order = <5>;
-
- asoc_pdm0: dfsdm-dai {
- compatible = "st,stm32h7-dfsdm-dai";
- #sound-dai-cells = <0>;
- io-channels = <&dfsdm0 0>;
- };
- };
-
- dfsdm_pdm1: filter@1 {
- compatible = "st,stm32-dfsdm-adc";
- reg = <1>;
- interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
- dmas = <&dmamux1 102 0x400 0x01>;
- dma-names = "rx";
- #io-channel-cells = <1>;
- st,adc-channels = <2 3>;
- st,adc-channel-names = "in2", "in3";
- st,adc-channel-types = "SPI_R", "SPI_R";
- st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
- io-channels = <&sd_adc2 &sd_adc3>;
- st,filter-order = <1>;
- };
- };
-
...
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support
2023-07-27 15:03 ` [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support Olivier Moysan
@ 2023-08-11 17:10 ` Rob Herring
2023-08-31 15:53 ` Olivier MOYSAN
0 siblings, 1 reply; 10+ messages in thread
From: Rob Herring @ 2023-08-11 17:10 UTC (permalink / raw)
To: Olivier Moysan
Cc: Arnaud Pouliquen, Jonathan Cameron, Lars-Peter Clausen,
Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, Fabrice Gasnier, alsa-devel, linux-iio,
devicetree, linux-stm32, linux-arm-kernel, linux-kernel
On Thu, Jul 27, 2023 at 05:03:14PM +0200, Olivier Moysan wrote:
> Add scaling support to STM32 DFSDM.
>
> This introduces the following changes:
Why?
> - Add ADC generic channel binding and remove support of deprecated
> channel bindings.
When was it deprecated?
> - DFSDM is now implemented as a channel provider, so remove io-channels
> properties.
> - Add iio-backend property to connect DFSDM to an SD modulator.
io-backends
All sorts of ABI issues with this change. Please explain why you don't
care.
>
> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
> ---
> .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 189 ++++++------------
> 1 file changed, 63 insertions(+), 126 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
> index 1970503389aa..128545cedc7f 100644
> --- a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
> @@ -85,22 +85,14 @@ patternProperties:
> description: Specifies the DFSDM filter instance used.
> maxItems: 1
>
> - interrupts:
> - maxItems: 1
> + '#address-cells':
> + const: 1
>
> - st,adc-channels:
> - description: |
> - List of single-ended channels muxed for this ADC.
> - On stm32h7 and stm32mp1:
> - - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
> - - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
> - $ref: /schemas/types.yaml#/definitions/uint32-array
> - items:
> - minimum: 0
> - maximum: 7
> + '#size-cells':
> + const: 0
>
> - st,adc-channel-names:
> - description: List of single-ended channel names.
> + interrupts:
> + maxItems: 1
>
> st,filter-order:
> description: |
> @@ -111,39 +103,6 @@ patternProperties:
> $ref: /schemas/types.yaml#/definitions/uint32
> maximum: 5
>
> - "#io-channel-cells":
> - const: 1
> -
> - st,adc-channel-types:
> - description: |
> - Single-ended channel input type.
> - - "SPI_R": SPI with data on rising edge (default)
> - - "SPI_F": SPI with data on falling edge
> - - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
> - - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
> - items:
> - enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
> - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> -
> - st,adc-channel-clk-src:
> - description: |
> - Conversion clock source.
> - - "CLKIN": external SPI clock (CLKIN x)
> - - "CLKOUT": internal SPI clock (CLKOUT) (default)
> - - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
> - - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
> - items:
> - enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
> - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> -
> - st,adc-alt-channel:
> - description:
> - Must be defined if two sigma delta modulators are
> - connected on same SPI input.
> - If not set, channel n is connected to SPI input n.
> - If set, channel n is connected to SPI input n + 1.
> - type: boolean
> -
> st,filter0-sync:
> description:
> Set to 1 to synchronize with DFSDM filter instance 0.
> @@ -157,14 +116,68 @@ patternProperties:
> items:
> - const: rx
>
> + patternProperties:
> + "^channel@([0-9]|1[0-9])$":
> + type: object
> + $ref: "adc.yaml"
> + description: Represents the external channels which are connected to the DFSDM.
> +
> + properties:
> + reg:
> + items:
> + minimum: 0
> + maximum: 19
> +
> + label:
> + description: |
> + Unique name to identify channel.
> +
> + st,adc-channel-types:
> + description: |
> + Single-ended channel input type.
> + - "SPI_R": SPI with data on rising edge (default)
> + - "SPI_F": SPI with data on falling edge
> + - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
> + - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
> + items:
> + enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> +
> + st,adc-channel-clk-src:
> + description: |
> + Conversion clock source.
> + - "CLKIN": external SPI clock (CLKIN x)
> + - "CLKOUT": internal SPI clock (CLKOUT) (default)
> + - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
> + - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
> + items:
> + enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
> +
> + st,adc-alt-channel:
> + description:
> + Must be defined if two sigma delta modulators are
> + connected on same SPI input.
> + If not set, channel n is connected to SPI input n.
> + If set, channel n is connected to SPI input n + 1.
> + type: boolean
> +
> + io-backends:
> + description: |
> + phandle to an external sigma delta modulator or internal ADC output.
> + $ref: /schemas/types.yaml#/definitions/phandle
> +
> + required:
> + - reg
> + - io-backends
> +
> + additionalProperties: false
> +
> required:
> - compatible
> - reg
> - interrupts
> - - st,adc-channels
> - - st,adc-channel-names
> - st,filter-order
> - - "#io-channel-cells"
>
> allOf:
> - if:
> @@ -175,14 +188,6 @@ patternProperties:
>
> then:
> properties:
> - st,adc-channels:
> - minItems: 1
> - maxItems: 8
> -
> - st,adc-channel-names:
> - minItems: 1
> - maxItems: 8
> -
> st,adc-channel-types:
> minItems: 1
> maxItems: 8
> @@ -191,14 +196,6 @@ patternProperties:
> minItems: 1
> maxItems: 8
>
> - io-channels:
> - description:
> - From common IIO binding. Used to pipe external sigma delta
> - modulator or internal ADC output to DFSDM channel.
> -
> - required:
> - - io-channels
> -
> - if:
> properties:
> compatible:
> @@ -207,12 +204,6 @@ patternProperties:
>
> then:
> properties:
> - st,adc-channels:
> - maxItems: 1
> -
> - st,adc-channel-names:
> - maxItems: 1
> -
> st,adc-channel-types:
> maxItems: 1
>
> @@ -237,15 +228,9 @@ patternProperties:
> "#sound-dai-cells":
> const: 0
>
> - io-channels:
> - description:
> - From common IIO binding. Used to pipe external sigma delta
> - modulator or internal ADC output to DFSDM channel.
> -
> required:
> - compatible
> - "#sound-dai-cells"
> - - io-channels
>
> allOf:
> - if:
> @@ -278,52 +263,4 @@ allOf:
> minimum: 0
> maximum: 5
>
> -examples:
> - - |
> - #include <dt-bindings/interrupt-controller/arm-gic.h>
> - #include <dt-bindings/clock/stm32mp1-clks.h>
> - dfsdm: dfsdm@4400d000 {
> - compatible = "st,stm32mp1-dfsdm";
> - reg = <0x4400d000 0x800>;
> - clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
> - clock-names = "dfsdm", "audio";
> - #address-cells = <1>;
> - #size-cells = <0>;
> -
> - dfsdm0: filter@0 {
> - compatible = "st,stm32-dfsdm-dmic";
> - reg = <0>;
> - interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
> - dmas = <&dmamux1 101 0x400 0x01>;
> - dma-names = "rx";
> - #io-channel-cells = <1>;
> - st,adc-channels = <1>;
> - st,adc-channel-names = "dmic0";
> - st,adc-channel-types = "SPI_R";
> - st,adc-channel-clk-src = "CLKOUT";
> - st,filter-order = <5>;
> -
> - asoc_pdm0: dfsdm-dai {
> - compatible = "st,stm32h7-dfsdm-dai";
> - #sound-dai-cells = <0>;
> - io-channels = <&dfsdm0 0>;
> - };
> - };
> -
> - dfsdm_pdm1: filter@1 {
> - compatible = "st,stm32-dfsdm-adc";
> - reg = <1>;
> - interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
> - dmas = <&dmamux1 102 0x400 0x01>;
> - dma-names = "rx";
> - #io-channel-cells = <1>;
> - st,adc-channels = <2 3>;
> - st,adc-channel-names = "in2", "in3";
> - st,adc-channel-types = "SPI_R", "SPI_R";
> - st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
> - io-channels = <&sd_adc2 &sd_adc3>;
> - st,filter-order = <1>;
> - };
> - };
> -
> ...
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support
2023-08-11 17:10 ` Rob Herring
@ 2023-08-31 15:53 ` Olivier MOYSAN
0 siblings, 0 replies; 10+ messages in thread
From: Olivier MOYSAN @ 2023-08-31 15:53 UTC (permalink / raw)
To: Rob Herring
Cc: Arnaud Pouliquen, Jonathan Cameron, Lars-Peter Clausen,
Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue, Fabrice Gasnier, alsa-devel, linux-iio,
devicetree, linux-stm32, linux-arm-kernel, linux-kernel
Hi Rob,
On 8/11/23 19:10, Rob Herring wrote:
> On Thu, Jul 27, 2023 at 05:03:14PM +0200, Olivier Moysan wrote:
>> Add scaling support to STM32 DFSDM.
>>
>> This introduces the following changes:
>
> Why?
>
This RFC is an attempt to support scaling through a change in DFSDM
topology.
These changes have some impacts on DFSDM and sd modulator bindings.
To keep things simple in this RFC, I skipped legacy support, to put the
emphasis on the new bindings proposal.
There are two changes here: adoption of the generic IIO bindings and new
"io-backends" property. This needs to be put in two separate patches at
the end, I think (as already done for driver patches)
Anyway, the current bindings would become deprecated with these changes.
I still have to consider how to support these legacy bindings for next
step, However.
BRs
Olivier
>> - Add ADC generic channel binding and remove support of deprecated
>> channel bindings.
>
> When was it deprecated?
>
>> - DFSDM is now implemented as a channel provider, so remove io-channels
>> properties.
>> - Add iio-backend property to connect DFSDM to an SD modulator.
>
> io-backends
>
> All sorts of ABI issues with this change. Please explain why you don't
> care.
>
>>
>> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
>> ---
>> .../bindings/iio/adc/st,stm32-dfsdm-adc.yaml | 189 ++++++------------
>> 1 file changed, 63 insertions(+), 126 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
>> index 1970503389aa..128545cedc7f 100644
>> --- a/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml
>> @@ -85,22 +85,14 @@ patternProperties:
>> description: Specifies the DFSDM filter instance used.
>> maxItems: 1
>>
>> - interrupts:
>> - maxItems: 1
>> + '#address-cells':
>> + const: 1
>>
>> - st,adc-channels:
>> - description: |
>> - List of single-ended channels muxed for this ADC.
>> - On stm32h7 and stm32mp1:
>> - - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
>> - - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
>> - $ref: /schemas/types.yaml#/definitions/uint32-array
>> - items:
>> - minimum: 0
>> - maximum: 7
>> + '#size-cells':
>> + const: 0
>>
>> - st,adc-channel-names:
>> - description: List of single-ended channel names.
>> + interrupts:
>> + maxItems: 1
>>
>> st,filter-order:
>> description: |
>> @@ -111,39 +103,6 @@ patternProperties:
>> $ref: /schemas/types.yaml#/definitions/uint32
>> maximum: 5
>>
>> - "#io-channel-cells":
>> - const: 1
>> -
>> - st,adc-channel-types:
>> - description: |
>> - Single-ended channel input type.
>> - - "SPI_R": SPI with data on rising edge (default)
>> - - "SPI_F": SPI with data on falling edge
>> - - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
>> - - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
>> - items:
>> - enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
>> - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> -
>> - st,adc-channel-clk-src:
>> - description: |
>> - Conversion clock source.
>> - - "CLKIN": external SPI clock (CLKIN x)
>> - - "CLKOUT": internal SPI clock (CLKOUT) (default)
>> - - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
>> - - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
>> - items:
>> - enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
>> - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> -
>> - st,adc-alt-channel:
>> - description:
>> - Must be defined if two sigma delta modulators are
>> - connected on same SPI input.
>> - If not set, channel n is connected to SPI input n.
>> - If set, channel n is connected to SPI input n + 1.
>> - type: boolean
>> -
>> st,filter0-sync:
>> description:
>> Set to 1 to synchronize with DFSDM filter instance 0.
>> @@ -157,14 +116,68 @@ patternProperties:
>> items:
>> - const: rx
>>
>> + patternProperties:
>> + "^channel@([0-9]|1[0-9])$":
>> + type: object
>> + $ref: "adc.yaml"
>> + description: Represents the external channels which are connected to the DFSDM.
>> +
>> + properties:
>> + reg:
>> + items:
>> + minimum: 0
>> + maximum: 19
>> +
>> + label:
>> + description: |
>> + Unique name to identify channel.
>> +
>> + st,adc-channel-types:
>> + description: |
>> + Single-ended channel input type.
>> + - "SPI_R": SPI with data on rising edge (default)
>> + - "SPI_F": SPI with data on falling edge
>> + - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
>> + - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
>> + items:
>> + enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
>> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> +
>> + st,adc-channel-clk-src:
>> + description: |
>> + Conversion clock source.
>> + - "CLKIN": external SPI clock (CLKIN x)
>> + - "CLKOUT": internal SPI clock (CLKOUT) (default)
>> + - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
>> + - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
>> + items:
>> + enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
>> + $ref: /schemas/types.yaml#/definitions/non-unique-string-array
>> +
>> + st,adc-alt-channel:
>> + description:
>> + Must be defined if two sigma delta modulators are
>> + connected on same SPI input.
>> + If not set, channel n is connected to SPI input n.
>> + If set, channel n is connected to SPI input n + 1.
>> + type: boolean
>> +
>> + io-backends:
>> + description: |
>> + phandle to an external sigma delta modulator or internal ADC output.
>> + $ref: /schemas/types.yaml#/definitions/phandle
>> +
>> + required:
>> + - reg
>> + - io-backends
>> +
>> + additionalProperties: false
>> +
>> required:
>> - compatible
>> - reg
>> - interrupts
>> - - st,adc-channels
>> - - st,adc-channel-names
>> - st,filter-order
>> - - "#io-channel-cells"
>>
>> allOf:
>> - if:
>> @@ -175,14 +188,6 @@ patternProperties:
>>
>> then:
>> properties:
>> - st,adc-channels:
>> - minItems: 1
>> - maxItems: 8
>> -
>> - st,adc-channel-names:
>> - minItems: 1
>> - maxItems: 8
>> -
>> st,adc-channel-types:
>> minItems: 1
>> maxItems: 8
>> @@ -191,14 +196,6 @@ patternProperties:
>> minItems: 1
>> maxItems: 8
>>
>> - io-channels:
>> - description:
>> - From common IIO binding. Used to pipe external sigma delta
>> - modulator or internal ADC output to DFSDM channel.
>> -
>> - required:
>> - - io-channels
>> -
>> - if:
>> properties:
>> compatible:
>> @@ -207,12 +204,6 @@ patternProperties:
>>
>> then:
>> properties:
>> - st,adc-channels:
>> - maxItems: 1
>> -
>> - st,adc-channel-names:
>> - maxItems: 1
>> -
>> st,adc-channel-types:
>> maxItems: 1
>>
>> @@ -237,15 +228,9 @@ patternProperties:
>> "#sound-dai-cells":
>> const: 0
>>
>> - io-channels:
>> - description:
>> - From common IIO binding. Used to pipe external sigma delta
>> - modulator or internal ADC output to DFSDM channel.
>> -
>> required:
>> - compatible
>> - "#sound-dai-cells"
>> - - io-channels
>>
>> allOf:
>> - if:
>> @@ -278,52 +263,4 @@ allOf:
>> minimum: 0
>> maximum: 5
>>
>> -examples:
>> - - |
>> - #include <dt-bindings/interrupt-controller/arm-gic.h>
>> - #include <dt-bindings/clock/stm32mp1-clks.h>
>> - dfsdm: dfsdm@4400d000 {
>> - compatible = "st,stm32mp1-dfsdm";
>> - reg = <0x4400d000 0x800>;
>> - clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
>> - clock-names = "dfsdm", "audio";
>> - #address-cells = <1>;
>> - #size-cells = <0>;
>> -
>> - dfsdm0: filter@0 {
>> - compatible = "st,stm32-dfsdm-dmic";
>> - reg = <0>;
>> - interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
>> - dmas = <&dmamux1 101 0x400 0x01>;
>> - dma-names = "rx";
>> - #io-channel-cells = <1>;
>> - st,adc-channels = <1>;
>> - st,adc-channel-names = "dmic0";
>> - st,adc-channel-types = "SPI_R";
>> - st,adc-channel-clk-src = "CLKOUT";
>> - st,filter-order = <5>;
>> -
>> - asoc_pdm0: dfsdm-dai {
>> - compatible = "st,stm32h7-dfsdm-dai";
>> - #sound-dai-cells = <0>;
>> - io-channels = <&dfsdm0 0>;
>> - };
>> - };
>> -
>> - dfsdm_pdm1: filter@1 {
>> - compatible = "st,stm32-dfsdm-adc";
>> - reg = <1>;
>> - interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
>> - dmas = <&dmamux1 102 0x400 0x01>;
>> - dma-names = "rx";
>> - #io-channel-cells = <1>;
>> - st,adc-channels = <2 3>;
>> - st,adc-channel-names = "in2", "in3";
>> - st,adc-channel-types = "SPI_R", "SPI_R";
>> - st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
>> - io-channels = <&sd_adc2 &sd_adc3>;
>> - st,filter-order = <1>;
>> - };
>> - };
>> -
>> ...
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RFC v2 04/11] dt-bindings: iio: adc: add scaling support to sd modulator
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
2023-07-27 15:03 ` [RFC v2 02/11] of: property: add device link support for io-backends Olivier Moysan
2023-07-27 15:03 ` [RFC v2 03/11] dt-bindings: iio: stm32-dfsdm-adc: add scaling support Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
2023-07-27 15:03 ` [RFC v2 09/11] ARM: dts: stm32: adopt new dfsdm bindings on stm32mp151 Olivier Moysan
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Arnaud Pouliquen
Cc: Olivier Moysan, linux-iio, devicetree, linux-kernel
Add scaling support to SD modulator.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
.../bindings/iio/adc/sigma-delta-modulator.yaml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
index cab0d425eaa4..bcc446c6428c 100644
--- a/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/sigma-delta-modulator.yaml
@@ -18,12 +18,15 @@ properties:
- sd-modulator
- ads1201
- '#io-channel-cells':
+ '#io-backend-cells':
const: 0
+ vref-supply:
+ description: Phandle to the SD modulator reference voltage.
+
required:
- compatible
- - '#io-channel-cells'
+ - '#io-backend-cells'
additionalProperties: false
@@ -31,7 +34,7 @@ examples:
- |
ads1202: adc {
compatible = "sd-modulator";
- #io-channel-cells = <0>;
+ #io-backend-cells = <0>;
};
...
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [RFC v2 09/11] ARM: dts: stm32: adopt new dfsdm bindings on stm32mp151
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
` (2 preceding siblings ...)
2023-07-27 15:03 ` [RFC v2 04/11] dt-bindings: iio: adc: add scaling support to sd modulator Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
2023-07-27 15:03 ` [RFC v2 10/11] ARM: dts: stm32: add dfsdm pins muxing on stm32mp15 Olivier Moysan
2023-07-27 15:03 ` [RFC v2 11/11] ARM: dts: stm32: add dfsdm iio support on stm32mp157c-ev Olivier Moysan
5 siblings, 0 replies; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue
Cc: Olivier Moysan, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
Adapt STM32MP151 device tree to match DFSDM new bindings.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
arch/arm/boot/dts/st/stm32mp151.dtsi | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi
index 61508917521c..338457357248 100644
--- a/arch/arm/boot/dts/st/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp151.dtsi
@@ -970,7 +970,8 @@ dfsdm: dfsdm@4400d000 {
dfsdm0: filter@0 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <0>;
interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 101 0x400 0x01>;
@@ -980,7 +981,8 @@ dfsdm0: filter@0 {
dfsdm1: filter@1 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <1>;
interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 102 0x400 0x01>;
@@ -990,7 +992,8 @@ dfsdm1: filter@1 {
dfsdm2: filter@2 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <2>;
interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 103 0x400 0x01>;
@@ -1000,7 +1003,8 @@ dfsdm2: filter@2 {
dfsdm3: filter@3 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <3>;
interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 104 0x400 0x01>;
@@ -1010,7 +1014,8 @@ dfsdm3: filter@3 {
dfsdm4: filter@4 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <4>;
interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 91 0x400 0x01>;
@@ -1020,7 +1025,8 @@ dfsdm4: filter@4 {
dfsdm5: filter@5 {
compatible = "st,stm32-dfsdm-adc";
- #io-channel-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
reg = <5>;
interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 92 0x400 0x01>;
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [RFC v2 10/11] ARM: dts: stm32: add dfsdm pins muxing on stm32mp15
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
` (3 preceding siblings ...)
2023-07-27 15:03 ` [RFC v2 09/11] ARM: dts: stm32: adopt new dfsdm bindings on stm32mp151 Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
2023-07-27 15:03 ` [RFC v2 11/11] ARM: dts: stm32: add dfsdm iio support on stm32mp157c-ev Olivier Moysan
5 siblings, 0 replies; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue
Cc: Olivier Moysan, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
Add STM32 DFSDM pin muxings to STM32MP15.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi | 39 +++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi
index 05c9c4f8064c..f4dd46c176f9 100644
--- a/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi
+++ b/arch/arm/boot/dts/st/stm32mp15-pinctrl.dtsi
@@ -188,6 +188,45 @@ pins {
};
};
+ dfsdm_clkout_pins_a: dfsdm-clkout-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('B', 13, AF3)>; /* DFSDM_CKOUT */
+ bias-disable;
+ drive-push-pull;
+ slew-rate = <0>;
+ };
+ };
+
+ dfsdm_clkout_sleep_pins_a: dfsdm-clkout-sleep-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('B', 13, ANALOG)>; /* DFSDM_CKOUT */
+ };
+ };
+
+ dfsdm_data1_pins_a: dfsdm-data1-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('C', 3, AF3)>; /* DFSDM_DATA1 */
+ };
+ };
+
+ dfsdm_data1_sleep_pins_a: dfsdm-data1-sleep-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('C', 3, ANALOG)>; /* DFSDM_DATA1 */
+ };
+ };
+
+ dfsdm_data3_pins_a: dfsdm-data3-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('F', 13, AF6)>; /* DFSDM_DATA3 */
+ };
+ };
+
+ dfsdm_data3_sleep_pins_a: dfsdm-data3-sleep-pins-0 {
+ pins {
+ pinmux = <STM32_PINMUX('F', 13, ANALOG)>; /* DFSDM_DATA3 */
+ };
+ };
+
ethernet0_rgmii_pins_a: rgmii-0 {
pins1 {
pinmux = <STM32_PINMUX('G', 5, AF11)>, /* ETH_RGMII_CLK125 */
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* [RFC v2 11/11] ARM: dts: stm32: add dfsdm iio support on stm32mp157c-ev
2023-07-27 15:03 [RFC v2 00/11] iio: add iio backend device type Olivier Moysan
` (4 preceding siblings ...)
2023-07-27 15:03 ` [RFC v2 10/11] ARM: dts: stm32: add dfsdm pins muxing on stm32mp15 Olivier Moysan
@ 2023-07-27 15:03 ` Olivier Moysan
5 siblings, 0 replies; 10+ messages in thread
From: Olivier Moysan @ 2023-07-27 15:03 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Maxime Coquelin,
Alexandre Torgue
Cc: Olivier Moysan, devicetree, linux-stm32, linux-arm-kernel,
linux-kernel
This DT is an example of backend iio device used for STM32 DFSDM.
DFSDM filter1 has a single input channel, while filter0 is configured
to support scan mode with two input channels.
Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
---
arch/arm/boot/dts/st/stm32mp157c-ev1.dts | 68 ++++++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/arch/arm/boot/dts/st/stm32mp157c-ev1.dts b/arch/arm/boot/dts/st/stm32mp157c-ev1.dts
index af3800501875..edeac26f39a4 100644
--- a/arch/arm/boot/dts/st/stm32mp157c-ev1.dts
+++ b/arch/arm/boot/dts/st/stm32mp157c-ev1.dts
@@ -73,6 +73,27 @@ panel_backlight: panel-backlight {
default-on;
status = "okay";
};
+
+ sd_adc0: sd-adc0 {
+ compatible = "sd-modulator";
+ #io-backend-cells = <0>;
+ vref-supply = <&v3v3>;
+ status = "okay";
+ };
+
+ sd_adc1: sd-adc1 {
+ compatible = "sd-modulator";
+ #io-backend-cells = <0>;
+ vref-supply = <&v3v3>;
+ status = "okay";
+ };
+
+ sd_adc2: sd-adc2 {
+ compatible = "sd-modulator";
+ #io-backend-cells = <0>;
+ vref-supply = <&v3v3>;
+ status = "okay";
+ };
};
&cec {
@@ -99,6 +120,53 @@ dcmi_0: endpoint {
};
};
+&dfsdm {
+ pinctrl-names = "default", "sleep";
+ pinctrl-0 = <&dfsdm_clkout_pins_a
+ &dfsdm_data1_pins_a &dfsdm_data3_pins_a>;
+ pinctrl-1 = <&dfsdm_clkout_sleep_pins_a
+ &dfsdm_data1_sleep_pins_a &dfsdm_data3_sleep_pins_a>;
+ spi-max-frequency = <2048000>;
+ status = "okay";
+
+ dfsdm0: filter@0 {
+ compatible = "st,stm32-dfsdm-adc";
+ st,filter-order = <3>;
+ status = "okay";
+
+ channel@0 {
+ reg = <0>;
+ label = "in0";
+ st,adc-channel-types = "SPI_F";
+ st,adc-channel-clk-src = "CLKOUT";
+ st,adc-alt-channel;
+ io-backends = <&sd_adc0>;
+ };
+
+ channel@1 {
+ reg = <1>;
+ label = "in1";
+ st,adc-channel-types = "SPI_R";
+ st,adc-channel-clk-src = "CLKOUT";
+ io-backends = <&sd_adc1>;
+ };
+ };
+
+ dfsdm1: filter@1 {
+ compatible = "st,stm32-dfsdm-adc";
+ st,filter-order = <3>;
+ status = "okay";
+
+ channel@3 {
+ reg = <3>;
+ label = "in3";
+ st,adc-channel-types = "SPI_R";
+ st,adc-channel-clk-src = "CLKOUT";
+ io-backends = <&sd_adc2>;
+ };
+ };
+};
+
&dsi {
phy-dsi-supply = <®18>;
#address-cells = <1>;
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread