diff options
-rw-r--r-- | include/sound/soc-dapm.h | 4 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 8 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 79 | ||||
-rw-r--r-- | sound/soc/soc-pcm.c | 9 |
4 files changed, 59 insertions, 41 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 055242e69dc3..6c64dbeb28ba 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -369,8 +369,8 @@ int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm, | |||
369 | const struct snd_soc_dapm_route *route, int num); | 369 | const struct snd_soc_dapm_route *route, int num); |
370 | 370 | ||
371 | /* dapm events */ | 371 | /* dapm events */ |
372 | int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | 372 | void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
373 | struct snd_soc_dai *dai, int event); | 373 | int event); |
374 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); | 374 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); |
375 | 375 | ||
376 | /* external DAPM widget events */ | 376 | /* external DAPM widget events */ |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 42ce14485b92..61b51b673d49 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -573,19 +573,16 @@ int snd_soc_suspend(struct device *dev) | |||
573 | } | 573 | } |
574 | 574 | ||
575 | for (i = 0; i < card->num_rtd; i++) { | 575 | for (i = 0; i < card->num_rtd; i++) { |
576 | struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai; | ||
577 | 576 | ||
578 | if (card->rtd[i].dai_link->ignore_suspend) | 577 | if (card->rtd[i].dai_link->ignore_suspend) |
579 | continue; | 578 | continue; |
580 | 579 | ||
581 | snd_soc_dapm_stream_event(&card->rtd[i], | 580 | snd_soc_dapm_stream_event(&card->rtd[i], |
582 | SNDRV_PCM_STREAM_PLAYBACK, | 581 | SNDRV_PCM_STREAM_PLAYBACK, |
583 | codec_dai, | ||
584 | SND_SOC_DAPM_STREAM_SUSPEND); | 582 | SND_SOC_DAPM_STREAM_SUSPEND); |
585 | 583 | ||
586 | snd_soc_dapm_stream_event(&card->rtd[i], | 584 | snd_soc_dapm_stream_event(&card->rtd[i], |
587 | SNDRV_PCM_STREAM_CAPTURE, | 585 | SNDRV_PCM_STREAM_CAPTURE, |
588 | codec_dai, | ||
589 | SND_SOC_DAPM_STREAM_SUSPEND); | 586 | SND_SOC_DAPM_STREAM_SUSPEND); |
590 | } | 587 | } |
591 | 588 | ||
@@ -689,17 +686,16 @@ static void soc_resume_deferred(struct work_struct *work) | |||
689 | } | 686 | } |
690 | 687 | ||
691 | for (i = 0; i < card->num_rtd; i++) { | 688 | for (i = 0; i < card->num_rtd; i++) { |
692 | struct snd_soc_dai *codec_dai = card->rtd[i].codec_dai; | ||
693 | 689 | ||
694 | if (card->rtd[i].dai_link->ignore_suspend) | 690 | if (card->rtd[i].dai_link->ignore_suspend) |
695 | continue; | 691 | continue; |
696 | 692 | ||
697 | snd_soc_dapm_stream_event(&card->rtd[i], | 693 | snd_soc_dapm_stream_event(&card->rtd[i], |
698 | SNDRV_PCM_STREAM_PLAYBACK, codec_dai, | 694 | SNDRV_PCM_STREAM_PLAYBACK, |
699 | SND_SOC_DAPM_STREAM_RESUME); | 695 | SND_SOC_DAPM_STREAM_RESUME); |
700 | 696 | ||
701 | snd_soc_dapm_stream_event(&card->rtd[i], | 697 | snd_soc_dapm_stream_event(&card->rtd[i], |
702 | SNDRV_PCM_STREAM_CAPTURE, codec_dai, | 698 | SNDRV_PCM_STREAM_CAPTURE, |
703 | SND_SOC_DAPM_STREAM_RESUME); | 699 | SND_SOC_DAPM_STREAM_RESUME); |
704 | } | 700 | } |
705 | 701 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index e1863d7e8012..3fcefd1060a2 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2987,37 +2987,61 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) | |||
2987 | return 0; | 2987 | return 0; |
2988 | } | 2988 | } |
2989 | 2989 | ||
2990 | static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm, | 2990 | static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
2991 | int stream, struct snd_soc_dai *dai, | 2991 | int event) |
2992 | int event) | ||
2993 | { | 2992 | { |
2994 | struct snd_soc_dapm_widget *w; | ||
2995 | 2993 | ||
2996 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) | 2994 | struct snd_soc_dapm_widget *w_cpu, *w_codec; |
2997 | w = dai->playback_widget; | 2995 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
2998 | else | 2996 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
2999 | w = dai->capture_widget; | ||
3000 | 2997 | ||
3001 | if (!w) | 2998 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { |
3002 | return; | 2999 | w_cpu = cpu_dai->playback_widget; |
3000 | w_codec = codec_dai->playback_widget; | ||
3001 | } else { | ||
3002 | w_cpu = cpu_dai->capture_widget; | ||
3003 | w_codec = codec_dai->capture_widget; | ||
3004 | } | ||
3003 | 3005 | ||
3004 | dapm_mark_dirty(w, "stream event"); | 3006 | if (w_cpu) { |
3005 | 3007 | ||
3006 | switch (event) { | 3008 | dapm_mark_dirty(w_cpu, "stream event"); |
3007 | case SND_SOC_DAPM_STREAM_START: | 3009 | |
3008 | w->active = 1; | 3010 | switch (event) { |
3009 | break; | 3011 | case SND_SOC_DAPM_STREAM_START: |
3010 | case SND_SOC_DAPM_STREAM_STOP: | 3012 | w_cpu->active = 1; |
3011 | w->active = 0; | 3013 | break; |
3012 | break; | 3014 | case SND_SOC_DAPM_STREAM_STOP: |
3013 | case SND_SOC_DAPM_STREAM_SUSPEND: | 3015 | w_cpu->active = 0; |
3014 | case SND_SOC_DAPM_STREAM_RESUME: | 3016 | break; |
3015 | case SND_SOC_DAPM_STREAM_PAUSE_PUSH: | 3017 | case SND_SOC_DAPM_STREAM_SUSPEND: |
3016 | case SND_SOC_DAPM_STREAM_PAUSE_RELEASE: | 3018 | case SND_SOC_DAPM_STREAM_RESUME: |
3017 | break; | 3019 | case SND_SOC_DAPM_STREAM_PAUSE_PUSH: |
3020 | case SND_SOC_DAPM_STREAM_PAUSE_RELEASE: | ||
3021 | break; | ||
3022 | } | ||
3023 | } | ||
3024 | |||
3025 | if (w_codec) { | ||
3026 | |||
3027 | dapm_mark_dirty(w_codec, "stream event"); | ||
3028 | |||
3029 | switch (event) { | ||
3030 | case SND_SOC_DAPM_STREAM_START: | ||
3031 | w_codec->active = 1; | ||
3032 | break; | ||
3033 | case SND_SOC_DAPM_STREAM_STOP: | ||
3034 | w_codec->active = 0; | ||
3035 | break; | ||
3036 | case SND_SOC_DAPM_STREAM_SUSPEND: | ||
3037 | case SND_SOC_DAPM_STREAM_RESUME: | ||
3038 | case SND_SOC_DAPM_STREAM_PAUSE_PUSH: | ||
3039 | case SND_SOC_DAPM_STREAM_PAUSE_RELEASE: | ||
3040 | break; | ||
3041 | } | ||
3018 | } | 3042 | } |
3019 | 3043 | ||
3020 | dapm_power_widgets(dapm, event); | 3044 | dapm_power_widgets(&rtd->card->dapm, event); |
3021 | } | 3045 | } |
3022 | 3046 | ||
3023 | /** | 3047 | /** |
@@ -3031,15 +3055,14 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm, | |||
3031 | * | 3055 | * |
3032 | * Returns 0 for success else error. | 3056 | * Returns 0 for success else error. |
3033 | */ | 3057 | */ |
3034 | int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | 3058 | void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
3035 | struct snd_soc_dai *dai, int event) | 3059 | int event) |
3036 | { | 3060 | { |
3037 | struct snd_soc_card *card = rtd->card; | 3061 | struct snd_soc_card *card = rtd->card; |
3038 | 3062 | ||
3039 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM); | 3063 | mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_PCM); |
3040 | soc_dapm_stream_event(&card->dapm, stream, dai, event); | 3064 | soc_dapm_stream_event(rtd, stream, event); |
3041 | mutex_unlock(&card->dapm_mutex); | 3065 | mutex_unlock(&card->dapm_mutex); |
3042 | return 0; | ||
3043 | } | 3066 | } |
3044 | 3067 | ||
3045 | /** | 3068 | /** |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0ad8dcacd2f3..26a60b4061cf 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -308,7 +308,7 @@ static void close_delayed_work(struct work_struct *work) | |||
308 | if (codec_dai->pop_wait == 1) { | 308 | if (codec_dai->pop_wait == 1) { |
309 | codec_dai->pop_wait = 0; | 309 | codec_dai->pop_wait = 0; |
310 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, | 310 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, |
311 | codec_dai, SND_SOC_DAPM_STREAM_STOP); | 311 | SND_SOC_DAPM_STREAM_STOP); |
312 | } | 312 | } |
313 | 313 | ||
314 | mutex_unlock(&rtd->pcm_mutex); | 314 | mutex_unlock(&rtd->pcm_mutex); |
@@ -373,7 +373,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
373 | /* powered down playback stream now */ | 373 | /* powered down playback stream now */ |
374 | snd_soc_dapm_stream_event(rtd, | 374 | snd_soc_dapm_stream_event(rtd, |
375 | SNDRV_PCM_STREAM_PLAYBACK, | 375 | SNDRV_PCM_STREAM_PLAYBACK, |
376 | codec_dai, | ||
377 | SND_SOC_DAPM_STREAM_STOP); | 376 | SND_SOC_DAPM_STREAM_STOP); |
378 | } else { | 377 | } else { |
379 | /* start delayed pop wq here for playback streams */ | 378 | /* start delayed pop wq here for playback streams */ |
@@ -384,7 +383,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) | |||
384 | } else { | 383 | } else { |
385 | /* capture streams can be powered down now */ | 384 | /* capture streams can be powered down now */ |
386 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_CAPTURE, | 385 | snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_CAPTURE, |
387 | codec_dai, SND_SOC_DAPM_STREAM_STOP); | 386 | SND_SOC_DAPM_STREAM_STOP); |
388 | } | 387 | } |
389 | 388 | ||
390 | mutex_unlock(&rtd->pcm_mutex); | 389 | mutex_unlock(&rtd->pcm_mutex); |
@@ -453,8 +452,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
453 | cancel_delayed_work(&rtd->delayed_work); | 452 | cancel_delayed_work(&rtd->delayed_work); |
454 | } | 453 | } |
455 | 454 | ||
456 | snd_soc_dapm_stream_event(rtd, substream->stream, codec_dai, | 455 | snd_soc_dapm_stream_event(rtd, substream->stream, |
457 | SND_SOC_DAPM_STREAM_START); | 456 | SND_SOC_DAPM_STREAM_START); |
458 | 457 | ||
459 | snd_soc_dai_digital_mute(codec_dai, 0); | 458 | snd_soc_dai_digital_mute(codec_dai, 0); |
460 | 459 | ||