Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9ad6296 authored by Jassi Brar's avatar Jassi Brar Committed by Mark Brown
Browse files

ASoC: PCM_RATE: Check for KNOT and CONTINUOUS flags



For ASoC, if either CPU or CODEC driver has set the flag, the MACHINE driver
should be given a chance to figure out if the dai, that set the flag, can
accomodate a rate that it does not explicitly specify but is specified
by the dai at the other end of the link.

Signed-off-by: default avatarJassi Brar <jassi.brar@samsung.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 960b3b4b
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -404,6 +404,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
			codec_dai->playback.formats & cpu_dai->playback.formats;
		runtime->hw.rates =
			codec_dai->playback.rates & cpu_dai->playback.rates;
		if (codec_dai->playback.rates
			   & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
			runtime->hw.rates |= cpu_dai->playback.rates;
		if (cpu_dai->playback.rates
			   & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
			runtime->hw.rates |= codec_dai->playback.rates;
	} else {
		runtime->hw.rate_min =
			max(codec_dai->capture.rate_min,
@@ -421,6 +427,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
			codec_dai->capture.formats & cpu_dai->capture.formats;
		runtime->hw.rates =
			codec_dai->capture.rates & cpu_dai->capture.rates;
		if (codec_dai->capture.rates
			   & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
			runtime->hw.rates |= cpu_dai->capture.rates;
		if (cpu_dai->capture.rates
			   & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))
			runtime->hw.rates |= codec_dai->capture.rates;
	}

	snd_pcm_limit_hw_rates(runtime);