diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/imx/imx-cs42888.c | 22 |
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[] = { |