From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 3/3] ASoC: SDCA: Add port constraints into sdca_asoc_set_constraints()
Date: Mon, 9 Nov 2026 16:58:05 +0000 [thread overview]
Message-ID: <avH7nS1si7dxs/60@opensource.cirrus.com> (raw)
In-Reply-To: <sashiko-outbox-205218@kernel.org>
On Mon, Nov 09, 2026 at 04:16:52PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [High] ASoC: SDCA: zero word_mask in get_port_masks() when wordlengths
> are unset
> - [Medium] ASoC: SDCA: 1-channel port_ch_mask in get_port_masks() when
> min_ch/max_ch are 0
> --
> > + for (i = 0; i < nprop; i++) {
> > + if (prop[i].num != port)
> > + continue;
> > +
> > + if (prop[i].num_words) {
> > + for (j = 0; j < prop[i].num_words; j++)
> > + *word_mask |= get_word_mask(prop[i].words[j]);
> > + } else {
> > + for (j = prop[i].min_word; j <= prop[i].max_word; j++)
> > + *word_mask |= get_word_mask(j);
> > + }
>
> [Severity: High]
> Does get_port_masks() leave *word_mask as 0 when a port does not specify
> wordlength properties?
>
> The MIPI DisCo wordlength properties are optional, and drivers such as
> wcd9378_sdca_read_prop() leave num_words, min_word, and max_word as 0.
> When all three are 0, the else loop runs once with j = 0, get_word_mask(0)
> returns 0, and sdca_asoc_set_constraints() fails PCM startup with -EINVAL
> because constraints->width is 0.
Argh... sorry I had this in but then it got lost when I moved
over to FORMAT instead of sample bits.
> > +
> > + /* Only handle the number of channels for constraints. */
> > + if (prop[i].num_ch_combinations) {
> > + for (j = 0; j < prop[i].num_ch_combinations; j++)
> > + *ch_mask |= BIT(hweight32(prop[i].ch_combinations[j]) - 1);
> > + } else if (prop[i].num_channels) {
> > + *ch_mask = GENMASK(prop[i].num_channels - 1, 0);
> > + } else {
> > + *ch_mask = GENMASK(prop[i].max_ch - prop[i].min_ch, 0);
> > + }
>
> [Severity: Medium]
> As reported by Mark Brown on v2 [1], does this restrict *ch_mask to a
> single channel (GENMASK(0, 0) == 0x1) when the optional channel properties
> (num_ch_combinations, num_channels, max_ch, and min_ch) are all 0? That
> constrains the DAI to 1 channel instead of leaving the port channel count
> unconstrained, and causes sdca_asoc_set_constraints() to fail with -EINVAL
> if the terminal cluster only supports multi-channel configurations.
>
> [1] https://lore.kernel.org/r/179413707633.3630016.13654136728294242171.b4-review@b4
This one can't be fixed locally the problem is min_ch and max_ch
are channel indexes. So both set to zero is a totally valid
setup. I have a patch for soundwire that applies the defaults
there was probably going to send that up tomorrow. But could pull
it in to this chain if we felt strongly on it.
Thanks,
Charles
prev parent reply other threads:[~2026-11-09 16:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 15:51 [PATCH v3 0/3] Add SoundWire port constraints into SDCA stream Charles Keepax
2026-11-09 15:51 ` [PATCH v3 1/3] ASoC: SDCA: Move DAI constraint allocation Charles Keepax
2026-11-09 15:51 ` [PATCH v3 2/3] ASoC: SDCA: Factor out helper for creating mask of Cluster channels Charles Keepax
2026-11-09 15:51 ` [PATCH v3 3/3] ASoC: SDCA: Add port constraints into sdca_asoc_set_constraints() Charles Keepax
2026-11-09 16:16 ` sashiko-bot
2026-11-09 16:58 ` Charles Keepax [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avH7nS1si7dxs/60@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=linux-sound@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox