diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-03-05 13:17:42 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-06 17:04:55 +0800 |
commit | 208a1589db3e30767223d97e39e13237328e8a6e (patch) | |
tree | 07a178803a19d3517d7b393e7b821bae2faf3e2b /sound/soc/soc-pcm.c | |
parent | 38dbfb59d1175ef458d006556061adeaa8751b72 (diff) | |
download | linux-208a1589db3e30767223d97e39e13237328e8a6e.tar.gz linux-208a1589db3e30767223d97e39e13237328e8a6e.tar.bz2 linux-208a1589db3e30767223d97e39e13237328e8a6e.zip |
ASoC: Handle ignore_pmdown_time for CODEC to CODEC links
For CODEC to CODEC links we should only immediately power down if both CODECs
are configured to ignore the power down delay. Factor the logic for this
into a helper function that can be used for both compressed and normal PCMs.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-pcm.c')
-rw-r--r-- | sound/soc/soc-pcm.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 47e1ce771e65..f098c8007cbe 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -35,6 +35,30 @@ #define DPCM_MAX_BE_USERS 8 /** + * snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay + * @rtd: The ASoC PCM runtime that should be checked. + * + * This function checks whether the power down delay should be ignored for a + * specific PCM runtime. Returns true if the delay is 0, if it the DAI link has + * been configured to ignore the delay, or if none of the components benefits + * from having the delay. + */ +bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd) +{ + bool ignore = true; + + if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time) + return true; + + if (rtd->cpu_dai->codec) + ignore &= rtd->cpu_dai->codec->ignore_pmdown_time; + + ignore &= rtd->codec_dai->codec->ignore_pmdown_time; + + return ignore; +} + +/** * snd_soc_set_runtime_hwparams - set the runtime hardware parameters * @substream: the pcm substream * @hw: the hardware parameters @@ -496,8 +520,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) cpu_dai->runtime = NULL; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - if (!rtd->pmdown_time || codec->ignore_pmdown_time || - rtd->dai_link->ignore_pmdown_time) { + if (snd_soc_runtime_ignore_pmdown_time(rtd)) { /* powered down playback stream now */ snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, |