summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_asrc_dma.c
AgeCommit message (Collapse)Author
2020-10-08Merge tag 'v5.4.70' into imx_5.4.yJason Liu
* tag 'v5.4.70': (3051 commits) Linux 5.4.70 netfilter: ctnetlink: add a range check for l3/l4 protonum ep_create_wakeup_source(): dentry name can change under you... ... Conflicts: arch/arm/mach-imx/pm-imx6.c arch/arm64/boot/dts/freescale/imx8mm-evk.dts arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts drivers/crypto/caam/caamalg.c drivers/gpu/drm/imx/dw_hdmi-imx.c drivers/gpu/drm/imx/imx-ldb.c drivers/gpu/drm/imx/ipuv3/ipuv3-crtc.c drivers/mmc/host/sdhci-esdhc-imx.c drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c drivers/net/ethernet/freescale/enetc/enetc.c drivers/net/ethernet/freescale/enetc/enetc_pf.c drivers/thermal/imx_thermal.c drivers/usb/cdns3/ep0.c drivers/xen/swiotlb-xen.c sound/soc/fsl/fsl_esai.c sound/soc/fsl/fsl_sai.c Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>
2020-06-24ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failedXiyu Yang
[ Upstream commit 36124fb19f1ae68a500cd76a76d40c6e81bee346 ] fsl_asrc_dma_hw_params() invokes dma_request_channel() or fsl_asrc_get_dma_channel(), which returns a reference of the specified dma_chan object to "pair->dma_chan[dir]" with increased refcnt. The reference counting issue happens in one exception handling path of fsl_asrc_dma_hw_params(). When config DMA channel failed for Back-End, the function forgets to decrease the refcnt increased by dma_request_channel() or fsl_asrc_get_dma_channel(), causing a refcnt leak. Fix this issue by calling dma_release_channel() when config DMA channel failed. Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com> Link: https://lore.kernel.org/r/1590415966-52416-1-git-send-email-xiyuyang19@fudan.edu.cn Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-05LF-601-2: ASoC: fsl_asrc_dma: use dma channel of ESAI for p2pShengjiu Wang
With EDMA, there is two dma channels can be used for p2p, one is from ASRC, one is from another peripheral (ESAI or SAI) previously we select the dma channel of ASRC, but find an issue for ideal ratio case, there is no control for data copy speed, the speed is faster than expected. So we switch to dma channel of peripheral (ESAI or SAI), that copy speed of DMA is controlled by data consumption speed in the peripheral FIFO. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
2019-11-25ASoC: fsl_asrc: Get dma channel from Front-End for p2pShengjiu Wang
Previously we get dma channel for p2p from Back-End, but the channel maybe allocated already by Back-End platform driver. that we switch to imx-pcm-dma-v2. But if we get dma channel for p2p from Front-End then we don't need to switch to imx-pcm-dma-v2 driver. this more formal Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-16956: ASoC: fsl_asrc: fix error with S24_3LE format bitstreamShengjiu Wang
The error is "aplay: pcm_write:2023: write error: Input/output error" query the caps of dma, then update the hw parameters according the caps. for EDMA can't support 24bit sample, but we didn't add any constraint, that cause issues. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
2019-11-25MLK-14528: ASoC: sdma: Update period/segment max bytes (part 1)Daniel Baluta
Commit 665ced16cf044 ("MLK-10050 dma: imx-sdma: add support for sdma memory copy") enforces maximum SDMA buffer descriptor length at 65532, but doesn't update period_bytes_max or max_segment size in DMA drivers. Thus, resulting in the following bug: $ arecord -Dhw:0,0 -r 192000 -f S20_3LE -c 1 -d 10 audio192k20b1c.wav imx-sdma: SDMA channel 5: maximum period size exceeded: 65534 > 65532 Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> [ Aisheng: split rpmsg changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25ASoC: fsl: refine the asrc driver for imx8qmViorel Suman
The clock source of ASRC in imx8qm is changed. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
2019-11-25MLK-11915-11 ASoC: fsl_asrc_dma: check the return value for ↵Zidan Wang
snd_pcm_hw_constraint_integer() check the return value for snd_pcm_hw_constraint_integer(). Reported by Coverity. Signed-off-by: Zidan Wang <zidan.wang@freescale.com> (cherry picked from commit 26f8fea617fcebd8835f660534a988c58b9f0517)
2019-11-25MLK-11259-2: ASoC: fsl: enable ASRC p2p for ssi->wm8962 (part 2)Dong Aisheng
Enable ASRC p2p for ssi->wm8962, base on the new p2p script, which support to select dualfifo for source/destination device. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> [ Aisheng: split imx-wm8962.c changes ] Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2018-09-20ASoC: add for_each_dpcm_be() macroKuninori Morimoto
To be more readable code, this patch adds new for_each_dpcm_be() macro, and replace existing code to it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-24ASoC: fsl_asrc: Switch to SPDX identifierFabio Estevam
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: fsl: asrc: replace platform to componentKuninori Morimoto
Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-17ASoC: fsl: make snd_pcm_hardware constBhumika Goyal
Make these const as they are only passed as the 2nd argument to the function snd_soc_set_runtime_hwparams, which is const. Done using Coccinelle. Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-15ASoC: Freescale: Delete an error message for a failed memory allocation in ↵Markus Elfring
three functions Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-21ASoC: fsl_asrc_dma: use correct direction enum typeStefan Agner
The direction argument is of type enum dma_transfer_direction, and not enum dma_data_direction. The enumeration values are the same so this did not had an effect in practise. Signed-off-by: Stefan Agner <stefan@agner.ch> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12ASoC: constify snd_pcm_ops structuresJulia Lawall
Check for snd_pcm_ops structures that are only stored in the ops field of a snd_soc_platform_driver structure or passed as the third argument to snd_pcm_set_ops. The corresponding field or parameter is declared const, so snd_pcm_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_pcm_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_platform_driver e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i; expression e1, e2; position p; @@ snd_pcm_set_ops(e1, e2, &i@p) @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_pcm_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_pcm_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-04ASoC: fsl_sarc_dma: Check pair before using itNicolin Chen
The patch 3117bb3109dc: "ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers" from Jul 29, 2014, leads to the following Smatch complaint: sound/soc/fsl/fsl_asrc_dma.c:304 fsl_asrc_dma_shutdown() warn: variable dereferenced before check 'pair' (see line 302) sound/soc/fsl/fsl_asrc_dma.c 301 struct fsl_asrc_pair *pair = runtime->private_data; 302 struct fsl_asrc *asrc_priv = pair->asrc_priv; ^^^^^^^^^^^^^^^ Dereference. 303 304 if (pair && asrc_priv->pair[pair->index] == pair) ^^^^ Check. 305 asrc_priv->pair[pair->index] = NULL; 306 So we just let the driver check pair before using it. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-29ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform driversNicolin Chen
The Asynchronous Sample Rate Converter (ASRC) converts the sampling rate of a signal associated with an input clock into a signal associated with a different output clock. The driver currently works as a Front End of DPCM with other Back Ends DAI links such as ESAI<->CS42888 and SSI<->WM8962 and SAI. It converts the original sample rate to a common rate supported by Back Ends for playback while converts the common rate of Back Ends to a desired rate for capture. It has 3 pairs to support three different substreams within totally 10 channels. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Reviewed-by: Varka Bhadram <varkabhadram@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>