Re: [PATCH 13/13] ASoC: ti: davinci-i2s: Opitonally drive DX pin during capture streams
From: Péter Ujfalusi
Date: Wed Mar 20 2024 - 11:40:33 EST
Hi Bastien,
On 20/03/2024 10:52, Bastien Curutchet wrote:
> Hi Péter,
>
> On 3/19/24 19:29, Péter Ujfalusi wrote:
>>
>>
>> On 15/03/2024 13:27, Bastien Curutchet wrote:
>>> The McBSP's DX pin that outputs serial data during playback streams can
>>> be used during capture streams to repeatedly output a chosen pattern.
>>> For instance, this can be useful to drive an active-low signal during
>>> captures (by choosing <0> as output pattern).
>>
>> Are there really any other use of this than to pull down or up the DX
>> pin (0 or 0xffff)
>
> I don't know, indeed today I can only think about these two patterns.
> I tried to do something in a 'generic' way so it can evolve if needed.
I think the definition of the 'ti,drive-dx' is somehow odd. It allows
you to set it to 0x1234 and the DX pin will show 0x1234 when you capture
32bit. If you capture 16bit then it will transmit 0x12 (or 0x34?), no?
If you have 4 channel capture then I won't speculate what will be on the
DX pin ;)
Would not be better to say that the DX pin will be driven low or high
during capture _and_ disable the playback support?
>
>> If you just use the pin as GPIO then you don't need to change anything
>> in the driver, The playback would not erach the pin, so no need to
>> block it.
>>
>>> Enable this behaviour when the device-tree property 'ti,drive-dx' is
>>> present. DX pin is driven with the provided pattern every time a
>>> capture stream is launched.
>>
>> It is an interesting use of the hardware... You are controlling an
>> external device (light an LED when capture is on)?
>
> Yes I control the chip select pin of the ADC that is sending data to DR
> pin, that's why I need the DX pin to be synchronized with capture
> streams.
I see. Still a a novel use of a feature ;)
>
>>> This property is not compatible with classic playback stream so
>>> davinci_i2s_trigger() returns an error if a playback stream is started
>>> while 'ti,drive-dx' flag is present.
>>
>> Propbaly add the .startup() callback and block the playback right there?
>>
>
> Ok, TBH my mastery of the sound subsystem is not high enough to have an
> opinion of where this should go so I'll trust you on this.
It would be more elegant to only create PCM for the capture in this
case, but I would not bother with it.
Stopping user right at startup time is second better.
>>>
>>> This has been tested on a board designed of a DAVINCI/OMAP-L138 where
>>> the DX pin is linked to the chip select pin of the converters of the
>>> capture side.
>>
>> Isn't the DX will be pulled down as soon as the McBSP is enabled?
>> Can you just re-configure the PUPD_SEL for the pin group to make the pin
>> to be pulled the other way?
>>
>
> Well, the acquisition chain in my use case is a bit convoluted. The DX
> pin's main purpose is to drive ADC chip select but it is also connected
> to other components and all this needs synchronization upon captures.
OK, thanks for the explanation.
--
Péter