Re: [PATCH v2 02/24] ASoC: soc-pcm: add multi_direction_codecs link flag
From: Pierre-Louis Bossart
Date: Mon Nov 23 2026 - 09:00:15 EST
>>> +Typical use case: a smart-amp speaker protection link where the CPU
>>> +side is a playback-only DMA (e.g. ``WSA_CODEC_DMA_RX_0`` on Qualcomm
>>> +AudioReach), but the codec side exposes both a playback SPKR DAI and a
>>> +companion capture V/I-sense DAI on the same SoundWire bus. Opening the
>>> +playback FE should bring up both the amplifier output chain *and* its
>>> +V/I feedback capture chain atomically, without userspace having to open
>>> +a secondary PCM.
>>
>> This is a valid use case that has been problematic for some time on
>> other platform as well.
>>
>> What puzzles me in your approach is that the codec-side will be
>> configured/started, but *something* will need to grab/process the
>> feedback IV data generated by the codec DAI. That part seems to be
>> completely hidden in your approach, is this intentional? How would a
>> capture DAI be configured on the CPU side so that the data is provided
>
> In this setup there is no capture codec cpu dai. The capture data is
> never seen by the userspace. VI Feeback data is directly feed into
> Speaker Protection module within the DSP using the codec-to-codec setup.
Humm, even if there's no user-space visibility, don't you have a
SoundWire capture port? How would that be configured? At the very least
it should be prepared and enabled.
> Host only drives the playback data and the VI feedback path is entirely
> with-in the DSP.
>
>> to a DSP? Some of the patches, e.g. 11/24, mention a capture dai but I
>> can't connect the dots with the suggested codec-dai changes.
>>
>> In addition the feedback loop can be made of not only I/V sense but may
>> also carry an echo reference, and that may have to go all the way to
>> userspace depending on where the processing is handled, possibly with a
>> split between IV sense and echo reference making the topology even more
>> complex.
>
> multi_direction_flag is really agnostic to driving data(VI or echo
> reference)
> All this flag is doing is setting up the codec which are configured in
> opposite direction.
but the configuration of the capture part is missing entirely, no?
>> And last the SoundWire core exposes a concept of 'stream' that is single
>> direction, and so far we've used a 1:1 mapping between dailinks and
>> streams. If part of the dailink is dual-direction, don't we have a
>> problem on the SoundWire side?
>
> 04 patch addresses this, we create two separate runtime streams per
> direction instead of one.
ok, that should be made clearer in the introduction, which mentions
codec dais but omits the gory details of SoundWire management.
I have mixed feelings about having 2 streams. It 'works' but it's not
optimal. Maybe it's time to revisit and extend this concept to deal with
data that's closely related to the regular PCM data but flowing to
another direction and used for a specific purpose.
There's the case of the IV sense, but also the companion amp which may
require a device-to-device communication scheme. It would be much better
if all the prepare was done in one shot for all the direction/ports used
for a given use case, and likewise the enable should be done with a
single bank switch. Not to mention that this sort of solution should be
handled at the SoundWire core level, so that we don't have to implement
this dual-stream implementation for every platform.