[alsa-devel] [PATCH v2] ASoC: Handle multiple codecs with split playback / capture

Ricard Wanderlof ricard.wanderlof at axis.com
Fri Aug 21 16:05:25 CEST 2015


On Fri, 21 Aug 2015, Pierre-Louis Bossart wrote:

> On 8/21/15 2:11 AM, Ricard Wanderlof wrote:
> >
> > On Thu, 20 Aug 2015, Pierre-Louis Bossart wrote:
> >
> >>>    /**
> >>>     * snd_soc_runtime_activate() - Increment active count for PCM runtime components
> >>>     * @rtd: ASoC PCM runtime that is activated
> >>> @@ -371,6 +389,20 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
> >>>
> >>>    	/* first calculate min/max only for CODECs in the DAI link */
> >>>    	for (i = 0; i < rtd->num_codecs; i++) {
> >>> +
> >>> +		/*
> >>> +		 * Skip CODECs which don't support the current stream type.
> >>> +		 * Otherwise, since the rate, channel, and format values will
> >>> +		 * zero in that case, we would have no usable settings left,
> >>> +		 * causing the resulting setup to fail.
> >>> +		 * At least one CODEC should match, otherwise we should have
> >>> +		 * bailed out on a higher level, since there would be no
> >>> +		 * CODEC to support the transfer direction in that case.
> >>> +		 */
> >>> +		if (!snd_soc_dai_stream_valid(rtd->codec_dais[i],
> >>> +					      substream->stream))
> >>
> >> Maybe I misunderstood but shouldn't there be some sort of verification
> >> that the codecs can use the same number of slots between playback and
> >> capture if they share the same LRCLK/FS? e.g. it's not uncommon to have
> >> 4 mic capture and 2 ch playback. If the capture and playback is handled
> >> by different chips you'd still need to maintain some level of consistency.
> >
> > You're probably right, although it may be that that sort of thing is
> > handled at a higher level, e.g. the machine driver in such a setup would
> > configure both codecs to use TDM before we even get to this function, I
> > don't know.
> >
> > I think we'd have to take care of that situation if and when it arises.
> > The setup I have here doesn't allow me to test it.
> 
> ok, sounds fine. maybe you could add this to the comments or commit 
> message then so that this assumption is known.

Ok, good point. Will do.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30


More information about the Alsa-devel mailing list