[PATCH v2 2/3] ASoC: dt-bindings: Add sample format conversion

Sameer Pujar spujar at nvidia.com
Thu Aug 4 13:09:24 CEST 2022


On 02-08-2022 20:20, Rob Herring wrote:
> On Mon, Aug 01, 2022 at 09:37:31PM +0530, Sameer Pujar wrote:
>> Presently "convert-channels" and "convert-rate" DT bindings are available
>> for channel and rate fixups respectively.
>>
>> Similarly add "convert-sample-format" binding to fixup DAI sample format
>> as well. This is added to simple-card and audio-graph based sound cards.
> Do you have users for both cases?

I don't plan to use simple-card. Just added for consistency. Will drop this.

It would be required for audio-graph.

>
>> Signed-off-by: Sameer Pujar<spujar at nvidia.com>
>> Cc: Kuninori Morimoto<kuninori.morimoto.gx at renesas.com>
>> ---
>>   Documentation/devicetree/bindings/sound/audio-graph-port.yaml |  4 ++++
>>   Documentation/devicetree/bindings/sound/audio-graph.yaml      |  2 ++
>>   Documentation/devicetree/bindings/sound/dai-params.yaml       | 10 ++++++++++
>>   Documentation/devicetree/bindings/sound/simple-card.yaml      |  4 ++++
>>   4 files changed, 20 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> index 30a644d9..8e64192 100644
>> --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> @@ -22,6 +22,8 @@ properties:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate"
>>     convert-channels:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels"
>> +  convert-sample-format:
>> +    $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format"
>>
>>   patternProperties:
>>     "^endpoint(@[0-9a-f]+)?":
>> @@ -67,6 +69,8 @@ patternProperties:
>>           $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate"
>>         convert-channels:
>>           $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels"
>> +      convert-sample-format:
>> +        $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format"
>>
>>         dai-tdm-slot-width-map:
>>           description: Mapping of sample widths to slot widths. For hardware
>> diff --git a/Documentation/devicetree/bindings/sound/audio-graph.yaml b/Documentation/devicetree/bindings/sound/audio-graph.yaml
>> index a9cd52e..93ddd55 100644
>> --- a/Documentation/devicetree/bindings/sound/audio-graph.yaml
>> +++ b/Documentation/devicetree/bindings/sound/audio-graph.yaml
>> @@ -30,6 +30,8 @@ properties:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate"
>>     convert-channels:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels"
>> +  convert-sample-format:
>> +    $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-format"
> Can someone explain why we need these properties defined in 3 different
> locations? That's not a great pattern to continue.

The properties are defined at sound card, port and endpoint node level. 
I guess the idea is to selectively apply a configuration to a group of 
endpoints/ports or just specific endpoint. Morimoto-san can comment if 
there are other reasons to do so.

>>     pa-gpios:
>>       maxItems: 1
>> diff --git a/Documentation/devicetree/bindings/sound/dai-params.yaml b/Documentation/devicetree/bindings/sound/dai-params.yaml
>> index aae60cb..933957d 100644
>> --- a/Documentation/devicetree/bindings/sound/dai-params.yaml
>> +++ b/Documentation/devicetree/bindings/sound/dai-params.yaml
>> @@ -19,6 +19,16 @@ properties:
>>       minimum: 1
>>       maximum: 32
>>
>> +  dai-sample-format:
>> +    description: Audio sample format used by DAI
>> +    $ref: /schemas/types.yaml#/definitions/string
>> +    enum:
>> +      - s8
>> +      - s16_le
>> +      - s24_le
>> +      - s24_3le
>> +      - s32_le
>> +
>>     dai-sample-rate:
>>       description: Audio sample rate used by DAI
>>       $ref: /schemas/types.yaml#/definitions/uint32
>> diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml
>> index ab03a2b..ec21190 100644
>> --- a/Documentation/devicetree/bindings/sound/simple-card.yaml
>> +++ b/Documentation/devicetree/bindings/sound/simple-card.yaml
>> @@ -183,6 +183,8 @@ properties:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-sample-rate"
>>     simple-audio-card,convert-channels:
>>       $ref: "/schemas/sound/dai-params.yaml#/properties/dai-channels"
>> +  simple-audio-card,convert-sample-format:
> Don't add more properties with 'simple-audio-card,' prefix. That's not a
> pattern we want to be consistent with...

Will drop this in next revision.


More information about the Alsa-devel mailing list