mbox series

[0/2] dt-bindings: sound: ti, pcm3168a: json-schema conversion and fixes

Message ID cover.1669980383.git.geert+renesas@glider.be
Headers show
Series dt-bindings: sound: ti, pcm3168a: json-schema conversion and fixes | expand

Message

Geert Uytterhoeven Dec. 2, 2022, 12:55 p.m. UTC
Hi all,

This patch series is an attempt to convert the existing DT binding
documentation for the Texas Instruments PCM3168A Audio Codec to
json-schema ("another one bites the dust" ;-).

It consists of two parts:
  1. The actual DT binding conversion,
  2. An RFC patch to fix the impedance mismatch between the bindings
     and the description in the Shimafuji Kingfisher board DTS.

I'm not super-familiar with the audio details, so I would be very
grateful to receive your comments.

Thanks!

Geert Uytterhoeven (2):
  dt-bindings: sound: ti,pcm3168a: Convert to json-schema
  [RFC] arm64: dts: renesas: ulcb-kf: Fix pcm3168a audio codec node

 .../devicetree/bindings/sound/ti,pcm3168a.txt |  56 ----------
 .../bindings/sound/ti,pcm3168a.yaml           | 105 ++++++++++++++++++
 arch/arm64/boot/dts/renesas/ulcb-kf.dtsi      |   5 +-
 3 files changed, 107 insertions(+), 59 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/ti,pcm3168a.txt
 create mode 100644 Documentation/devicetree/bindings/sound/ti,pcm3168a.yaml

Comments

Krzysztof Kozlowski Dec. 3, 2022, 12:13 p.m. UTC | #1
On 02/12/2022 13:55, Geert Uytterhoeven wrote:
> Convert the Texas Instruments PCM3168A Audio Codec Device Tree binding
> documentation to json-schema.
> 
> Add missing properties.
> Drop unneeded pinctrl properties from example.

Thank you for your patch. There is something to discuss/improve.

> +description:
> +  The Texas Instruments PCM3168A is a 24-bit Multi-channel Audio CODEC with
> +  96/192kHz sampling rate, supporting both SPI and I2C bus access.
> +
> +properties:
> +  compatible:
> +    const: ti,pcm3168a
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    items:
> +      - description: System clock input
> +
> +  clock-names:
> +    items:
> +      - const: scki
> +
> +  reset-gpios:
> +    items:
> +      - description: |
> +          GPIO line connected to the active-low RST pin of the codec.
> +            RST = low: device power-down
> +            RST = high: device is enabled
> +
> +  "#sound-dai-cells":
> +    enum: [0, 1]

This is a bit unexpected. Looking at DTSes:
1. I see in ulcb-kf.dtsi with cells==0, but two endpoints. The dai cells
seem unused? In such case shall dai-cells be skipped if we have endpoints?

2. in k3-j721e-common-proc-board.dts has cells=1, but user's phandle
does not have an argument, so practically it is ==0? The user -
sound/soc/ti/j721e-evm.c - just gets the node and does not use cells,
right? So even though dai-cells==1, it does not matter, because user
gets its own parsing?

3. The pcm3168a driver also does not have any xlate function, but it
registers to DAIs, so all uses should be with cells==1 to select proper
DAI...


> +
> +  VDD1-supply:
> +    description: Digital power supply regulator 1 (+3.3V)
> +
> +  VDD2-supply:
> +    description: Digital power supply regulator 2 (+3.3V)
> +
> +  VCCAD1-supply:
> +    description: ADC power supply regulator 1 (+5V)
> +
> +  VCCAD2-supply:
> +    description: ADC power supply regulator 2 (+5V)
> +
> +  VCCDA1-supply:
> +    description: DAC power supply regulator 1 (+5V)
> +
> +  VCCDA2-supply:
> +    description: DAC power supply regulator 2 (+5V)
> +
> +  ports:
> +    $ref: /schemas/graph.yaml#/properties/ports
> +    properties:
> +      port@0:
> +        $ref: audio-graph-port.yaml#
> +        description: Audio input port.

unevaluatedProperties: false

> +
> +      port@1:
> +        $ref: audio-graph-port.yaml#
> +        description: Audio output port.

unevaluatedProperties: false


> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - VDD1-supply
> +  - VDD2-supply
> +  - VCCAD1-supply
> +  - VCCAD2-supply
> +  - VCCDA1-supply
> +  - VCCDA2-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        pcm3168a: audio-codec@44 {
> +            compatible = "ti,pcm3168a";
> +            reg = <0x44>;
> +            reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
> +            clocks = <&clk_core 42>;
> +            clock-names = "scki";
> +            VDD1-supply = <&supply3v3>;
> +            VDD2-supply = <&supply3v3>;
> +            VCCAD1-supply = <&supply5v0>;
> +            VCCAD2-supply = <&supply5v0>;
> +            VCCDA1-supply = <&supply5v0>;
> +            VCCDA2-supply = <&supply5v0>;

Can you extend the example with dai cells or with endpoints (or both,
depending on my previous comment...)

> +        };
> +    };

