summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_easrc.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2020-03-10 19:02:18 +0800
committerShengjiu Wang <shengjiu.wang@nxp.com>2020-03-11 17:43:38 +0800
commitdc5a4818433a59c187fa52b7d4585940ba6b2da5 (patch)
tree80ae75217c10e7440c8784ae28417fcf9b0dcbfe /sound/soc/fsl/fsl_easrc.c
parent3a61dae9aa0deeb1eebe62b98d93549d028930fb (diff)
LF-941: ASoC: fsl_easrc: Switch to 32 taps for resampling filter
With 128 taps of resampling filter, there is performance issue for high sample rate and mulitchannel. For example, there is noise issue for converting 48kHz to 768kHz, channel number is larger than 5 channels, and p2p case. So in order to increase performance, we reduce the taps number to 32 in default, the quality is relatively downgraded. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/fsl_easrc.c')
-rw-r--r--sound/soc/fsl/fsl_easrc.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index c7917ccf8c82..4659844ff997 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -200,6 +200,12 @@ static int set_rs_ratio(struct fsl_easrc_context *ctx)
val = ((uint64_t)in_rate << frac_bits) / out_rate;
r = (uint32_t *)&val;
+
+ if (r[1] & 0xFFFFF000) {
+ dev_err(&easrc->pdev->dev, "ratio exceed range\n");
+ return -EINVAL;
+ }
+
ret = regmap_write(easrc->regmap,
REG_EASRC_RRL(ctx->index),
EASRC_RRL_RS_RL(r[0]));
@@ -2267,6 +2273,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
struct device_node *np;
void __iomem *regs;
int ret, irq;
+ u32 rstap = 0;
u32 width;
easrc = devm_kzalloc(&pdev->dev, sizeof(*easrc), GFP_KERNEL);
@@ -2316,9 +2323,24 @@ 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;
+ of_property_read_u32(np, "fsl,asrc-rstap", &rstap);
+ switch (rstap) {
+ case 32:
+ easrc->rs_num_taps = EASRC_RS_32_TAPS;
+ break;
+ case 64:
+ easrc->rs_num_taps = EASRC_RS_64_TAPS;
+ break;
+ case 128:
+ easrc->rs_num_taps = EASRC_RS_128_TAPS;
+ break;
+ default:
+ easrc->rs_num_taps = EASRC_RS_32_TAPS;
+ break;
+ }
+
ret = of_property_read_u32(np, "fsl,asrc-rate",
&easrc->easrc_rate);
if (ret) {