Re: [PATCH v2 3/3] ASoC: SDCA: Add port constraints into sdca_asoc_set_constraints()

From: Charles Keepax

Date: Mon Nov 09 2026 - 07:59:11 EST


On Sun, Nov 08, 2026 at 11:24:36AM +0000, Mark Brown wrote:
> > Currently the SDCA code constrains the params based on the DisCo for
> > the SDCA Terminal used. However, it ignores the properties of the
> > SoundWire port, which in some cases may further constrain the allowed
> > params. Add additional constraints to apply these restrictions.
>
>
> > +static int get_port_masks(struct sdw_slave *sdw, unsigned int port,
> > + struct snd_pcm_substream *substream,
> > + unsigned int *word_mask, unsigned int *ch_mask)
> > +{
>
> > +
> > + 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 |= BIT(prop[i].words[j] - 1);
>
> The shifting would be broken if there were ever any 32 bit Soundwire
> systems, and I guess we might get warnings on coverage builds.

The minus one should cover us for up to 32-bit audio, although
technically the soundwire spec does allow upto 64-bit audio.
Pretty niche but I will add an if to skip things if the bit
depth is too big probably better to be safe.

Thanks,
Charles