Re: [PATCH v3 4/6] dt-bindings: sound: Add support for the Lantiq PEF2256 codec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Begin Message ---
On Thu, 23 Mar 2023 08:31:28 +0100
Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:

> On 23/03/2023 08:27, Herve Codina wrote:
> > Hi Krzysztof
> > 
> > On Wed, 22 Mar 2023 22:59:37 +0100
> > Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:
> >   
> >> On 22/03/2023 14:46, Herve Codina wrote:  
> >>> The Lantiq PEF2256 is a framer and line interface component designed to
> >>> fulfill all required interfacing between an analog E1/T1/J1 line and the
> >>> digital PCM system highway/H.100 bus.
> >>>
> >>> The codec support allows to use some of the PCM system highway
> >>> time-slots as audio channels to transport audio data over the E1/T1/J1
> >>> lines.
> >>>
> >>> Signed-off-by: Herve Codina <herve.codina@xxxxxxxxxxx>
> >>> ---
> >>>  .../bindings/sound/lantiq,pef2256-codec.yaml  | 54 +++++++++++++++++++
> >>>  1 file changed, 54 insertions(+)
> >>>  create mode 100644 Documentation/devicetree/bindings/sound/lantiq,pef2256-codec.yaml
> >>>
> >>> diff --git a/Documentation/devicetree/bindings/sound/lantiq,pef2256-codec.yaml b/Documentation/devicetree/bindings/sound/lantiq,pef2256-codec.yaml
> >>> new file mode 100644
> >>> index 000000000000..da35b70cda99
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/sound/lantiq,pef2256-codec.yaml
> >>> @@ -0,0 +1,54 @@
> >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>> +%YAML 1.2
> >>> +---
> >>> +$id: http://devicetree.org/schemas/sound/lantiq,pef2256-codec.yaml#
> >>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >>> +
> >>> +title: Lantiq PEF2256 codec
> >>> +
> >>> +maintainers:
> >>> +  - Herve Codina <herve.codina@xxxxxxxxxxx>
> >>> +
> >>> +description: |
> >>> +  Codec support for PEF2256.
> >>> +
> >>> +  The Lantiq PEF2256, also known as Infineon PEF2256 or FALC56, is a framer and
> >>> +  line interface component designed to fulfill all required interfacing between
> >>> +  an analog E1/T1/J1 line and the digital PCM system highway/H.100 bus.
> >>> +
> >>> +  The codec support allows to use some of the PCM system highway time-slots as
> >>> +  audio channels to transport audio data over the E1/T1/J1 lines.
> >>> +
> >>> +  The time-slots used by the codec must be set and so, the properties
> >>> +  'dai-tdm-slot-num', 'dai-tdm-slot-width', 'dai-tdm-slot-tx-mask' and
> >>> +  'dai-tdm-slot-rx-mask' must be present in the ALSA sound card node for
> >>> +  sub-nodes that involve the codec. The codec uses 8bit time-slots.
> >>> +  'dai-tdm-tdm-slot-with' must be set to 8.
> >>> +  The tx and rx masks define the PEF2256 time-slots assigned to the codec.
> >>> +
> >>> +  The PEF2256 codec node should be a child of a PEF2256 node.
> >>> +  Refer to the bindings described in
> >>> +  Documentation/devicetree/bindings/mfd/lantiq,pef2256.yaml
> >>> +
> >>> +allOf:
> >>> +  - $ref: dai-common.yaml#
> >>> +
> >>> +properties:
> >>> +  compatible:
> >>> +    const: lantiq,pef2256-codec
> >>> +
> >>> +  '#sound-dai-cells':
> >>> +    const: 0    
> >>
> >> You do not have here any resources, so the entire binding can be dropped
> >> and merged into the parent.
> >>
> >> Best regards,
> >> Krzysztof
> >>  
> > 
> > Ok,
> > Do you expect all these properties (except compatible) merged at the parent  
> 
> You have only two properties here - dai cells and name-prefix...
> 
> > level or may I keep a child node with these properties including the
> > compatible property (ie. yaml file merge).  
> 
> I was thinking that these should be merged into parent because usually
> you do not need child node for this. However now I started to think how
> the codec driver would look like. Essentially the parent MFD driver
> would need to register dais...
> 

There is also something specific to audio, the slots definition
'dai-tdm-slot-tx-mask' and 'dai-tdm-slot-rx-mask'. These slots definitions
are set at the ALSA sound card sub-nodes.
So, I can have multiple codec in the PEF2256.

For instance:
  framer {
    compatible = "lantiq,pef2256", "simple-mfd";
    ...
    pef2256_codec0: codec0 {
      compatible = "lantiq,pef2256-codec";
      #sound-dai-cells = <0>;
    };
    pef2256_codec1: codec1 {
      compatible = "lantiq,pef2256-codec";
      #sound-dai-cells = <0>;
    };
  };

  sound {
    compatible = "simple-audio-card";
    #address-cells = <1>;
    #size-cells = <0>;
    simple-audio-card,dai-link@0 { /* CPU DAI1 - pef2256 codec 1 */
      reg = <0>;
      cpu {
        sound-dai = <&cpu_dai1>;
      };
      codec {
        sound-dai = <&pef2256_codec0>;
	dai-tdm-slot-num = <4>;
	dai-tdm-slot-width = <8>;
	/* TS 2, 3, 4, 5 */
	dai-tdm-slot-tx-mask = <0 1 1 1 1>;
	dai-tdm-slot-rx-mask = <0 1 1 1 1>;
      };
    simple-audio-card,dai-link@1 { /* CPU DAI2 - pef2256 codec 2 */
      reg = <1>;
      cpu {
        sound-dai = <&cpu_dai2>;
      };
      codec {
	sound-dai = <&pef2256_codec1>;
	dai-tdm-slot-num = <4>;
	dai-tdm-slot-width = <8>;
	/* TS 6, 7, 8, 9 */
	dai-tdm-slot-tx-mask = <0 0 0 0 0 1 1 1 1>;
	dai-tdm-slot-rx-mask = <0 0 0 0 0 1 1 1 1>;
      };
    };
  };

To solve this, I can use #sound-dai-cells = <1>; but this will complicate
the driver itself and is it really needed ?
Having "simple-mfd" dans sub-nodes keep all things simple.

Regards,
Hervé

-- 
Hervé Codina, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



--- End Message ---

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux