aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c79
1 files changed, 51 insertions, 28 deletions
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
2990static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm, 2990static 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 */
3034int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, 3058void 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/**