diff mbox series

[V2,1/2] ASoC: dt-bindings: audio-graph-port: Add dai-tdm-slot-width-map

Message ID 20220217134835.282389-2-rf@opensource.cirrus.com
State Changes Requested, archived
Headers show
Series ASoC: audio_graph_card2: Support variable slot widths | expand

Checks

Context Check Description
robh/patch-applied success
robh/checkpatch success
robh/dtbs-check success
robh/dt-meta-schema success

Commit Message

Richard Fitzgerald Feb. 17, 2022, 1:48 p.m. UTC
Some audio hardware cannot support a fixed slot width or a slot width
equal to the sample width in all cases. This is usually due either to
limitations of the audio serial port or system clocking restrictions.

This property allows setting a mapping of sample widths and the
corresponding tdm slot widths.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 .../devicetree/bindings/sound/audio-graph-port.yaml        | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Rob Herring Feb. 24, 2022, 10:10 p.m. UTC | #1
On Thu, Feb 17, 2022 at 01:48:34PM +0000, Richard Fitzgerald wrote:
> Some audio hardware cannot support a fixed slot width or a slot width
> equal to the sample width in all cases. This is usually due either to
> limitations of the audio serial port or system clocking restrictions.
> 
> This property allows setting a mapping of sample widths and the
> corresponding tdm slot widths.
> 
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> ---
>  .../devicetree/bindings/sound/audio-graph-port.yaml        | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
> index 476dcb49ece6..420adad49382 100644
> --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
> +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
> @@ -71,4 +71,11 @@ patternProperties:
>          description: CPU to Codec rate channels.
>          $ref: /schemas/types.yaml#/definitions/uint32
>  
> +      dai-tdm-slot-width-map:
> +        description: Mapping of sample widths to slot widths. For hardware that
> +          cannot support a fixed slot width or a slot width equal to sample

A variable slot width sounds like a feature, not a limitation.

> +          width. An array containing one or more pairs of values. Each pair
> +          of values is a sample_width and the corresponding slot_width.

That sounds like a matrix, not an array. N entries of 2 cells each. 

> +        $ref: /schemas/types.yaml#/definitions/uint32-array
> +

I'd think there are some constraints on the values? Slots should be at 
least 8 bits, right? A max of 2x32 bits or is there more 
than stereo within a slot? In any case, it's for sure no where near 2^32 
max.

Is there a need for specifying where in the slot the data is?

Rob
Richard Fitzgerald Feb. 25, 2022, 12:08 p.m. UTC | #2
On 24/02/2022 22:10, Rob Herring wrote:
> On Thu, Feb 17, 2022 at 01:48:34PM +0000, Richard Fitzgerald wrote:
>> Some audio hardware cannot support a fixed slot width or a slot width
>> equal to the sample width in all cases. This is usually due either to
>> limitations of the audio serial port or system clocking restrictions.
>>
>> This property allows setting a mapping of sample widths and the
>> corresponding tdm slot widths.
>>
>> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
>> ---
>>   .../devicetree/bindings/sound/audio-graph-port.yaml        | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> index 476dcb49ece6..420adad49382 100644
>> --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
>> @@ -71,4 +71,11 @@ patternProperties:
>>           description: CPU to Codec rate channels.
>>           $ref: /schemas/types.yaml#/definitions/uint32
>>   
>> +      dai-tdm-slot-width-map:
>> +        description: Mapping of sample widths to slot widths. For hardware that
>> +          cannot support a fixed slot width or a slot width equal to sample
> 
> A variable slot width sounds like a feature, not a limitation.
> 

Depends on point of view. Most interfaces allow setting a fixed slot
width but in some cases that's not possible so it is more likely to be
seen as a limitation. It is however a feature in the sense that it can
avoid using higher frequencies that are necessary.

>> +          width. An array containing one or more pairs of values. Each pair
>> +          of values is a sample_width and the corresponding slot_width.
> 
> That sounds like a matrix, not an array. N entries of 2 cells each.
> 
>> +        $ref: /schemas/types.yaml#/definitions/uint32-array
>> +
> 
> I'd think there are some constraints on the values? Slots should be at
> least 8 bits, right? A max of 2x32 bits or is there more

True. I didn't think it was appropriate for a generic binding to enforce
a range when that depends on the exact hardware. But if you want I can
enforce a range that's likely to be true for all hardware.

> than stereo within a slot? In any case, it's for sure no where near 2^32
> max.

One sample per slot.

> 
> Is there a need for specifying where in the slot the data is?

I don't believe so, all the protocols I know of have the data bits
transmitted first followed by padding. There's no harm adding a
reserved field to allow for this info if it is ever needed, but it would
be unused at present as there's no kernel API to do this.

> 
> Rob
>
Mark Brown Feb. 25, 2022, 8:40 p.m. UTC | #3
On Fri, Feb 25, 2022 at 12:08:00PM +0000, Richard Fitzgerald wrote:
> On 24/02/2022 22:10, Rob Herring wrote:

> > Is there a need for specifying where in the slot the data is?

> I don't believe so, all the protocols I know of have the data bits
> transmitted first followed by padding. There's no harm adding a
> reserved field to allow for this info if it is ever needed, but it would
> be unused at present as there's no kernel API to do this.

It's part of the general format for the bus I'd say.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
index 476dcb49ece6..420adad49382 100644
--- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
+++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
@@ -71,4 +71,11 @@  patternProperties:
         description: CPU to Codec rate channels.
         $ref: /schemas/types.yaml#/definitions/uint32
 
+      dai-tdm-slot-width-map:
+        description: Mapping of sample widths to slot widths. For hardware that
+          cannot support a fixed slot width or a slot width equal to sample
+          width. An array containing one or more pairs of values. Each pair
+          of values is a sample_width and the corresponding slot_width.
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+
 additionalProperties: true