aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-generic-dmaengine-pcm.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-10-09ASoC: dmaengine: Document support for TX only or RX only streamsMark Brown1-0/+5
We intentionally do not return an error if we get a permanent failure from dma_request_chan() in order to support systems which have TX only or RX only channels. Add a comment documenting this. Reported-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Link: https://lore.kernel.org/r/20201008161105.21804-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-31ASoC: core: Two step component registrationCezary Rojewski1-5/+9
Modify snd_soc_add_component so it calls snd_soc_component_initialize no longer and thus providing true two-step registration. Drivers may choose to change component's fields before actually adding it to ASoC subsystem. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20200731144146.6678-4-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-23ASoC: soc-xxx: add asoc_substream_to_rtd()Kuninori Morimoto1-2/+2
Current soc-xxx are getting rtd from substream by rtd = substream->private_data; But, getting data from "private_data" is very unclear. This patch adds asoc_substream_to_rtd() macro which is easy to understand that rtd from substream. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87wo2z0yve.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-07ASoC: core: Remove only the registered component in devm functionsMaxime Ripard1-1/+1
The ASoC devm_ functions that register a component (devm_snd_soc_register_component and devm_snd_dmaengine_pcm_register) will clean their component by running snd_soc_unregister_component. snd_soc_unregister_component will then remove all the components for the device that was used to register the component in the first place. However, some drivers register several components (such as a DAI and a dmaengine PCM) on the same device, and if the dmaengine PCM is registered first, then the DAI will be cleaned up first and snd_dmaengine_pcm_unregister will be called next. snd_dmaengine_pcm_unregister will then lookup the dmaengine PCM component on the device, and if there's one unregister that component and release its dmaengine channels. That doesn't happen in practice though since the first call to snd_soc_unregister_component removed all the components, so we never get the chance to release the dmaengine channels. In order to fix this, instead of removing all the components for a given device, we can simply remove the component that was registered in the first place. We should have the same number of component registration than we have components, so it should work just fine. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://lore.kernel.org/r/20200707074237.287171-1-maxime@cerno.tech Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-12ASoC: dmaengine_pcm: export soc_component_to_pcmShengjiu Wang1-12/+0
In DPCM case, Front-End needs to get the dma chan which has been requested by Back-End and reuse it. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/429c6ae1f3c5b47eb893f475d531d71cdcfe34c0.1591947428.git.shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-04-14ASoC: soc: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointerKuninori Morimoto1-3/+3
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/87imimboli.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-26ASoC: Return error if the function does not support multi-cpuBard Liao1-0/+18
Multi cpu is not supported by all functions yet. Add an error message and return. Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20200225133917.21314-6-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-18ASoC: soc-generic-dmaengine-pcm: use for_each_pcm_streams() macroKuninori Morimoto1-5/+3
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/87zhdhaa8x.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-23Merge branch 'asoc-5.6' into asoc-nextMark Brown1-12/+2
2020-01-21ASoC: soc-generic-dmaengine-pcm: Fix error handlingShengjiu Wang1-7/+9
Remove the return value checking, that is to align with the code before adding snd_dmaengine_pcm_refine_runtime_hwparams function. Otherwise it causes a regression on the HiKey board: [ 17.721424] hi6210_i2s f7118000.i2s: ASoC: can't open component f7118000.i2s: -6 Fixes: e957204e732b ("ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparams") Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reported-by: John Stultz <john.stultz@linaro.org> Link: https://lore.kernel.org/r/1579505286-32085-1-git-send-email-shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-11ASoC: generic-dmaengine-pcm: Use managed buffer allocationTakashi Iwai1-10/+2
Clean up the driver with the new managed buffer allocation API. The hw_free callback became superfluous and got dropped. Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20191210142614.19405-11-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-11ASoC: generic-dmaengine: Drop superfluous ioctl PCM opsTakashi Iwai1-2/+0
ASoC PCM core deals the empty ioctl field now as default. Let's kill the redundant lines. Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20191210145406.21419-16-tiwai@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-15ASoC: dmaengine: Use dma_request_chan() directly for channel requestPeter Ujfalusi1-1/+1
dma_request_slave_channel_reason() is: #define dma_request_slave_channel_reason(dev, name) \ dma_request_chan(dev, name) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20191113095445.3211-2-peter.ujfalusi@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-08ASoC: soc-generic-dmaengine-pcm: remove snd_pcm_opsKuninori Morimoto1-51/+51
snd_pcm_ops is no longer needed. Let's use component driver callback. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/875zl790cb.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-01ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparamsShengjiu Wang1-55/+6
When set the runtime hardware parameters, we may need to query the capability of DMA to complete the parameters. This patch is to Extract this operation from dmaengine_pcm_set_runtime_hwparams function to a separate function snd_dmaengine_pcm_refine_runtime_hwparams, that other components which need this feature can call this function. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> Reviewed-by: Nicolin Chen <nicoleotsuka@gmail.com> Link: https://lore.kernel.org/r/d728f65194e9978cbec4132b522d4fed420d704a.1569493933.git.shengjiu.wang@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-11ASoC: dmaengine: Replace strncpy() with strscpy_pad() for pcm->namePeter Ujfalusi1-3/+3
While it is safe to use strncpy in this case, the advice is to move to strscpy or strscpy_pad. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20190911083331.16801-1-peter.ujfalusi@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09ASoC: dmaengine: Make the pcm->name equal to pcm->id if the name is not setPeter Ujfalusi1-0/+6
Some tools use the snd_pcm_info_get_name() to try to identify PCMs or for other purposes. Currently it is left empty with the dmaengine-pcm, in this case copy the pcm->id string as pcm->name. For example IGT is using this to find the HDMI PCM for testing audio on it. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reported-by: Arthur She <arthur.she@linaro.org> Link: https://lore.kernel.org/r/20190906055524.7393-1-peter.ujfalusi@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-28Merge tag 'asoc-v5.1-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-nextTakashi Iwai1-9/+4
ASoC: More changes for v5.1 Another batch of changes for ASoC, no big core changes - it's mainly small fixes and improvements for individual drivers. - A big refresh and cleanup of the Samsung drivers, fixing a number of issues which allow the driver to be used with a wider range of userspaces. - Fixes for the Intel drivers to make them more standard so less likely to get bitten by core issues. - New driver for Cirrus Logic CS35L26.
2019-02-14ASoC: dmaengine: Remove unused SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flagSylwester Nawrocki1-17/+4
There is now no users of this flag so remove it together with related code. The chan_name field of snd_dmaengine_dai_dma_data data structure is not removed as it is still in use by the PXA platform. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-12ASoC: dmaengine: Extend use of chan_names provided in custom DMA configSylwester Nawrocki1-2/+9
There are currently two ways to specify custom DMA channel names: - through the SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag and snd_dmaengine_dai_dma_data data structure, - through chan_names field of struct snd_dmaengine_pcm_config. In order to replace the DAI DMA data method with the custom DMA config one on non-DT platforms the dmaengine_pcm_new() function is extended to also consider channel names specified in the custom DMA config. If both config->chan_names and dma_data->chan_name are provided the former will be used. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-12ASoC: dmaengine: Improve of_node test in dmaengine_pcm_request_chan_of()Sylwester Nawrocki1-1/+2
Currently when of_node of the "PCM" device is null dmaengine_pcm_request_chan_of() function will bail out, including cases when custom DMA device is intended to be used. To have the channels properly requested when custom DMA device is provided extend the of_node test to also consider dma_dev->of_node. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-06ASoC: dmaengine: Drop superfluous PCM preallocation error checksTakashi Iwai1-4/+1
snd_pcm_lib_preallocate_pages() and co always succeed, so the error check is simply redundant. Drop it. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-18Merge tag 'dmaengine-4.19-rc1' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds1-1/+1
Pull DMAengine updates from Vinod Koul: "This round brings couple of framework changes, a new driver and usual driver updates: - new managed helper for dmaengine framework registration - split dmaengine pause capability to pause and resume and allow drivers to report that individually - update dma_request_chan_by_mask() to handle deferred probing - move imx-sdma to use virt-dma - new driver for Actions Semi Owl family S900 controller - minor updates to intel, renesas, mv_xor, pl330 etc" * tag 'dmaengine-4.19-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (46 commits) dmaengine: Add Actions Semi Owl family S900 DMA driver dt-bindings: dmaengine: Add binding for Actions Semi Owl SoCs dmaengine: sh: rcar-dmac: Should not stop the DMAC by rcar_dmac_sync_tcr() dmaengine: mic_x100_dma: use the new helper to simplify the code dmaengine: add a new helper dmaenginem_async_device_register dmaengine: imx-sdma: add memcpy interface dmaengine: imx-sdma: add SDMA_BD_MAX_CNT to replace '0xffff' dmaengine: dma_request_chan_by_mask() to handle deferred probing dmaengine: pl330: fix irq race with terminate_all dmaengine: Revert "dmaengine: mv_xor_v2: enable COMPILE_TEST" dmaengine: mv_xor_v2: use {lower,upper}_32_bits to configure HW descriptor address dmaengine: mv_xor_v2: enable COMPILE_TEST dmaengine: mv_xor_v2: move unmap to before callback dmaengine: mv_xor_v2: convert callback to helper function dmaengine: mv_xor_v2: kill the tasklets upon exit dmaengine: mv_xor_v2: explicitly freeup irq dmaengine: sh: rcar-dmac: Add dma_pause operation dmaengine: sh: rcar-dmac: add a new function to clear CHCR.DE with barrier dmaengine: idma64: Support dmaengine_terminate_sync() dmaengine: hsu: Support dmaengine_terminate_sync() ...
2018-07-26ASoC: dmaengine: Use standard pcm_format_to_bits() macroTakashi Iwai1-1/+1
The conversion from PCM format type to bits needs an explicit cast, and it'll be uglier. Since we have a standard macro for that, let's use it instead. This patch fixes the sparse warning: sound/soc/soc-generic-dmaengine-pcm.c:200:63: warning: restricted snd_pcm_format_t degrades to integer Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: dmaengine: Fix missing __user prefix in copy_user callbackTakashi Iwai1-5/+4
It seems that __user prefix was forgotten to be added to dmaengine_copy_user callback while we refactored the user-copy PCM core. This patch adds the missing prefix, remove the superfluous cast, and add the needed cast (__force is needed for downgrading from user pointer to kernel pointer), too. Spotted by a sparse warning like: sound/soc/soc-generic-dmaengine-pcm.c:397:27: warning: incorrect type in initializer (incompatible argument 4 (different address spaces)) Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-09dmaengine: add support for reporting pause and resume separatelyMarek Szyprowski1-1/+1
'cmd_pause' DMA channel capability means that respective DMA engine supports both pausing and resuming given DMA channel. However, in some cases it is important to know if DMA channel can be paused without the need to resume it. This is a typical requirement for proper residue reading on transfer timeout in UART drivers. There are also some DMA engines with limited hardware, which doesn't really support resuming. Reporting pause and resume capabilities separately allows UART drivers to properly check for the really required capabilities and operate in DMA mode also in systems with limited DMA hardware. On the other hand drivers, which rely on full channel suspend/resume support, should now check for both 'pause' and 'resume' features. Existing clients of dma_get_slave_caps() have been checked and the only driver which rely on proper channel resuming is soc-generic-dmaengine-pcm driver, which has been updated to check the newly added capability. Existing 'cmd_pause' now only indicates that DMA engine support pausing given DMA channel. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
2018-07-02ASoC: soc-generic-dmaengine-pcm: convert to SPDX identifiersKuninori Morimoto1-14/+5
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-26ASoC: Revert "ASoC: soc-generic-dmaengine-pcm: Fix error handling"Fabio Estevam1-2/+1
This reverts commit f91b1e73ccde71d4bc69ae10d475196df38844ab. As explained by Lars-Peter Clausen: "This creates a resource leak. dmaengine_pcm_request_chan_of() requests bothtransmit and receive channels. It might return with an error if one of them fails, but the other one succeeded. In this case we need to call dmaengine_pcm_release_chan() to free the requested channel" So revert the commit. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-26ASoC: dmaengine_pcm: add processing supportOlivier Moysan1-2/+60
Allow dmaengine client to optionally register a processing callback. This callback is intended to apply processing on samples in buffer copied from/to user space, before/after DMA transfer. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-26ASoC: soc-generic-dmaengine-pcm: Fix sparse warningsFabio Estevam1-2/+3
Currently the following sparse warnings are observed: sound/soc/soc-generic-dmaengine-pcm.c:185:34: warning: restricted snd_pcm_format_t degrades to integer sound/soc/soc-generic-dmaengine-pcm.c:186:66: warning: incorrect type in argument 1 (different base types) sound/soc/soc-generic-dmaengine-pcm.c:186:66: expected restricted snd_pcm_format_t [usertype] format sound/soc/soc-generic-dmaengine-pcm.c:186:66: got int [signed] [assigned] i Fix it by changing the loop variable to be of 'snd_pcm_format_t'. Also introduce a SNDRV_PCM_FORMAT_FIRST label, which corresponds to the first member (index 0) of the snd_pcm_format_t formats. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-26ASoC: soc-generic-dmaengine-pcm: Fix error handlingFabio Estevam1-1/+2
When dmaengine_pcm_request_chan_of() fails it should release the previously acquired resources, which in this case is to call kfree(pcm), so jump to the correct point in the error path. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-26Merge branch 'topic/component-platform' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into HEADMark Brown1-22/+33
2018-02-22ASoC: soc-generic-dmaengine-pcm: Add a DMA debugfs_prefix entryFabio Estevam1-0/+3
After the conversion from platform to component the following warnings are seen: fsl-ssi-dai 2028000.ssi: ASoC: Failed to create component debugfs directory fsl-spdif-dai 2004000.spdif: ASoC: Failed to create component debugfs directory As explained by Mark Brown: "It's a legit warning - we shouldn't really be creating two components for the same device. However this is a bit of a corner case as it's the dmaengine platform driver which is kind of a virtual device, it's not really the device that we use with DMA that's being represented but rather the link between that and the DMA controller." Disambiguate the DMA component name by adding a "dma" debugfs_prefix entry. Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: soc-generic-dmaengine-pcm: replace platform to componentKuninori Morimoto1-22/+33
Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-01-23ASoC: Revert "Drop SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flag"Sylwester Nawrocki1-1/+11
This reverts commit c6644119a3f80ea644bde10009d5e1013b5aff29 and restores the ability to specify DMA channel names per DAI dma_data. Unfortunately the functionality removed in the patch being reverted cannot be entirely replaced by specifying DMA channel names in struct snd_dmaengine_pcm_config as that does not cover devices with more than 2 DMA channels. Together with patch "ASoC: Revert "samsung: Remove unneeded initialization of chan_name"" this fixes broken sound on the s3c24xx SoC platforms. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-25ASoC: Drop SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME flagSylwester Nawrocki1-12/+1
Since commit 194c7dea00c68c1b1f8ff26304fa937a006f66dd "ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_config" custom DMA channels can be also specified in chan_names[] field of struct snd_dmaengine_pcm_config. This patch removes chan_name field of struct snd_dmaengine_dai_dma_data as it is now unused. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-27ASoC: dmaengine_pcm: Add support for packed transfersMatthias Reichl1-23/+34
dmaengine_pcm currently only supports setups where FIFO reads/writes correspond to exactly one sample, eg 16-bit sample data is transferred via 16-bit FIFO accesses, 32-bit data via 32-bit accesses. This patch adds support for setups with fixed width FIFOs where multiple samples are packed into a larger word. For example setups with a 32-bit wide FIFO register that expect 16-bit sample transfers to be done with the left+right sample data packed into a 32-bit word. Support for packed transfers is controlled via the SND_DMAENGINE_PCM_DAI_FLAG_PACK flag in snd_dmaengine_dai_dma_data.flags If this flag is set dmaengine_pcm doesn't put any restriction on the supported formats and sets the DMA transfer width to undefined. This means control over the constraints is now transferred to the DAI driver and it's responsible to provide proper configuration and check for possible corner cases that aren't handled by the ALSA core. Signed-off-by: Matthias Reichl <hias@horus.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: dmaengine_pcm: Make FLAG_NO_RESIDUE internalLars-Peter Clausen1-11/+14
Whether residue can be reported or not is not a property of the audio controller but of the DMA controller. The FLAG_NO_RESIDUE was initially added when the DMAengine framework had no support for describing the residue reporting capabilities of the controller. Support for this was added quite a while ago and recently the DMAengine framework started to complain if a driver does not describe its capabilities and a lot of patches have been merged that add support for this where it was missing. So it should be safe to assume that driver on actively used platforms properly implement the DMA capabilities API. This patch makes the FLAG_NO_RESIDUE internal and no longer allows audio controller drivers to manually set the flag. If a DMA driver against expectations does not support reporting its capabilities for now the generic DMAengine PCM driver will now emit a warning and simply assume that residue reporting is not supported. In the future this might be changed to aborting with an error. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-18Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dmaLinus Torvalds1-1/+1
Pull dmaengine updates from Vinod Koul: "This update brings: - the big cleanup up by Maxime for device control and slave capabilities. This makes the API much cleaner. - new IMG MDC driver by Andrew - new Renesas R-Car Gen2 DMA Controller driver by Laurent along with bunch of fixes on rcar drivers - odd fixes and updates spread over driver" * 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma: (130 commits) dmaengine: pl330: add DMA_PAUSE feature dmaengine: pl330: improve pl330_tx_status() function dmaengine: rcar-dmac: Disable channel 0 when using IOMMU dmaengine: rcar-dmac: Work around descriptor mode IOMMU errata dmaengine: rcar-dmac: Allocate hardware descriptors with DMAC device dmaengine: rcar-dmac: Fix oops due to unintialized list in error ISR dmaengine: rcar-dmac: Fix spinlock issues in interrupt dmaenegine: edma: fix sparse warnings dmaengine: rcar-dmac: Fix uninitialized variable usage dmaengine: shdmac: extend PM methods dmaengine: shdmac: use SET_RUNTIME_PM_OPS() dmaengine: pl330: fix bug that cause start the same descs in cyclic dmaengine: at_xdmac: allow muliple dwidths when doing slave transfers dmaengine: at_xdmac: simplify channel configuration stuff dmaengine: at_xdmac: introduce save_cc field dmaengine: at_xdmac: wait for in-progress transaction to complete after pausing a channel ioat: fail self-test if wait_for_completion times out dmaengine: dw: define DW_DMA_MAX_NR_MASTERS dmaengine: dw: amend description of dma_dev field dmatest: move src_off, dst_off, len inside loop ...
2015-01-05ASoC: dmaengine: Remove unnecessary snd_pcm_lib_preallocate_free_for_all()Lars-Peter Clausen1-13/+2
The ALSA core takes care that all preallocated memory is freed when the PCM itself is freed. There is no need to do this manually in the driver. Similarly there is also no need to do it on the pcm_new() error path as the PCM will be freed if a error is returned. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-22dmaengine: Make the destination abbreviation coherentMaxime Ripard1-1/+1
The dmaengine header abbreviates destination as at least two different strings. Make a coherent use of a single one. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Mark Brown <broonie@kernel.org> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
2014-08-19ASoC: Consolidate platform and CODEC probe/removeLars-Peter Clausen1-1/+3
The platform and CODEC probe and remove code is now largely identical. This patch consolidates it at the component level. The resulting code is slightly larger due to all the boiler plate code setting up the indirection for the table based control and DAPM registration. Once all drivers have been update to no longer use the snd_soc_codec_driver and snd_soc_platform_driver specific fields for this the indirection can be removed again. This patch contains two noteworthy hacks that are only meant to be temporary to be able to update drivers and the core in separate incremental patches. The first hack is related to that some DPCM platforms expect that the DAPM widgets for the DAIs of a snd_soc_component are created in the DAPM context of the snd_soc_platform that has the same parent device. For handling this the steal_sibling_dai_widgets attribute is introduced. It gets set for snd_soc_platforms that register DAPM elements. When creating the DAI widgets for a component this flag is checked and if it is found on one of the siblings the component will not create any DAI widgets in its own DAPM context. If the attribute is set on a platform it will look for siblings components and create DAI widgets for them in its own context. The fix for this will be to update the offending drivers to only register a single component rather than two. The second hack deals with the fact that the ASoC card suspend and resume code still needs a list of CODECs that have been registered for the card. To handle this the generic probe and remove path have a check to see if the component is CODEC and if yes add/remove it to the card's CODEC list. While it is possible to clean up the suspend/resume code to not need the CODEC list anymore this is a bit of a chicken and egg problem since it will become easier to clean up the suspend/resume code once there is a unified component layer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-04ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizesPeter Ujfalusi1-1/+36
Based on the dma_slave_caps's addr_widths queried from the dma driver prepare the hw.formats mask to include only formats which is supported by the DMA engine. In case the dma driver does not implement the slave_caps the default assumption is that it supports 1, 2 and 4 bytes widths. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-16ASoC: core: Fix possible NULL pointer dereference of pcm->configXiubo Li1-3/+6
Since the soc generic dmaengine pcm driver allows using the defualt settings, so the pcm->config maybe NULL. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14ASoC: generic-dmaengine-pcm: Check DMA residue granularityLars-Peter Clausen1-0/+27
The dmaengine framework now exposes the granularity with which it is able to report the transfer residue for a certain DMA channel. Check the granularity in the generic dmaengine PCM driver and a) Set the SNDRV_PCM_INFO_BATCH if the granularity is per period or worse. b) Fallback to the (race condition prone) period counting if the driver does not support any residue reporting. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14ASoC: generic-dmaengine-pcm: Check NO_RESIDUE flag at runtimeLars-Peter Clausen1-24/+15
Currently we have two different snd_soc_platform_driver structs in the generic dmaengine PCM driver. One for dmaengine drivers that support residue reporting and one for those which do not. When registering the PCM component we check whether the NO_RESIDUE flag is set or not and use the corresponding snd_soc_platform_driver. This patch modifies the driver to only have one snd_soc_platform_driver struct where the pointer() callback checks the NO_RESIDUE flag at runtime. This allows us to set the NO_RESIDUE flag after the PCM component has been registered. This becomes necessary when querying whether the dmaengine driver supports residue reporting from the dmaengine driver itself since the DMA channel might only be requested after the PCM component has been registered. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17ASoC: dmaengine: Add config parameter NULL check.Xiubo Li1-2/+2
Because the "ASoC: dmaengine-pcm: Provide default config" has provided us one defualt config of DMA. When using this, the config parameter of devm_snd_dmaengine_pcm_register() will be NULL, so here we need to have a check before using it. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-11ASoC: dmaengine: fix deferred probe detectionStephen Warren1-1/+1
Check the return value of dma_request_slave_channel_reason() to see if deferred probe happens, not the variable the return value will be assigned to later. Reported-by: kbuild test robot <fengguang.wu@intel.com> Fixes: 5eda87b890f8 ("ASoC: dmaengine: support deferred probe for DMA channels") Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-11ASoC: dmaengine: support deferred probe for DMA channelsStephen Warren1-4/+16
Enhance dmaengine_pcm_request_chan_of() to support deferred probe for DMA channels, by using the new dma_request_slave_channel_or_err() API. This prevents snd_dmaengine_pcm_register() from succeeding without acquiring DMA channels due to the relevant DMA controller not yet being registered. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_configStephen Warren1-2/+16
Add fields to struct snd_dmaengine_pcm_config to allow custom: - DMA channel names. This is useful when the default "tx" and "rx" channel names don't apply, for example if a HW module supports multiple channels, each having different DMA channel names. This is the case with the FIFOs in Tegra's AHUB. This new facility can replace SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME. - DMA device This allows requesting DMA channels for a device other than the device which is registering the "PCM" driver. This is quite unusual, but is currently useful on Tegra. In much HW, and in Tegra20, each DAI HW module contains its own FIFOs which DMA writes to. However, in Tegra30, the DMA FIFOs were split out AHUB HW module, which then routes the data through a cross-bar, and into the DAI HW modules. However, the current ASoC driver structure does not expose this detail, and acts as if the FIFOs are still part of the DAI HW modules. Consequently, the "PCM" driver is registered with the DAI HW module, yet the DMA channels must be looked up in the AHUB HW module's device tree node. This new config field allows that to happen. Eventually, the Tegra drivers will be reworked to fully expose the AHUB, and this config field can be removed. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>