diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-10-12 13:19:35 +0800 |
---|---|---|
committer | Shengjiu Wang <shengjiu.wang@nxp.com> | 2019-10-14 16:33:26 +0800 |
commit | 56aa181b23f82280af01dbe1193123d30af61690 (patch) | |
tree | 07f9025818b915741ba50fd764145657f76306a7 /sound | |
parent | 9c92dda98adc6e18532622a99277753639f12e81 (diff) |
MLK-22722: ASoC: fsl_easrc: Use global variable instead local variable
After suspend & resume, there may be noise in asrc output. The reason
is the coeff variable is local, in resume function this variable is
invalid to access, so that cause the prefilter coeff not correctly be
setted.
This patch is to change the coeff variable to be global that we can
get the correct value in resume.
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_easrc.c | 8 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_easrc.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c index 44ded1cddf6b..d61bfc293415 100644 --- a/sound/soc/fsl/fsl_easrc.c +++ b/sound/soc/fsl/fsl_easrc.c @@ -503,7 +503,6 @@ static int fsl_easrc_prefilter_config(struct fsl_easrc *easrc, struct device *dev; u32 inrate, outrate, offset = 0; int ret, i; - u64 coeff = 0x3FF0000000000000; /* Used by float->int */ /* to modify prefilter coeficients, the user must perform * a write in ASRC_PRE_COEFF_FIFO[COEFF_DATA] while the @@ -553,20 +552,20 @@ static int fsl_easrc_prefilter_config(struct fsl_easrc *easrc, if (ctx->in_params.sample_format == SNDRV_PCM_FORMAT_FLOAT_LE && ctx->out_params.sample_format != SNDRV_PCM_FORMAT_FLOAT_LE) { ctx->st1_num_taps = 1; - ctx->st1_coeff = &coeff; + ctx->st1_coeff = &easrc->const_coeff; ctx->st1_num_exp = 1; ctx->st2_num_taps = 0; ctx->st1_addexp = 31; } else if (ctx->in_params.sample_format != SNDRV_PCM_FORMAT_FLOAT_LE && ctx->out_params.sample_format == SNDRV_PCM_FORMAT_FLOAT_LE) { ctx->st1_num_taps = 1; - ctx->st1_coeff = &coeff; + ctx->st1_coeff = &easrc->const_coeff; ctx->st1_num_exp = 1; ctx->st2_num_taps = 0; ctx->st1_addexp -= ctx->in_params.fmt.addexp; } else { ctx->st1_num_taps = 1; - ctx->st1_coeff = &coeff; + ctx->st1_coeff = &easrc->const_coeff; ctx->st1_num_exp = 1; ctx->st2_num_taps = 0; } @@ -2318,6 +2317,7 @@ static int fsl_easrc_probe(struct platform_device *pdev) /*Set default value*/ easrc->chn_avail = 32; easrc->rs_num_taps = EASRC_RS_128_TAPS; + easrc->const_coeff = 0x3FF0000000000000; ret = of_property_read_u32(np, "fsl,asrc-rate", &easrc->easrc_rate); diff --git a/sound/soc/fsl/fsl_easrc.h b/sound/soc/fsl/fsl_easrc.h index 7ed04ea5755c..52bc550e4c5b 100644 --- a/sound/soc/fsl/fsl_easrc.h +++ b/sound/soc/fsl/fsl_easrc.h @@ -681,6 +681,7 @@ struct fsl_easrc { unsigned int bps_iec958[EASRC_CTX_MAX_NUM]; unsigned int chn_avail; u64 *rs_coeff; + u64 const_coeff; int firmware_loaded; spinlock_t lock; /* spin lock for resource protection */ int easrc_rate; |