* [PATCH] ASoC: SDCA: skip port channel mask for Output Terminals
@ 2026-11-23 16:56 Srinivas Kandagatla
2026-11-23 17:21 ` Charles Keepax
0 siblings, 1 reply; 3+ messages in thread
From: Srinivas Kandagatla @ 2026-11-23 16:56 UTC (permalink / raw)
To: Charles Keepax, Mark Brown
Cc: Pierre-Louis Bossart, Vinod Koul, Bard Liao, linux-sound,
linux-kernel, Srinivas Kandagatla
Commit 8bb24d87078f ("ASoC: SDCA: Add port constraints into
sdca_asoc_set_constraints()") started intersecting the DAI channel
mask with the SoundWire DP port min_ch/max_ch for both Input and
Output Terminals, installed via snd_pcm_hw_constraint_list() from
startup().
In DPCM dpcm_be_dai_startup() aliases be_substream->runtime to
fe_substream->runtime, so the per-substream rule lands on the FE
and narrows its hw_refine().
For Output Terminals the port sits below the DSP capture graph,
which can present an FE PCM with a channel count different from
the wire. WCD9378's headset mic is single-channel on DP2 but is
exposed as a stereo FE capture by Qualcomm LPASS; port_ch_mask is
0x1 and any arecord with channels_min > 1 fails with "Slave PCM
not usable".
Only intersect with port_ch_mask for Input Terminals and leave
Output Terminals on the cluster mask, restoring the behaviour
there to what it was before 8bb24d87078f.
Fixes: 8bb24d87078f ("ASoC: SDCA: Add port constraints into sdca_asoc_set_constraints()")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
sound/soc/sdca/sdca_asoc.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
index aaa84156f20a..6e42f5262aa7 100644
--- a/sound/soc/sdca/sdca_asoc.c
+++ b/sound/soc/sdca/sdca_asoc.c
@@ -1645,7 +1645,14 @@ int sdca_asoc_set_constraints(struct device *dev, struct sdw_slave *sdw,
constraints->channels.count = ARRAY_SIZE(channel_list);
constraints->channels.list = channel_list;
- constraints->channels.mask = cluster_ch_mask & port_ch_mask;
+ /*
+ * OT paths may re-channelize downstream of the port, so only
+ * narrow with port_ch_mask for Input Terminals.
+ */
+ if (entity->type == SDCA_ENTITY_TYPE_IT)
+ constraints->channels.mask = cluster_ch_mask & port_ch_mask;
+ else
+ constraints->channels.mask = cluster_ch_mask;
if (!constraints->channels.mask || !constraints->width) {
dev_err(dev, "%s: no valid constraint masks channel: %#x,%#x width: %#llx\n",
base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: SDCA: skip port channel mask for Output Terminals
2026-11-23 16:56 [PATCH] ASoC: SDCA: skip port channel mask for Output Terminals Srinivas Kandagatla
@ 2026-11-23 17:21 ` Charles Keepax
2026-11-25 17:41 ` Charles Keepax
0 siblings, 1 reply; 3+ messages in thread
From: Charles Keepax @ 2026-11-23 17:21 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Mark Brown, Pierre-Louis Bossart, Vinod Koul, Bard Liao,
linux-sound, linux-kernel
On Mon, Nov 23, 2026 at 04:56:12PM +0000, Srinivas Kandagatla wrote:
> Commit 8bb24d87078f ("ASoC: SDCA: Add port constraints into
> sdca_asoc_set_constraints()") started intersecting the DAI channel
> mask with the SoundWire DP port min_ch/max_ch for both Input and
> Output Terminals, installed via snd_pcm_hw_constraint_list() from
> startup().
>
> In DPCM dpcm_be_dai_startup() aliases be_substream->runtime to
> fe_substream->runtime, so the per-substream rule lands on the FE
> and narrows its hw_refine().
>
> For Output Terminals the port sits below the DSP capture graph,
> which can present an FE PCM with a channel count different from
> the wire. WCD9378's headset mic is single-channel on DP2 but is
> exposed as a stereo FE capture by Qualcomm LPASS; port_ch_mask is
> 0x1 and any arecord with channels_min > 1 fails with "Slave PCM
> not usable".
>
> Only intersect with port_ch_mask for Input Terminals and leave
> Output Terminals on the cluster mask, restoring the behaviour
> there to what it was before 8bb24d87078f.
Ah the joys of DPCM. It feels problematic that the backend
constraints are duplicated to the frontend, when a significant
part of of DPCM is that these can differ.
The "correct" fix here is probably a bit of DPCM working,
although not sure how significant that ends up being. I have not
spent a lot of time working on DPCM.
> Fixes: 8bb24d87078f ("ASoC: SDCA: Add port constraints into sdca_asoc_set_constraints()")
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> ---
> sound/soc/sdca/sdca_asoc.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/sdca/sdca_asoc.c b/sound/soc/sdca/sdca_asoc.c
> index aaa84156f20a..6e42f5262aa7 100644
> --- a/sound/soc/sdca/sdca_asoc.c
> +++ b/sound/soc/sdca/sdca_asoc.c
> @@ -1645,7 +1645,14 @@ int sdca_asoc_set_constraints(struct device *dev, struct sdw_slave *sdw,
>
> constraints->channels.count = ARRAY_SIZE(channel_list);
> constraints->channels.list = channel_list;
> - constraints->channels.mask = cluster_ch_mask & port_ch_mask;
> + /*
> + * OT paths may re-channelize downstream of the port, so only
> + * narrow with port_ch_mask for Input Terminals.
> + */
If we do have to run with this for a temporary fix, this should
really have a FIXME, this should apply to both. There is no SDCA
concept that these only apply to ITs, we are just working around
DPCM here.
Apologies I probably should have CCed you on the series, I
endeavour to do so in the future. I will also try to find some
cycles over the next couple days to have a bit more of dive
into this.
Thanks,
Charles
> + if (entity->type == SDCA_ENTITY_TYPE_IT)
> + constraints->channels.mask = cluster_ch_mask & port_ch_mask;
> + else
> + constraints->channels.mask = cluster_ch_mask;
>
> if (!constraints->channels.mask || !constraints->width) {
> dev_err(dev, "%s: no valid constraint masks channel: %#x,%#x width: %#llx\n",
>
> base-commit: 909ef7a9a30fa139e69e555e3606680f5cca7726
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: SDCA: skip port channel mask for Output Terminals
2026-11-23 17:21 ` Charles Keepax
@ 2026-11-25 17:41 ` Charles Keepax
0 siblings, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2026-11-25 17:41 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: Mark Brown, Pierre-Louis Bossart, Vinod Koul, Bard Liao,
linux-sound, linux-kernel
On Mon, Nov 23, 2026 at 05:21:53PM +0000, Charles Keepax wrote:
> On Mon, Nov 23, 2026 at 04:56:12PM +0000, Srinivas Kandagatla wrote:
> > Only intersect with port_ch_mask for Input Terminals and leave
> > Output Terminals on the cluster mask, restoring the behaviour
> > there to what it was before 8bb24d87078f.
>
> Ah the joys of DPCM. It feels problematic that the backend
> constraints are duplicated to the frontend, when a significant
> part of of DPCM is that these can differ.
>
> The "correct" fix here is probably a bit of DPCM working,
> although not sure how significant that ends up being. I have not
> spent a lot of time working on DPCM.
Quite tricky this, at least on the DPCM systems I have (Intel
based) the primary CPU side DAI ops seem to live on the backend
DAIs. So likely we really do want the backends to use the same
runtime, but that makes it quite hard to know what to do with
those constraints.
The params on the DAI driver are folded into the
snd_pcm_hardware struct, so maybe we could update that rather
than using a constraint in the class driver. The DPCM core then
has flags to decide whether to process the backend codec DAI
drivers. This also comes with limitations that it only handles
min/max.
Or maybe we could do something like an ASoC wrapper for the
constraint functions that no-ops if it is on a DPCM backend.
Both of those approaches do have the slight ick they basically
require you to do special things in the codec driver for DPCM
which feels like it should be transparent to the codec driver
though.
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-25 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23 16:56 [PATCH] ASoC: SDCA: skip port channel mask for Output Terminals Srinivas Kandagatla
2026-11-23 17:21 ` Charles Keepax
2026-11-25 17:41 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®