From 8db32cdbc4309170942467b884c1ab05fbe953be Mon Sep 17 00:00:00 2001 From: Xing Zheng Date: Tue, 28 Aug 2018 21:56:06 +0800 Subject: [PATCH] ASoC: rk3308_codec: Fix the incorrect ADC state during shutdown stream Dues to the broken ADC state, it may miss reset ADC digital register and bring long time (~80ms) unstable and invalid data at next recording. Change-Id: Ibf516c054cab99536a4fa3b5fd82f52810352420 Signed-off-by: Xing Zheng --- sound/soc/codecs/rk3308_codec.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c index ee82781d5ba4..79b344882d94 100644 --- a/sound/soc/codecs/rk3308_codec.c +++ b/sound/soc/codecs/rk3308_codec.c @@ -1973,10 +1973,12 @@ static bool has_en_always_grps(struct rk3308_codec_priv *rk3308) { int idx; - for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { - if (rk3308->en_always_grps[idx] >= 0 && - rk3308->en_always_grps[idx] <= ADC_LR_GROUP_MAX - 1) - return true; + if (rk3308->en_always_grps_num) { + for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) { + if (rk3308->en_always_grps[idx] >= 0 && + rk3308->en_always_grps[idx] <= ADC_LR_GROUP_MAX - 1) + return true; + } } return false;