diff options
author | Jorge Eduardo Candelaria <jorge.candelaria@ti.com> | 2010-04-08 13:29:13 -0500 |
---|---|---|
committer | Margarita Olaya Cabrera <magi.olaya@ti.com> | 2010-04-09 19:00:37 -0500 |
commit | a60000ef173ddce2fd265f795959738fd49b800b (patch) | |
tree | a646465399d676b790e79cc2e9af5e3537f2e464 | |
parent | 627305eeba0851a7c1012193378fad27eb03c5e8 (diff) |
ASoC: OMAP4: Move trigger handling to ABE
A loud pop-noise was heard when pausing/releasing a stream, caused by
incorrect handling of of trigger callback.
To correct this, McPDM enables its channels before DAPM powers up codec
components, leaving ABE in charge of starting/stopping the data transfer
when triggered.
Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
-rw-r--r-- | sound/soc/codecs/abe-twl6040.c | 2 | ||||
-rw-r--r-- | sound/soc/omap/omap-abe.c | 35 | ||||
-rw-r--r-- | sound/soc/omap/omap-mcpdm.c | 35 |
3 files changed, 10 insertions, 62 deletions
diff --git a/sound/soc/codecs/abe-twl6040.c b/sound/soc/codecs/abe-twl6040.c index af0e5fb0dcef..022a49a0b6ca 100644 --- a/sound/soc/codecs/abe-twl6040.c +++ b/sound/soc/codecs/abe-twl6040.c @@ -1179,12 +1179,14 @@ static int abe_mm_trigger(struct snd_pcm_substream *substream, priv->sysclk); return -EPERM; } + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (!substream->stream) abe_enable_data_transfer(MM_DL_PORT); else abe_enable_data_transfer(MM_UL_PORT); break; case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: if (!substream->stream) abe_disable_data_transfer(MM_DL_PORT); else diff --git a/sound/soc/omap/omap-abe.c b/sound/soc/omap/omap-abe.c index a7ee806675c2..9c1b9bc4e317 100644 --- a/sound/soc/omap/omap-abe.c +++ b/sound/soc/omap/omap-abe.c @@ -112,36 +112,6 @@ static void omap_abe_dai_shutdown(struct snd_pcm_substream *substream, omap_mcpdm_free(); } -static int omap_abe_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 (!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: - if (!--mcpdm_priv->active[stream]) - omap_mcpdm_stop(stream); - break; - default: - err = -EINVAL; - } - - return err; -} - static int omap_abe_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -213,6 +183,8 @@ static int omap_abe_dai_hw_params(struct snd_pcm_substream *substream, else err = omap_mcpdm_capture_open(&mcpdm_links[stream]); + omap_mcpdm_start(stream); + return err; } @@ -231,13 +203,14 @@ static int omap_abe_dai_hw_free(struct snd_pcm_substream *substream, else err = omap_mcpdm_capture_close(&mcpdm_links[stream]); + omap_mcpdm_stop(stream); + return err; } static struct snd_soc_dai_ops omap_abe_dai_ops = { .startup = omap_abe_dai_startup, .shutdown = omap_abe_dai_shutdown, - .trigger = omap_abe_dai_trigger, .hw_params = omap_abe_dai_hw_params, .hw_free = omap_abe_dai_hw_free, }; diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index 25f19e4728bf..9fe0dea89756 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -109,36 +109,6 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream, omap_mcpdm_free(); } -static int omap_mcpdm_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 (!mcpdm_priv->active++) - omap_mcpdm_start(stream); - break; - - case SNDRV_PCM_TRIGGER_STOP: - case SNDRV_PCM_TRIGGER_SUSPEND: - case SNDRV_PCM_TRIGGER_PAUSE_PUSH: - if (!--mcpdm_priv->active) - omap_mcpdm_stop(stream); - break; - default: - err = -EINVAL; - } - - return err; -} - static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) @@ -182,6 +152,8 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream, err = omap_mcpdm_capture_open(&mcpdm_links[stream]); } + omap_mcpdm_start(stream); + return err; } @@ -200,13 +172,14 @@ static int omap_mcpdm_dai_hw_free(struct snd_pcm_substream *substream, else err = omap_mcpdm_capture_close(&mcpdm_links[stream]); + omap_mcpdm_stop(stream); + return err; } static struct snd_soc_dai_ops omap_mcpdm_dai_ops = { .startup = omap_mcpdm_dai_startup, .shutdown = omap_mcpdm_dai_shutdown, - .trigger = omap_mcpdm_dai_trigger, .hw_params = omap_mcpdm_dai_hw_params, .hw_free = omap_mcpdm_dai_hw_free, }; |