summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMargarita Olaya Cabrera <magi.olaya@ti.com>2010-07-08 11:48:07 -0500
committerJorge Eduardo Candelaria <jorge.candelaria@ti.com>2010-07-09 11:46:06 -0500
commita3dda41d9ef0bf41890b36cee3801427610cebd4 (patch)
treeb14913b01495b433abd89afee4c3021c5c74fe62 /sound
parentd15b9efb187fe931c773dd7323c5ae8fa80a5f0f (diff)
ASoC: OMAP: Modify McBSP configuration sequences
McBSP shall be enabled in a similar order as McPDM to ensure the correct behavior of the ABE. Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/omap/omap-abe.c75
1 files changed, 44 insertions, 31 deletions
diff --git a/sound/soc/omap/omap-abe.c b/sound/soc/omap/omap-abe.c
index 411a669f7a0d..bdd097dce3da 100644
--- a/sound/soc/omap/omap-abe.c
+++ b/sound/soc/omap/omap-abe.c
@@ -328,6 +328,36 @@ static void omap_abe_vx_dai_shutdown(struct snd_pcm_substream *substream,
}
}
+static int omap_abe_vx_dai_trigger(struct snd_pcm_substream *substream, int cmd,
+ struct snd_soc_dai *dai)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ struct omap_mcpdm_data *mcpdm_priv = cpu_dai->private_data;
+ int stream = substream->stream;
+ int err = 0;
+
+ switch (cmd) {
+ case SNDRV_PCM_TRIGGER_START:
+ case SNDRV_PCM_TRIGGER_RESUME:
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+ if (substream->stream) {
+ if (!mcpdm_priv->active[stream]++)
+ omap_mcpdm_start(stream);
+ }
+ break;
+
+ case SNDRV_PCM_TRIGGER_STOP:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+ break;
+ default:
+ err = -EINVAL;
+ }
+
+ return err;
+}
+
static int omap_abe_vx_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -430,6 +460,7 @@ static int omap_abe_vx_dai_hw_params(struct snd_pcm_substream *substream,
}
omap_mcbsp_config(bus_id, &mcpdm_priv->regs);
+ omap_mcbsp_start(bus_id, !stream, stream);
return err;
}
@@ -442,39 +473,21 @@ static int omap_abe_vx_dai_hw_free(struct snd_pcm_substream *substream,
struct omap_mcpdm_data *mcpdm_priv = cpu_dai->private_data;
struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links;
int stream = substream->stream;
- int err;
-
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
- err = omap_mcpdm_playback_close(&mcpdm_links[stream]);
- else
- err = omap_mcpdm_capture_close(&mcpdm_links[stream]);
-
- omap_mcpdm_stop(stream);
+ int err, bus_id = 1;
- return err;
-}
-
-static int omap_abe_vx_dai_trigger(struct snd_pcm_substream *substream, int cmd,
- struct snd_soc_dai *dai)
-{
- int bus_id = 1;
- int err = 0, play = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
-
- switch (cmd) {
- case SNDRV_PCM_TRIGGER_START:
- case SNDRV_PCM_TRIGGER_RESUME:
- case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- omap_mcbsp_start(bus_id, play, !play);
- break;
-
- case SNDRV_PCM_TRIGGER_STOP:
- case SNDRV_PCM_TRIGGER_SUSPEND:
- case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- omap_mcbsp_stop(bus_id, play, !play);
- break;
- default:
- err = -EINVAL;
+ if (mcpdm_priv->active[stream] == 1) {
+ if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+ err = omap_mcpdm_playback_close(&mcpdm_links[stream]);
+ else
+ err = omap_mcpdm_capture_close(&mcpdm_links[stream]);
+ msleep(250);
+ omap_mcpdm_stop(stream);
+ mcpdm_priv->active[stream] = 0;
+ } else if (mcpdm_priv->active[stream] != 0) {
+ mcpdm_priv->active[stream]--;
}
+ /* Stop McBSP */
+ omap_mcbsp_stop(bus_id, !stream, stream);
return err;
}