summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@nxp.com>2019-07-12 11:54:03 +0300
committerViorel Suman <viorel.suman@nxp.com>2019-07-12 13:18:48 +0300
commite7b9883802fc4d574995abcc5f704ccc7b619a4e (patch)
tree165fef20077cd81217b468a3a2b431f28ad2d5bc /sound
parent300f25da57d086642aa6d93ab57aaf4b977bc2ea (diff)
MLK-21775-2: ASoC: fsl_micfil: fix error handling in enable_hwvad
The HWVAD_OFF state must be restored and device put back in runtime_suspend in case if fsl_set_clock_params, fsl_micfil_reset and init_hwvad calls return an error. Signed-off-by: Viorel Suman <viorel.suman@nxp.com> Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> (cherry picked from commit 259efe6c3e05b07bdcdf27cea269af4ea82c8abe)
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_micfil.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_micfil.c b/sound/soc/fsl/fsl_micfil.c
index 5cfbd5162f88..6cc8d6e81457 100644
--- a/sound/soc/fsl/fsl_micfil.c
+++ b/sound/soc/fsl/fsl_micfil.c
@@ -2097,17 +2097,21 @@ static int enable_hwvad(struct device *dev, bool sync)
ret = fsl_set_clock_params(dev, rate);
if (ret)
- return ret;
+ goto enable_error;
ret = fsl_micfil_reset(dev);
if (ret)
- return ret;
+ goto enable_error;
/* Initialize Hardware Voice Activity */
ret = init_hwvad(dev);
+ if (ret == 0)
+ return 0;
- return ret;
enable_error:
+ if (state == MICFIL_HWVAD_OFF)
+ atomic_cmpxchg(&micfil->hwvad_state,
+ MICFIL_HWVAD_ON, MICFIL_HWVAD_OFF);
if (sync)
pm_runtime_put_sync(dev);
return ret;