Re: [PATCHv3 RESEND 10/10] ASoC: dt-bindings: fsl-asoc-card: add compatible for generic codec

2024-01-02 Thread Elinor Montmasson
Hello,

On Wednesday, 20 December, 2023 23:25:50, Rob Herring wrote:
> On Mon, Dec 18, 2023 at 01:40:58PM +0100, Elinor Montmasson wrote: 
> > +Optional, relevant only with the "fsl,imx-audio-generic" compatible: 
> > + 
> > + - cpu-slot-width : Indicates a specific TDM slot width in bits. 
> > + - cpu-slot-num : Indicates a specific number of TDM slots per frame. 
> 
> Pretty sure I've seen other bindings with TDM slot properties. A sign we 
> need something common if we don't already have something. 

That's right, "tdm-slot.txt" already defines TDM bindings, I will
use them with the utility function snd_soc_of_parse_tdm_slot().

> > + - cpu-sysclk-freq-rx : Frequency of the CPU DAI sys clock for Rx. 
> > + - cpu-sysclk-freq-tx : Frequency of the CPU DAI sys clock for Tx. 
> > + 
> > + - cpu-sysclk-dir-rx-out : Boolean property. Specifies sys clock direction 
> > + as 'out' on initialization for Rx. 
> > + If not set, default direction is 'in'. 
> > + - cpu-sysclk-dir-tx-out : Boolean property. Specifies sys clock direction 
> > + as 'out' on initialization for Tx. 
> > + If not set, default direction is 'in'. 
> 
> Looks like clock stuff. Use the clock binding. 

simple-card defines similar properties at the dai level:
"system-clock-frequency" and "system-clock-direction-out".
The first is used if no "clocks" binding is specified for the dai node.

Maybe I could use a similar logic with fsl-asoc-card ?
* adding a "clock-cpu" phandle property which should be the cpu clock.
It will be used to retreive the frequency for both RX and TX.
* keeping "cpu-sysclk-freq-rx"/"cpu-sysclk-freq-tx", which are used if
no clock is provided, like "system-clock-frequency" in simple-card.
* keep using "cpu-sysclk-dir-rx-out"/"cpu-sysclk-dir-tx-out", like
"system-clock-direction-out" in simple card.

Also, maybe I could rename my new properties:
cpu-system-clock-frequency-tx, cpu-system-clock-direction-out-rx, ...
It would better match those in simple-card as they do the same thing.

Best regards,
Elinor Montmasson


Re: [PATCHv3 RESEND 10/10] ASoC: dt-bindings: fsl-asoc-card: add compatible for generic codec

2023-12-20 Thread Rob Herring
On Mon, Dec 18, 2023 at 01:40:58PM +0100, Elinor Montmasson wrote:
> Add documentation about new dts bindings following new support
> for compatible "fsl,imx-audio-generic".
> 
> Some CPU DAI don't require a real audio codec. The new compatible
> "fsl,imx-audio-generic" allows using the driver with codec drivers
> SPDIF DIT and SPDIF DIR as dummy codecs.
> It also allows using not pre-configured audio codecs which
> don't require specific control through a codec driver.
> 
> The new dts properties give the possibility to set some parameters
> about the CPU DAI usually set through the codec configuration.
> 
> Signed-off-by: Elinor Montmasson 
> Co-authored-by: Philip-Dylan Gleonec 
> 
> ---
>  .../bindings/sound/fsl-asoc-card.txt  | 28 ++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt 
> b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> index 4e8dbc5abfd1..f137ef2154e3 100644
> --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
> @@ -17,6 +17,9 @@ Note: The card is initially designed for those sound cards 
> who use AC'97, I2S
>and PCM DAI formats. However, it'll be also possible to support those 
> non
>AC'97/I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, as
>long as the driver has been properly upgraded.
> +  To use CPU DAIs that do not require a codec such as an S/PDIF 
> controller,
> +  or to use a DAI to output or capture raw I2S/TDM data, you can
> +  use the compatible "fsl,imx-audio-generic".
>  
>  
>  The compatible list for this generic sound card currently:
> @@ -48,6 +51,8 @@ The compatible list for this generic sound card currently:
>  
>   "fsl,imx-audio-nau8822"
>  
> + "fsl,imx-audio-generic"
> +
>  Required properties:
>  
>- compatible   : Contains one of entries in the compatible 
> list.
> @@ -56,7 +61,11 @@ Required properties:
>  
>- audio-cpu: The phandle of an CPU DAI controller
>  
> -  - audio-codec  : The phandle of an audio codec
> +  - audio-codec  : The phandle of an audio codec.
> +   If using the "fsl,imx-audio-generic" compatible,
> +   give instead a pair of phandles with the
> +   spdif_transmitter first (driver SPDIF DIT) and the
> +   spdif_receiver second (driver SPDIF DIR).
>  
>  Optional properties:
>  
> @@ -87,6 +96,23 @@ Optional properties:
>- frame-inversion  : dai-link uses frame clock inversion, for details see 
> simple-card.yaml.
>- bitclock-inversion   : dai-link uses bit clock inversion, for 
> details see simple-card.yaml.
>- mclk-id  : main clock id, specific for each card configuration.
> +   For multi-codec configurations, an array of ids can be
> +   given, one for each codec.
> +
> +Optional, relevant only with the "fsl,imx-audio-generic" compatible:
> +
> +  - cpu-slot-width   : Indicates a specific TDM slot width in bits.
> +  - cpu-slot-num : Indicates a specific number of TDM slots per frame.

