summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorChen Liangjun <b36089@freescale.com>2012-08-16 21:11:46 +0800
committerChen Liangjun <b36089@freescale.com>2012-08-17 15:38:31 +0800
commit59f87e44a8faaef59969daadd1a7d295adbda3a0 (patch)
treee5fcb16253247c0348773440eed0be1bf8a6dce8 /sound
parent8ca6288db45a89a353c3b4fb51b417e91a7d4d6d (diff)
ENGR00220595 ESAI ASRC: add support for 'aplay *'
When play audio in the way of aplay *, shutdown function would not be called and ASRC configuration would not be reconfigured. In this case, playback would sound noise. In this patch, put ASRC release operation into hw_free(). Signed-off-by: Chen Liangjun <b36089@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/imx/imx-cs42888.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sound/soc/imx/imx-cs42888.c b/sound/soc/imx/imx-cs42888.c
index c372587ecce9..11ba16511ce2 100644
--- a/sound/soc/imx/imx-cs42888.c
+++ b/sound/soc/imx/imx-cs42888.c
@@ -133,6 +133,14 @@ static void imx_3stack_shutdown(struct snd_pcm_substream *substream)
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct imx_pcm_runtime_data *iprtd = substream->runtime->private_data;
+ if (!cpu_dai->active)
+ hw_state.hw = 0;
+}
+
+static int imx_3stack_surround_hw_free(struct snd_pcm_substream *substream)
+{
+ struct imx_pcm_runtime_data *iprtd = substream->runtime->private_data;
+
if (iprtd->asrc_enable) {
if (iprtd->asrc_index != -1) {
asrc_release_pair(iprtd->asrc_index);
@@ -141,10 +149,8 @@ static void imx_3stack_shutdown(struct snd_pcm_substream *substream)
iprtd->asrc_index = -1;
}
- if (!cpu_dai->active)
- hw_state.hw = 0;
+ return 0;
}
-
static int imx_3stack_surround_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -157,16 +163,17 @@ static int imx_3stack_surround_hw_params(struct snd_pcm_substream *substream,
unsigned int lrclk_ratio = 0;
int err = 0;
- if (hw_state.hw)
- return 0;
- hw_state.hw = 1;
-
if (iprtd->asrc_enable) {
err = config_asrc(substream, params);
if (err < 0)
return err;
rate = iprtd->p2p->p2p_rate;
}
+
+ if (hw_state.hw)
+ return 0;
+ hw_state.hw = 1;
+
if (cpu_is_mx53() || machine_is_mx6q_sabreauto()) {
switch (rate) {
case 32000:
@@ -276,6 +283,7 @@ static struct snd_soc_ops imx_3stack_surround_ops = {
.startup = imx_3stack_startup,
.shutdown = imx_3stack_shutdown,
.hw_params = imx_3stack_surround_hw_params,
+ .hw_free = imx_3stack_surround_hw_free,
};
static const struct snd_soc_dapm_widget imx_3stack_dapm_widgets[] = {