Merge remote-tracking branches 'asoc/fix/dpcm', 'asoc/fix/imx', 'asoc/fix/msm8916...
[sfrench/cifs-2.6.git] / sound / soc / soc-pcm.c
index efc5831f205dc41670d35013926bd0749d16d4d7..7d3859e1a7b9b9537744b53d90e74012a5454d07 100644 (file)
@@ -181,6 +181,10 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
                dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
                                be->dai_link->name, event, dir);
 
+               if ((event == SND_SOC_DAPM_STREAM_STOP) &&
+                   (be->dpcm[dir].users >= 1))
+                       continue;
+
                snd_soc_dapm_stream_event(be, dir, event);
        }
 
@@ -2628,25 +2632,12 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
        return ret;
 }
 
-static void soc_pcm_free(struct snd_pcm *pcm)
-{
-       struct snd_soc_pcm_runtime *rtd = pcm->private_data;
-       struct snd_soc_component *component;
-
-       list_for_each_entry(component, &rtd->card->component_dev_list,
-                           card_list) {
-               if (component->pcm_free)
-                       component->pcm_free(pcm);
-       }
-}
-
 /* create a new pcm */
 int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 {
        struct snd_soc_platform *platform = rtd->platform;
        struct snd_soc_dai *codec_dai;
        struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-       struct snd_soc_component *component;
        struct snd_pcm *pcm;
        char new_name[64];
        int ret = 0, playback = 0, capture = 0;
@@ -2743,8 +2734,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 
        if (platform->driver->ops) {
                rtd->ops.ack            = platform->driver->ops->ack;
-               rtd->ops.copy           = platform->driver->ops->copy;
-               rtd->ops.silence        = platform->driver->ops->silence;
+               rtd->ops.copy_user      = platform->driver->ops->copy_user;
+               rtd->ops.copy_kernel    = platform->driver->ops->copy_kernel;
+               rtd->ops.fill_silence   = platform->driver->ops->fill_silence;
                rtd->ops.page           = platform->driver->ops->page;
                rtd->ops.mmap           = platform->driver->ops->mmap;
        }
@@ -2755,18 +2747,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
        if (capture)
                snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &rtd->ops);
 
-       list_for_each_entry(component, &rtd->card->component_dev_list, card_list) {
-               if (component->pcm_new) {
-                       ret = component->pcm_new(rtd);
-                       if (ret < 0) {
-                               dev_err(component->dev,
-                                       "ASoC: pcm constructor failed: %d\n",
-                                       ret);
-                               return ret;
-                       }
+       if (platform->driver->pcm_new) {
+               ret = platform->driver->pcm_new(rtd);
+               if (ret < 0) {
+                       dev_err(platform->dev,
+                               "ASoC: pcm constructor failed: %d\n",
+                               ret);
+                       return ret;
                }
        }
-       pcm->private_free = soc_pcm_free;
+
+       pcm->private_free = platform->driver->pcm_free;
 out:
        dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
                 (rtd->num_codecs > 1) ? "multicodec" : rtd->codec_dai->name,