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

From: Charles Keepax

Date: Fri Nov 06 2026 - 04:36:28 EST


On Thu, Nov 05, 2026 at 08:49:43PM +0100, Pierre-Louis Bossart wrote:
>
> > +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)
> > +{
> > + struct sdw_dpn_prop *prop;
> > + unsigned int nprop;
> > + int i, j;
> > +
> > + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> > + prop = sdw->prop.sink_dpn_prop;
> > + nprop = hweight32(sdw->prop.sink_ports);
> > + } else {
> > + prop = sdw->prop.src_dpn_prop;
> > + nprop = hweight32(sdw->prop.source_ports);
> > + }
>
> The definition of those DisCo properties was done with separate masks
> for source and sinks, but it's allowed to have the same bit set for
> source and sink if the port supports bi-directional transfers.
>
> I don't think it impacts the way the constraints are added, since you
> use substream->stream direction to disambiguate, but I thought I'd ask
> the question.

Yeah I think this mostly all works out. ALSA separates the capture
and playback streams, and this stuff is called from the DAI ops.

>
> > - if (entity->type != SDCA_ENTITY_TYPE_IT)
> > - return 0;
> > + /* FIXME: Currently only a single unshared port is supported */
>
> I must admit I have no idea how we'd handle ports that can be connected
> to multiple terminals. It's allowed in the spec, even between Functions
> which are then no longer independent, and I was told it was due to
> hardware restrictions, but still I hope we never have to deal with this...

lol yeah me too. For now I am mostly just putting these FIXME's
in at all the places where this is going to become relevant. I
must confess I haven't reviewed this part of the spec in detail.
It feels like sharing a couple of ports for a single terminal is
probably tractable if a little annoying. But yeah, if we got as
far as sharing a port across functions that seems like a total
nightmare. We would probably need to do a bit of re-architecting
and add a port abstraction at the device level, but hopefully
people are wise enough to not build hardware like that.

Thanks,
Charles