diff options
author | Xing Zheng <zhengxing@rock-chips.com> | 2019-01-15 16:24:36 +0800 |
---|---|---|
committer | Tao Huang <huangtao@rock-chips.com> | 2019-01-15 18:32:06 +0800 |
commit | 5b3a80e61e3c3dd041243736c1b942e7bfa841d9 (patch) | |
tree | d3cda653469461644794da552739d0ac4cee69e1 /sound | |
parent | 2cca713bde5816dc5ee573870a35460afbc4285e (diff) |
ASoC: rk3308_codec: fix some skip grps errors
If we use the channels which are less than en_always_grps_num,
we don't need to set the flag to skip_grps which are not used.
And, the skip grps need to refer to mapped_grps
For example, if:
rockchip,en-always-grps = <1 2 3>;
rockchip,adc-grps-route = <2 1 3 0>;
The DUT startup and capture 2ch at first, we just open grp2
and set skip_grp[2]=1.
Then, if we capture 4ch, we just skip grp2, open grp1, and
set skip_grp[1]=1.
To capture 6ch: we skip grp2/grp1, open grp3 and set skip_grp[3]=1.
To capture 8ch: we skip grp2/grp1/grp3 and open grp0.
Change-Id: I88c0b220ce0e714abafda1be3c895ad1c5c9ddca
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/rk3308_codec.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c index aac334c64ad5..6013abb6a154 100644 --- a/sound/soc/codecs/rk3308_codec.c +++ b/sound/soc/codecs/rk3308_codec.c @@ -3278,18 +3278,19 @@ err: static void rk3308_codec_update_adcs_status(struct rk3308_codec_priv *rk3308, int state) { - int idx; + int idx, grp; /* Update skip_grps flags if the ADCs need to be enabled always. */ if (state == PATH_BUSY) { - /* Clear all of skip_grps flags. */ - for (idx = 0; idx < ADC_LR_GROUP_MAX; idx++) - rk3308->skip_grps[idx] = 0; + for (idx = 0; idx < rk3308->used_adc_grps; idx++) { + u32 mapped_grp = to_mapped_grp(rk3308, idx); - for (idx = 0; idx < rk3308->en_always_grps_num; idx++) { - u32 en_always_grp = rk3308->en_always_grps[idx]; + for (grp = 0; grp < rk3308->en_always_grps_num; grp++) { + u32 en_always_grp = rk3308->en_always_grps[grp]; - rk3308->skip_grps[en_always_grp] = 1; + if (mapped_grp == en_always_grp) + rk3308->skip_grps[en_always_grp] = 1; + } } } } @@ -3605,6 +3606,10 @@ static int rk3308_codec_setup_en_always_adcs(struct rk3308_codec_priv *rk3308, return ret; } + /* Clear all of skip_grps flags. */ + for (num = 0; num < ADC_LR_GROUP_MAX; num++) + rk3308->skip_grps[num] = 0; + /* The loopback grp should not be enabled always. */ for (num = 0; num < rk3308->en_always_grps_num; num++) { if (rk3308->en_always_grps[num] == rk3308->loopback_grp) { |