Commit b8f31b1d authored by Olivier Moysan's avatar Olivier Moysan Committed by Jonathan Cameron

dt-bindings: iio: dfsdm: move to backend framework

Change the DFSDM binding to use the new IIO backend framework,
along with the adoption of IIO generic channels.
This binding change allows to add scaling support to the DFSDM.

Keep the legacy binding as deprecated for backward compatibility.

The io-backends property is supported only in generic IIO channel
binding.

- Channel description with the generic binding (Audio and Analog):

  Properties superseded by generic properties:
    st,adc-channels: becomes "reg" property in channel node
    st,adc-channel-names: becomes "label" property in channel node
  Properties moved to channel child node:
    st,adc-channel-types: becomes st,adc-channel-type
    st,adc-channel-clk-src, st,adc-alt-channel

- Analog binding:

  DFSDM filter channel is configured as an IIO backend consumer.
  Add io-backends property in channel child nodes.

  DFSDM is no more configured as a channel consumer from SD modulator.
  Use of io-channels in DFSDM node is deprecated.

- Audio binding:

  DFSDM audio DAI is configured as a channel consumer from DFSDM filter.
  No change compare to legacy.
Signed-off-by: default avatarOlivier Moysan <olivier.moysan@foss.st.com>
Reviewed-by: default avatarRob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240730084640.1307938-5-olivier.moysan@foss.st.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c464cc61
...@@ -102,9 +102,11 @@ patternProperties: ...@@ -102,9 +102,11 @@ patternProperties:
items: items:
minimum: 0 minimum: 0
maximum: 7 maximum: 7
deprecated: true
st,adc-channel-names: st,adc-channel-names:
description: List of single-ended channel names. description: List of single-ended channel names.
deprecated: true
st,filter-order: st,filter-order:
description: | description: |
...@@ -118,6 +120,12 @@ patternProperties: ...@@ -118,6 +120,12 @@ patternProperties:
"#io-channel-cells": "#io-channel-cells":
const: 1 const: 1
'#address-cells':
const: 1
'#size-cells':
const: 0
st,adc-channel-types: st,adc-channel-types:
description: | description: |
Single-ended channel input type. Single-ended channel input type.
...@@ -128,6 +136,7 @@ patternProperties: ...@@ -128,6 +136,7 @@ patternProperties:
items: items:
enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ] enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
$ref: /schemas/types.yaml#/definitions/non-unique-string-array $ref: /schemas/types.yaml#/definitions/non-unique-string-array
deprecated: true
st,adc-channel-clk-src: st,adc-channel-clk-src:
description: | description: |
...@@ -139,6 +148,7 @@ patternProperties: ...@@ -139,6 +148,7 @@ patternProperties:
items: items:
enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ] enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
$ref: /schemas/types.yaml#/definitions/non-unique-string-array $ref: /schemas/types.yaml#/definitions/non-unique-string-array
deprecated: true
st,adc-alt-channel: st,adc-alt-channel:
description: description:
...@@ -147,6 +157,7 @@ patternProperties: ...@@ -147,6 +157,7 @@ patternProperties:
If not set, channel n is connected to SPI input n. If not set, channel n is connected to SPI input n.
If set, channel n is connected to SPI input n + 1. If set, channel n is connected to SPI input n + 1.
type: boolean type: boolean
deprecated: true
st,filter0-sync: st,filter0-sync:
description: description:
...@@ -165,11 +176,60 @@ patternProperties: ...@@ -165,11 +176,60 @@ patternProperties:
- compatible - compatible
- reg - reg
- interrupts - interrupts
- st,adc-channels
- st,adc-channel-names
- st,filter-order - st,filter-order
- "#io-channel-cells" - "#io-channel-cells"
patternProperties:
"^channel@[0-7]$":
type: object
$ref: adc.yaml
unevaluatedProperties: false
description: Represents the external channels which are connected to the DFSDM.
properties:
reg:
maximum: 7
label:
description:
Unique name to identify which channel this is.
st,adc-channel-type:
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
$ref: /schemas/types.yaml#/definitions/string
enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
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).
$ref: /schemas/types.yaml#/definitions/string
enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
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:
Used to pipe external sigma delta modulator or internal ADC backend to DFSDM channel.
maxItems: 1
required:
- reg
allOf: allOf:
- if: - if:
properties: properties:
...@@ -199,9 +259,19 @@ patternProperties: ...@@ -199,9 +259,19 @@ patternProperties:
description: description:
From common IIO binding. Used to pipe external sigma delta From common IIO binding. Used to pipe external sigma delta
modulator or internal ADC output to DFSDM channel. modulator or internal ADC output to DFSDM channel.
deprecated: true
required: if:
- io-channels required:
- st,adc-channels
then:
required:
- io-channels
patternProperties:
"^channel@[0-7]$":
required:
- io-backends
- if: - if:
properties: properties:
...@@ -298,6 +368,7 @@ examples: ...@@ -298,6 +368,7 @@ examples:
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
// Example 1: Audio use case with generic binding
dfsdm0: filter@0 { dfsdm0: filter@0 {
compatible = "st,stm32-dfsdm-dmic"; compatible = "st,stm32-dfsdm-dmic";
reg = <0>; reg = <0>;
...@@ -305,12 +376,18 @@ examples: ...@@ -305,12 +376,18 @@ examples:
dmas = <&dmamux1 101 0x400 0x01>; dmas = <&dmamux1 101 0x400 0x01>;
dma-names = "rx"; dma-names = "rx";
#io-channel-cells = <1>; #io-channel-cells = <1>;
st,adc-channels = <1>; #address-cells = <1>;
st,adc-channel-names = "dmic0"; #size-cells = <0>;
st,adc-channel-types = "SPI_R";
st,adc-channel-clk-src = "CLKOUT";
st,filter-order = <5>; st,filter-order = <5>;
channel@1 {
reg = <1>;
label = "dmic0";
st,adc-channel-type = "SPI_R";
st,adc-channel-clk-src = "CLKOUT";
st,adc-alt-channel;
};
asoc_pdm0: dfsdm-dai { asoc_pdm0: dfsdm-dai {
compatible = "st,stm32h7-dfsdm-dai"; compatible = "st,stm32h7-dfsdm-dai";
#sound-dai-cells = <0>; #sound-dai-cells = <0>;
...@@ -318,19 +395,34 @@ examples: ...@@ -318,19 +395,34 @@ examples:
}; };
}; };
dfsdm_pdm1: filter@1 { // Example 2: Analog use case with generic binding
dfsdm1: filter@1 {
compatible = "st,stm32-dfsdm-adc"; compatible = "st,stm32-dfsdm-adc";
reg = <1>; reg = <1>;
interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
dmas = <&dmamux1 102 0x400 0x01>; dmas = <&dmamux1 102 0x400 0x01>;
dma-names = "rx"; 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>; st,filter-order = <1>;
#io-channel-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@2 {
reg = <2>;
label = "in2";
st,adc-channel-type = "SPI_F";
st,adc-channel-clk-src = "CLKOUT";
st,adc-alt-channel;
io-backends = <&sd_adc2>;
};
channel@3 {
reg = <3>;
label = "in3";
st,adc-channel-type = "SPI_R";
st,adc-channel-clk-src = "CLKOUT";
io-backends = <&sd_adc3>;
};
}; };
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment