aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-16 18:03:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-17 11:10:01 -0500
commit7bd3a6f34cdd4b1776ca34d0b6fab216e9323759 (patch)
treed76722c3f70e4a6ef2cce5ff619a1b8755ddd6a9 /sound/soc/soc-dapm.c
parent5ba06fc969d068dee9a59f1fa3dbe58e235fa913 (diff)
ASoC: dapm: Supply the DAI and substream when calling stream events
In order to allow us to do something smarter than iterate through widgets doing strcmp() to work out what to power up for stream events change the interface used to generate them to be based on the combination of a DAI and a stream direction rather than just a simple string identifying the stream. At some point we'll probably want a set of channels too. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 295fa91d9d03..97915eb711cc 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2823,17 +2823,27 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
2823EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); 2823EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls);
2824 2824
2825static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm, 2825static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
2826 const char *stream, int event) 2826 int stream, struct snd_soc_dai *dai,
2827 int event)
2827{ 2828{
2828 struct snd_soc_dapm_widget *w; 2829 struct snd_soc_dapm_widget *w;
2830 const char *stream_name;
2831
2832 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
2833 stream_name = dai->driver->playback.stream_name;
2834 else
2835 stream_name = dai->driver->capture.stream_name;
2836
2837 if (!stream_name)
2838 return;
2829 2839
2830 list_for_each_entry(w, &dapm->card->widgets, list) 2840 list_for_each_entry(w, &dapm->card->widgets, list)
2831 { 2841 {
2832 if (!w->sname || w->dapm != dapm) 2842 if (!w->sname || w->dapm != dapm)
2833 continue; 2843 continue;
2834 dev_vdbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n", 2844 dev_vdbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n",
2835 w->name, w->sname, stream, event); 2845 w->name, w->sname, stream_name, event);
2836 if (strstr(w->sname, stream)) { 2846 if (strstr(w->sname, stream_name)) {
2837 dapm_mark_dirty(w, "stream event"); 2847 dapm_mark_dirty(w, "stream event");
2838 switch(event) { 2848 switch(event) {
2839 case SND_SOC_DAPM_STREAM_START: 2849 case SND_SOC_DAPM_STREAM_START:
@@ -2865,16 +2875,13 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
2865 * 2875 *
2866 * Returns 0 for success else error. 2876 * Returns 0 for success else error.
2867 */ 2877 */
2868int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, 2878int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
2869 const char *stream, int event) 2879 struct snd_soc_dai *dai, int event)
2870{ 2880{
2871 struct snd_soc_codec *codec = rtd->codec; 2881 struct snd_soc_codec *codec = rtd->codec;
2872 2882
2873 if (stream == NULL)
2874 return 0;
2875
2876 mutex_lock(&codec->mutex); 2883 mutex_lock(&codec->mutex);
2877 soc_dapm_stream_event(&codec->dapm, stream, event); 2884 soc_dapm_stream_event(&codec->dapm, stream, dai, event);
2878 mutex_unlock(&codec->mutex); 2885 mutex_unlock(&codec->mutex);
2879 return 0; 2886 return 0;
2880} 2887}