aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2012-03-07 11:32:59 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:28:22 -0400
commitd9b0951b96e4ee0d22fae0a30f0b53354ca541cd (patch)
treee6419322fa31dc3700ec5dbb69985b0be821ddde /sound/soc/soc-dapm.c
parentbe09ad90e17b79fdb0d513a31e814ff4d42e3dff (diff)
ASoC: dapm: Add platform stream event support
Currently stream events are only perfomed on codec stream widgets only. There is now a need to be able to perform stream events on platform widgets too. e.g. we have the ABE platform driver with several DAI links to dummy codecs. We need to be able to perform stream events on any of the dummy codec DAI links. This patch also removes the snd_soc_dai * parameter since it's already contained within the rtd * parameter. Finally makle stream event return void since no one checks it anyway. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
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/**