aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc.h2
-rw-r--r--sound/soc/soc-compress.c3
-rw-r--r--sound/soc/soc-pcm.c27
3 files changed, 28 insertions, 4 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 9a001472b96a..93c31c70b90a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -413,6 +413,8 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
413struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, 413struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
414 const char *dai_link); 414 const char *dai_link);
415 415
416bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd);
417
416/* Utility functions to get clock rates from various things */ 418/* Utility functions to get clock rates from various things */
417int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 419int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
418int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 420int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 5e9690c85d8f..ef585af4081b 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -235,8 +235,7 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
235 cpu_dai->runtime = NULL; 235 cpu_dai->runtime = NULL;
236 236
237 if (cstream->direction == SND_COMPRESS_PLAYBACK) { 237 if (cstream->direction == SND_COMPRESS_PLAYBACK) {
238 if (!rtd->pmdown_time || codec->ignore_pmdown_time || 238 if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
239 rtd->dai_link->ignore_pmdown_time) {
240 snd_soc_dapm_stream_event(rtd, 239 snd_soc_dapm_stream_event(rtd,
241 SNDRV_PCM_STREAM_PLAYBACK, 240 SNDRV_PCM_STREAM_PLAYBACK,
242 SND_SOC_DAPM_STREAM_STOP); 241 SND_SOC_DAPM_STREAM_STOP);
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 @@
35#define DPCM_MAX_BE_USERS 8 35#define DPCM_MAX_BE_USERS 8
36 36
37/** 37/**
38 * snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay
39 * @rtd: The ASoC PCM runtime that should be checked.
40 *
41 * This function checks whether the power down delay should be ignored for a
42 * specific PCM runtime. Returns true if the delay is 0, if it the DAI link has
43 * been configured to ignore the delay, or if none of the components benefits
44 * from having the delay.
45 */
46bool snd_soc_runtime_ignore_pmdown_time(struct snd_soc_pcm_runtime *rtd)
47{
48 bool ignore = true;
49
50 if (!rtd->pmdown_time || rtd->dai_link->ignore_pmdown_time)
51 return true;
52
53 if (rtd->cpu_dai->codec)
54 ignore &= rtd->cpu_dai->codec->ignore_pmdown_time;
55
56 ignore &= rtd->codec_dai->codec->ignore_pmdown_time;
57
58 return ignore;
59}
60
61/**
38 * snd_soc_set_runtime_hwparams - set the runtime hardware parameters 62 * snd_soc_set_runtime_hwparams - set the runtime hardware parameters
39 * @substream: the pcm substream 63 * @substream: the pcm substream
40 * @hw: the hardware parameters 64 * @hw: the hardware parameters
@@ -496,8 +520,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
496 cpu_dai->runtime = NULL; 520 cpu_dai->runtime = NULL;
497 521
498 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 522 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
499 if (!rtd->pmdown_time || codec->ignore_pmdown_time || 523 if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
500 rtd->dai_link->ignore_pmdown_time) {
501 /* powered down playback stream now */ 524 /* powered down playback stream now */
502 snd_soc_dapm_stream_event(rtd, 525 snd_soc_dapm_stream_event(rtd,
503 SNDRV_PCM_STREAM_PLAYBACK, 526 SNDRV_PCM_STREAM_PLAYBACK,