summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_easrc.c
AgeCommit message (Collapse)Author
2020-05-07MLK-23906-3: ASoC: fsl_easrc: Don't bind clock with regmapShengjiu Wang
The call flow: devm_regmap_init_mmio_clk - clk_prepare() - clk_pm_runtime_get() Cause the power domain of mem clock always be enabled. which impact the power consumption. so we can't bind clock with regmap, but explicitly enable clock when using. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2020-03-11LF-941: ASoC: fsl_easrc: Switch to 32 taps for resampling filterShengjiu Wang
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>
2019-11-25MLK-22722: ASoC: fsl_easrc: Use global variable instead local variableShengjiu Wang
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> (cherry picked from commit 56aa181b23f82280af01dbe1193123d30af61690)
2019-11-25MLK-22591: ASoC: fsl_easrc: Add RUN_STOP in stop contextShengjiu Wang
When record bitstream with ASRC+AK5558, there may be I/O error for the high sample rate case (352kHz/768kHz). The reason is that the context is not fully reset after conversion, the ASRC does not start to work in next conversion. In order to fully reset the context, we need to enable RUN_STOP, then clear the RUN_EN bit. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 7b44c3c653acf078b6477fbc0393f88708ccb24c)
2019-11-25MLK-22575-3: ASoC: fsl_easrc: reformat the fsl_easrc_config_slotShengjiu Wang
Wrap the common code to fsl_easrc_config_one_slot function, that is to make the code more clear. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 0a640c4ddec529dc3f72b9473a9973ac5d1ea797)
2019-11-25MLK-22575-2: ASoC: fsl_easrc: disable PF_BYPASS_MODEShengjiu Wang
When run conversion in parrallel, one is down sampling, another is up sampling, so one enables PF_BYPASS_MODE, another disable PF_BYPASS_MODE, when the allocated slots in a same context processor, there is noise in the result of down sampling. If we alway disable PF_BYPASS_MODE, the issue can't be reproduced. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 3a1a4abc02cfef9fddf0ceef2045c46eaa960c5c)
2019-11-25MLK-22575-1: ASoC: fsl_easrc: configure slot according to pf memory sizeShengjiu Wang
The maximum prefilter memory size is 6144 entry, it is not allowed to require memory size exceed this size. When we calculate the available channel in the context processer, we need to consider if the prefilter memory is not enough for the maxmum channels, then we need to reduce the channels in this context processor, move the left channel to another context processor. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 5a15d81a1c19c07846cc394d935524566bcfb298)
2019-11-25MLK-22521-3: ASoC: fsl_easrc: Add multi context for bps_iec958Shengjiu Wang
Add multi context support for bps_iec958 Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com> (cherry picked from commit 131408cc5b9f7957502c01bf3bff18c9c4b4fca0)
2019-11-25MLK-22521-2: ASoC: fsl_easrc: support configuration of channel statusShengjiu Wang
support configuration of channel status for IEC958 Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com> (cherry picked from commit 92aee54f844098080c878ae59878dadab28d8ea3)
2019-11-25MLK-22521-1: ASoC: fsl_easrc:IEC958 is only supported for outputShengjiu Wang
IEC958 is only supported for output according to the RM Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com> (cherry picked from commit bf36888526c420776c18ca06548b9d3798200beb)
2019-11-25MLK-22463-1: ASoC: fsl_easrc: Fix logically dead codeShengjiu Wang
Fix logically dead code which is reported by coverity Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25MLK-22333: ASoC: fsl_easrc: Support FLOAT_LEShengjiu Wang
The audio float point data range is (-1, 1), the asrc would output all zero for float point input and integer output case, that is to drop the fractional part of the data directly. In order to support float to int conversion or int to float conversion we need to do special operation on the coefficient to enlarge/reduce the data to the expected range. For float to int case: Up sampling: 1. Create a 1 tap filter with center tap (only tap) of 2^31 in 64 bits floating point. double value = (double)(((uint64_t)1) << 31); 2. Program 1 tap prefilter with center tap above. Down sampling, 1. If the filter is single stage filter, add "shift" to the exponent of stage 1 coefficients. 2. If the filter is two stage filter , add "shift" to the exponent of stage 2 coefficients. The "shift" is 31, same for int16, int24, int32 case. For int to float case: Up sampling: 1. Create a 1 tap filter with center tap (only tap) of 2^-31 in 64 bits floating point. 2. Program 1 tap prefilter with center tap above. Down sampling, 1. If the filter is single stage filter, subtract "shift" to the exponent of stage 1 coefficients. 2. If the filter is two stage filter , subtract "shift" to the exponent of stage 2 coefficients. The "shift" is 15,23,31, different for int16, int24, int32 case. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 8a18a7a2dd1184814c6c61cb116f4d868b003447)
2019-11-25MLK-22243: fsl_easrc: Add lock to protect configuration of slotShengjiu Wang
With multi-instance case, the fsl_easrc_config_slot will be called in parallel, the fsl_easrc_slot is independent with context, so we need to lock to protect the access of fsl_easrc_config_slot, otherwise, the slot configuration will be fail for some instance that cause "input DMA task timeout". Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-22161: fsl_easrc: Remove float point format supportShengjiu Wang
The input audio float data range is normalized to (-1, 1), but the hardware will drop to fractional part if output format is integer format, so the output is all zero, which does not flow the normal audio case, that to shift the output to Q15/Q31. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25MLK-22160: fsl_easrc: Remove Big endian supportShengjiu Wang
The hardware don't support big endian format. which only support bit reverse. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25MLK-22168: fsl_easrc:Add error handle for format checkShengjiu Wang
Add error handler for format check, if the format is not supported should return error, otherwise it cause "input DMA task timeout" Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25MLK-21940-4: ASoC: fsl_easrc: Support the m2m functionShengjiu Wang
EASRC M2M function is not able to put upstream due to its self-designed ioctl protocol. So make a single patch for it and make it merge into P2P driver as simply as possible. The patch can only be maintained internally unless some one designs a new protocol or implement the originally protocol by using some common approach provided by Linux Kernel. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25MLK-21940-3: ASoC: fsl_easrc: Add support new asrc moduleShengjiu Wang
EASRC (Enhanced ASRC) is a new IP module found on i.MX8 MN. It is different from old ASRC module. The primary features for the EASRC are as follows: 1. 4 Contexts - groups of channels with an independent time base 2. Fully independent and concurrent context control 3. Simultaneous processing of up to 32 audio channels 4. Programmable filter charachteristics for each context 5. 32, 24, 20, and 16-bit fixed point audio sample support 6. 32-bit floating point audio sample support 7. 8kHz to 384kHz sample rate 8. 1/16 to 8x sample rate conversion ratio 9. Software control of fine conversion ratio Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>