From: Shengjiu Wang <[email protected]>

The prefilter coefficient write stage selector is restored from the
register cache during runtime resume. For a two-stage prefilter, its
cached value selects stage 2, as left by fsl_easrc_prefilter_config().

The resume path reloads both stages without updating the selector, so
the stage 1 coefficients are written to stage 2 and stage 1 is not
restored correctly. Resetting the coefficient write pointer does not
change the selected stage.

Explicitly select the destination stage before each coefficient reload,
matching the initial prefilter configuration sequence. Check the selector
write errors through the existing resume error path.

Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers")
Signed-off-by: Shengjiu Wang <[email protected]>
---
 sound/soc/fsl/fsl_easrc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index b7a429170794..f8da492beb82 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -2420,6 +2420,13 @@ static int fsl_easrc_runtime_resume(struct device *dev)
                    % ctx_priv->in_params.sample_rate != 0)
                        ctx_priv->out_missed_sample += 1;
 
+               ret = regmap_update_bits(easrc->regmap, REG_EASRC_CCE1(i),
+                                        EASRC_CCE1_COEF_WS_MASK,
+                                        EASRC_PF_ST1_COEFF_WR <<
+                                        EASRC_CCE1_COEF_WS_SHIFT);
+               if (ret)
+                       goto disable_mem_clk;
+
                ret = fsl_easrc_write_pf_coeff_mem(easrc, i,
                                                   ctx_priv->st1_coeff,
                                                   ctx_priv->st1_num_taps,
@@ -2427,6 +2434,13 @@ static int fsl_easrc_runtime_resume(struct device *dev)
                if (ret)
                        goto disable_mem_clk;
 
+               ret = regmap_update_bits(easrc->regmap, REG_EASRC_CCE1(i),
+                                        EASRC_CCE1_COEF_WS_MASK,
+                                        EASRC_PF_ST2_COEFF_WR <<
+                                        EASRC_CCE1_COEF_WS_SHIFT);
+               if (ret)
+                       goto disable_mem_clk;
+
                ret = fsl_easrc_write_pf_coeff_mem(easrc, i,
                                                   ctx_priv->st2_coeff,
                                                   ctx_priv->st2_num_taps,
-- 
2.34.1


Reply via email to