Pretty sure I've seen other bindings with TDM slot properties. A sign we 
need something common if we don't already have something.

> +
> +  - cpu-sysclk-freq-rx   : Frequency of the CPU DAI sys clock for Rx.
> +  - cpu-sysclk-freq-tx   : Frequency of the CPU DAI sys clock for Tx.
> +
> +  - cpu-sysclk-dir-rx-out: Boolean property. Specifies sys clock 
> direction
> +   as 'out' on initialization for Rx.
> +   If not set, default direction is 'in'.
> +  - cpu-sysclk-dir-tx-out: Boolean property. Specifies sys clock 
> direction
> +   as 'out' on initialization for Tx.
> +   If not set, default direction is 'in'.

Looks like clock stuff. Use the clock binding.

Rob


[PATCHv3 RESEND 10/10] ASoC: dt-bindings: fsl-asoc-card: add compatible for generic codec

2023-12-18 Thread Elinor Montmasson
Add documentation about new dts bindings following new support
for compatible "fsl,imx-audio-generic".

Some CPU DAI don't require a real audio codec. The new compatible
"fsl,imx-audio-generic" allows using the driver with codec drivers
SPDIF DIT and SPDIF DIR as dummy codecs.
It also allows using not pre-configured audio codecs which
don't require specific control through a codec driver.

The new dts properties give the possibility to set some parameters
about the CPU DAI usually set through the codec configuration.

Signed-off-by: Elinor Montmasson 
Co-authored-by: Philip-Dylan Gleonec 
---
 .../bindings/sound/fsl-asoc-card.txt  | 28 ++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt 
b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
index 4e8dbc5abfd1..f137ef2154e3 100644
--- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
+++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt
@@ -17,6 +17,9 @@ Note: The card is initially designed for those sound cards 
who use AC'97, I2S
   and PCM DAI formats. However, it'll be also possible to support those non
   AC'97/I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, as
   long as the driver has been properly upgraded.
+  To use CPU DAIs that do not require a codec such as an S/PDIF controller,
+  or to use a DAI to output or capture raw I2S/TDM data, you can
+  use the compatible "fsl,imx-audio-generic".
 
 
 The compatible list for this generic sound card currently:
@@ -48,6 +51,8 @@ The compatible list for this generic sound card currently:
 
  "fsl,imx-audio-nau8822"
 
+ "fsl,imx-audio-generic"
+
 Required properties:
 
   - compatible : Contains one of entries in the compatible list.
@@ -56,7 +61,11 @@ Required properties:
 
   - audio-cpu  : The phandle of an CPU DAI controller
 
-  - audio-codec: The phandle of an audio codec
+  - audio-codec: The phandle of an audio codec.
+ If using the "fsl,imx-audio-generic" compatible,
+ give instead a pair of phandles with the
+ spdif_transmitter first (driver SPDIF DIT) and the
+ spdif_receiver second (driver SPDIF DIR).
 
 Optional properties:
 
@@ -87,6 +96,23 @@ Optional properties:
   - frame-inversion: dai-link uses frame clock inversion, for details see 
simple-card.yaml.
   - bitclock-inversion : dai-link uses bit clock inversion, for details see 
simple-card.yaml.
   - mclk-id: main clock id, specific for each card configuration.
+ For multi-codec configurations, an array of ids can be
+ given, one for each codec.
+
+Optional, relevant only with the "fsl,imx-audio-generic" compatible:
+
+  - cpu-slot-width : Indicates a specific TDM slot width in bits.
+  - cpu-slot-num   : Indicates a specific number of TDM slots per frame.
+
+  - cpu-sysclk-freq-rx : Frequency of the CPU DAI sys clock for Rx.
+  - cpu-sysclk-freq-tx : Frequency of the CPU DAI sys clock for Tx.
+
+  - cpu-sysclk-dir-rx-out  : Boolean property. Specifies sys clock 
direction
+ as 'out' on initialization for Rx.
+ If not set, default direction is 'in'.
+  - cpu-sysclk-dir-tx-out  : Boolean property. Specifies sys clock 
direction
+ as 'out' on initialization for Tx.
+ If not set, default direction is 'in'.
 
 Optional unless SSI is selected as a CPU DAI:
 
-- 
2.25.1