Best regards,
Krzysztof
Geert Uytterhoeven Dec. 5, 2022, 8 a.m. UTC | #2
Hi Krzysztof,

Thanks for your comments!

On Sat, Dec 3, 2022 at 1:13 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
> On 02/12/2022 13:55, Geert Uytterhoeven wrote:
> > Convert the Texas Instruments PCM3168A Audio Codec Device Tree binding
> > documentation to json-schema.
> >
> > Add missing properties.
> > Drop unneeded pinctrl properties from example.
>
> Thank you for your patch. There is something to discuss/improve.
>
> > +description:
> > +  The Texas Instruments PCM3168A is a 24-bit Multi-channel Audio CODEC with
> > +  96/192kHz sampling rate, supporting both SPI and I2C bus access.
> > +
> > +properties:
> > +  compatible:
> > +    const: ti,pcm3168a
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    items:
> > +      - description: System clock input
> > +
> > +  clock-names:
> > +    items:
> > +      - const: scki
> > +
> > +  reset-gpios:
> > +    items:
> > +      - description: |
> > +          GPIO line connected to the active-low RST pin of the codec.
> > +            RST = low: device power-down
> > +            RST = high: device is enabled
> > +
> > +  "#sound-dai-cells":
> > +    enum: [0, 1]
>
> This is a bit unexpected. Looking at DTSes:
> 1. I see in ulcb-kf.dtsi with cells==0, but two endpoints. The dai cells
> seem unused? In such case shall dai-cells be skipped if we have endpoints?
>
> 2. in k3-j721e-common-proc-board.dts has cells=1, but user's phandle
> does not have an argument, so practically it is ==0? The user -
> sound/soc/ti/j721e-evm.c - just gets the node and does not use cells,
> right? So even though dai-cells==1, it does not matter, because user
> gets its own parsing?
>
> 3. The pcm3168a driver also does not have any xlate function, but it
> registers to DAIs, so all uses should be with cells==1 to select proper
> DAI...

I have no idea (DAI is magic to me), and hope the audio experts
can provide some input...
Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Krzysztof Kozlowski Dec. 6, 2022, 9:16 a.m. UTC | #3
On 05/12/2022 09:00, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> Thanks for your comments!
> 
> On Sat, Dec 3, 2022 at 1:13 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@linaro.org> wrote:
>> On 02/12/2022 13:55, Geert Uytterhoeven wrote:
>>> Convert the Texas Instruments PCM3168A Audio Codec Device Tree binding
>>> documentation to json-schema.
>>>
>>> Add missing properties.
>>> Drop unneeded pinctrl properties from example.
>>
>> Thank you for your patch. There is something to discuss/improve.
>>
>>> +description:
>>> +  The Texas Instruments PCM3168A is a 24-bit Multi-channel Audio CODEC with
>>> +  96/192kHz sampling rate, supporting both SPI and I2C bus access.
>>> +
>>> +properties:
>>> +  compatible:
>>> +    const: ti,pcm3168a
>>> +
>>> +  reg:
>>> +    maxItems: 1
>>> +
>>> +  clocks:
>>> +    items:
>>> +      - description: System clock input
>>> +
>>> +  clock-names:
>>> +    items:
>>> +      - const: scki
>>> +
>>> +  reset-gpios:
>>> +    items:
>>> +      - description: |
>>> +          GPIO line connected to the active-low RST pin of the codec.
>>> +            RST = low: device power-down
>>> +            RST = high: device is enabled
>>> +
>>> +  "#sound-dai-cells":
>>> +    enum: [0, 1]
>>
>> This is a bit unexpected. Looking at DTSes:
>> 1. I see in ulcb-kf.dtsi with cells==0, but two endpoints. The dai cells
>> seem unused? In such case shall dai-cells be skipped if we have endpoints?
>>
>> 2. in k3-j721e-common-proc-board.dts has cells=1, but user's phandle
>> does not have an argument, so practically it is ==0? The user -
>> sound/soc/ti/j721e-evm.c - just gets the node and does not use cells,
>> right? So even though dai-cells==1, it does not matter, because user
>> gets its own parsing?
>>
>> 3. The pcm3168a driver also does not have any xlate function, but it
>> registers to DAIs, so all uses should be with cells==1 to select proper
>> DAI...
> 
> I have no idea (DAI is magic to me), and hope the audio experts
> can provide some input...

It is a bit of magic to me too. Yet I think the correct usage of this is
with dai-cells=1. I think we can skip the choice here between
sound-dai-cells and endpoints (to allow only one) and only fix the value
here to =1.

This would also require changing
arch/arm64/boot/dts/renesas/ulcb-kf.dtsi to dai-cells=1.

Best regards,
Krzysztof