diff mbox series

[5/6] dt-bindings: tlv320adcx140: Add slot programming property

Message ID 20200915190606.1744-5-dmurphy@ti.com (mailing list archive)
State New, archived
Headers show
Series [1/6] ASoC: tlv320adcx140: Idle the device while writing registers | expand

Commit Message

Dan Murphy Sept. 15, 2020, 7:06 p.m. UTC
Add a property to configure the each channel to a specific TDM slot.

Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
 .../bindings/sound/tlv320adcx140.yaml          | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Mark Brown Sept. 17, 2020, 1:02 p.m. UTC | #1
On Tue, Sep 15, 2020 at 02:06:05PM -0500, Dan Murphy wrote:

> +  ti,slot-mapping:
> +    type: boolean
> +    description: |
> +      Each channel can be assigned a specific TDM slot for either a left or
> +      right channel. The left channel values are from 0-31d and the right
> +      channel values are from 32-63d. If the right channel value is 32 then the
> +      right channel slot will be slot 31.
> +      The array index is sequential audio channel to be set.
> +      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
> +      If the channel is not to be used then the channel should be set to it's
> +      default value.

This is something I'd expect to be done by the machine driver rather
than in the CODEC specific DT bindings, and apart from anything else
everything involved in the DAI will need to agree on the mapping so this
doesn't look like something that should be done in a device specific
binding.
Dan Murphy Sept. 17, 2020, 3:15 p.m. UTC | #2
Mark

On 9/17/20 8:02 AM, Mark Brown wrote:
> On Tue, Sep 15, 2020 at 02:06:05PM -0500, Dan Murphy wrote:
>
>> +  ti,slot-mapping:
>> +    type: boolean
>> +    description: |
>> +      Each channel can be assigned a specific TDM slot for either a left or
>> +      right channel. The left channel values are from 0-31d and the right
>> +      channel values are from 32-63d. If the right channel value is 32 then the
>> +      right channel slot will be slot 31.
>> +      The array index is sequential audio channel to be set.
>> +      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
>> +      If the channel is not to be used then the channel should be set to it's
>> +      default value.
> This is something I'd expect to be done by the machine driver rather
> than in the CODEC specific DT bindings, and apart from anything else
> everything involved in the DAI will need to agree on the mapping so this
> doesn't look like something that should be done in a device specific
> binding.

Here is the use case from our customers

Customers need the ability to not transmit on a TDM slot, since another 
device could be using the slot.
For example, the customer has an amp and dig microphone sharing one TDM 
bus. The amp uses slot 0 while dig microphone use slots 1-3.
In another example, customers use 2 dig microphones. One device 
transmits on slots 0-3, the second device transmits on slots 4-7.
In a third example, customers use 4 dig microphones. Device 1 uses Slots 
0-3, Device 2 uses Slots 4-7, Device 3 uses Slots 8-11, and Device 4 
uses Slots 12-15.

The dai-tdm-slot-num would be a good candidate to add to the sound card 
to define the slot number but it's definition is "Number of slots in 
use." So it is not really setting the needed slot.
I am not finding any good way to assign specific slots to specific channels.

I can add DAI slot numbering parameter for specific codecs.

Dan
Mark Brown Sept. 17, 2020, 3:56 p.m. UTC | #3
On Thu, Sep 17, 2020 at 10:15:27AM -0500, Dan Murphy wrote:
> On 9/17/20 8:02 AM, Mark Brown wrote:

> > This is something I'd expect to be done by the machine driver rather
> > than in the CODEC specific DT bindings, and apart from anything else

> Customers need the ability to not transmit on a TDM slot, since another
> device could be using the slot.

TDM is not an issue, we already have the set_tdm_slot() API.  The issue
is how you're configuring it.

> The dai-tdm-slot-num would be a good candidate to add to the sound card to
> define the slot number but it's definition is "Number of slots in use." So
> it is not really setting the needed slot.
> I am not finding any good way to assign specific slots to specific channels.

If the generic features are not sufficent then please extend the generic
features rather than bodging around them in individual drivers.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
index e79f8d1891e4..dfc00308da94 100644
--- a/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
+++ b/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml
@@ -114,6 +114,24 @@  properties:
       When set the device will set the Tx ASI output to a Hi-Z state for unused
       data cycles. Default is to drive the output low on unused ASI cycles.
 
+  ti,slot-mapping:
+    type: boolean
+    description: |
+      Each channel can be assigned a specific TDM slot for either a left or
+      right channel. The left channel values are from 0-31d and the right
+      channel values are from 32-63d. If the right channel value is 32 then the
+      right channel slot will be slot 31.
+      The array index is sequential audio channel to be set.
+      [ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8]
+      If the channel is not to be used then the channel should be set to it's
+      default value.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 8
+    items:
+      maximum: 63
+    default: [0, 1, 2, 3, 4, 5, 6, 7]
+
 patternProperties:
   '^ti,gpo-config-[1-4]$':
     $ref: /schemas/types.yaml#/definitions/uint32-array