History log of /linux-master/sound/soc/fsl/imx-pcm-dma.c
Revision Date Author Comments
# 9b3ff637 23-Feb-2022 Sascha Hauer <s.hauer@pengutronix.de>

ASoC: fsl: Drop unused argument from imx_pcm_dma_init()

Since 70d435ba1cd ("ASoC: imx-pcm-dma: simplify pcm_config") the size
argument to imx_pcm_dma_init() is unused, so drop it. Also remove the
now unused defines that the users of imx_pcm_dma_init() used to pass the
size argument

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220223130625.3430589-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 70d435ba 08-Mar-2017 Lucas Stach <l.stach@pengutronix.de>

ASoC: imx-pcm-dma: simplify pcm_config

The generic snd_dmaengine_pcm is able to retrieve all the needed
information from the attached dmaengine and is in fact able to
provide much more accurate flags to userspace, like the SDMA engine
being only able to operate in batch mode.

To avoid any future inconsistencies between the dmaengine and the
pcm_config, rip out the fixed config and rely on the core to fill
in the right flags derived from the dmaengine information.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 10974ccf 19-Dec-2015 Julia Lawall <Julia.Lawall@lip6.fr>

ASoC: imx-pcm-dma: add NULL test

Add NULL test on call to devm_kzalloc.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x;
@@

* x = devm_kzalloc(...);
... when != x == NULL
*x
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 0d69e0dd 23-Jun-2015 Shengjiu Wang <shengjiu.wang@freescale.com>

ASoC: fsl: Add dedicated DMA buffer size for each cpu dai

As the ssi is not the only cpu dai, there are esai, spdif, sai.
and imx_pcm_dma can be used by all of them. Especially ESAI need
a larger DMA buffer size. So Add dedicated DMA buffer for each cpu
dai.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Acked-by: Timur Tabi <timur@tabi.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d1a792f3 25-Jun-2014 Russell King - ARM Linux <linux@arm.linux.org.uk>

Update imx-sdma cyclic handling to report residue

I received a report this morning from one of the Novena developers that
the behaviour of the iMX6 ASoC codec driver (using imx-pcm-dma.c) was
sub-optimal under high system load.

While there are issues relating to system load remaining, upon reviewing
the ASoC imx-pcm-dma.c driver, it was noticed that it not using the
residue support, because SDMA doesn't support it. This has the effect
that SDMA has to make multiple calls into the ASoC and ALSA code, one
for each period.

Since ALSA's snd_pcm_elapsed() does not need to be called multiple times
and it is entirely sufficient to call it once to update ALSA with the
current buffer position via the pointer method, we can do better here.
We can also avoid stopping the DMA entirely, just like real cyclic DMA
implementations behave. While this means that we replay some old samples,
this is a nicer behaviour than having audio stop and restart.

The changes to achieve this are relatively minor - imx-sdma.c can track
where the DMA is to the nearest descriptor boundary - it does this
already when deciding how many callbacks to issue. In doing this,
buf_tail always points at the descriptor which will complete next.

The residue is defined by the bytes remaining to the end of the buffer,
when the buffer is viewed as a single block of memory [start...end].
So, when we start out, there's a full buffer worth of residue, and this
counts down as we approach the end of the buffer, eventually becoming
zero at the end, before returning to the full buffer worth when we
wrap back to the start.

Moving the walking of the descriptors into the interrupt handler means
that we can update the BD_DONE flag at interrupt time, thus avoiding
a delayed tasklet stopping the cyclic DMA.

This means that the residue can be calculated from (total descriptors -
buf_tail) * descriptor size. This is what the change below does. We
update imx-pcm-dma.c to remove the NO_RESIDUE flag since we now provide
the residue.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>


# e9ffb5ba 24-Apr-2014 Nicolin Chen <Guangyu.Chen@freescale.com>

ASoC: fsl: Drop formats limitation for imx-pcm-dma.c

Now ASoC core is getting the intersection of supported formats not only
from CPU and CODEC dai's but also from DMA's. However, there should be
no specific width limitation from SDMA side.

So drop it. Otherwise, we would only support S16_LE format for all i.MX
platforms.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# b0a23b8b 06-Jan-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: fsl: Don't set unused struct snd_pcm_hardware fields

The ASoC core assumes that the PCM component of the ASoC card transparently
moves data around and does not impose any restrictions on the memory layout or
the transfer speed. It ignores all fields from the snd_pcm_hardware struct for
the PCM driver that are related to this. Setting these fields in the PCM driver
might suggest otherwise though, so rather not set them.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 7e6d18ac 28-Nov-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: fsl: Use devm_snd_dmaengine_pcm_register()

Makes the code shorter.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 90130d2e 19-Oct-2013 Mark Brown <broonie@linaro.org>

ASoC: dmaengine: Use filter_data rather than dma_data for compat requests

When using the legacy filter function channel requests we currently pass
the audio specific struct snd_dmaengine_dai_dma_data which isn't likely to
be helpful for actual filtering. Since there's already a field in the
structure called filter_data clearly intended for use here convert the
driver to use that.

All existing users of plain filter functions have been converted to use
an explicit compat function to override this behaviour except i.MX which
is working around this issue in its filter function and is updated to
just use filter_data directly here.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>


# 3c1c32d3 15-Aug-2013 Mark Brown <broonie@linaro.org>

ASoC: imx: Add MODULE_LICENSE to DMA drivers

Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Mark Brown <broonie@linaro.org>


# c364796a 20-Jun-2013 Markus Pargmann <mpa@pengutronix.de>

ASoC: imx-pcm-dma: DT support

This patch removes the NO_DT flag. The pdev pointer may have a proper
of_node with the dmas property, so we can use it to request DMA
channels.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Timur Tabi <timur@tabi.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# dbdf6b54 24-Apr-2013 Shawn Guo <shawn.guo@linaro.org>

ASoC: fsl: remove imx-pcm driver

With imx-pcm-dma moving to generic dmaengine pcm driver and the removal
of imx-pcm-audio/imx-fiq-pcm-audio platform device use, now imx-pcm
driver contains a few functions that are only used by imx-pcm-fiq.c.
Move these functions into imx-pcm-fiq.c and remove imx-pcm.c completely.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# adaa3229 15-Apr-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: imx: Use generic dmaengine PCM

Use the generic dmaengine PCM driver instead of a custom implementation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 7c1c1d4a 15-Apr-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dmaengine-pcm: Make requesting the DMA channel at PCM open optional

Refactor the dmaengine PCM library to allow the DMA channel to be requested
before opening a PCM substream. snd_dmaengine_pcm_open() now expects a DMA
channel instead of a filter function and filter parameter as its parameters.
snd_dmaengine_pcm_close() is updated to not release the DMA channel. This allows
a dmaengine based PCM driver to request its channels before the substream is
opened.

The patch also introduces two new functions, snd_dmaengine_pcm_open_request_chan()
and snd_dmaengine_pcm_close_release_chan(), which have the same signature and
behaviour of the old snd_dmaengine_pcm_{open,close}() and internally use the new
variants of these functions. All users of snd_dmaengine_pcm_{open,close}() are
updated to use snd_dmaengine_pcm_open_request_chan() and
snd_dmaengine_pcm_close_release_chan().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a8909c9b 03-Apr-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: fsl: Use common DAI DMA data struct

Use the common DAI DMA data struct for fsl/imx, this allows us to use the common
helper function to configure the DMA slave config based on the DAI DMA data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5fa70f71 03-Apr-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dmaengine_pcm: Setup device_fc in snd_hwparams_to_dma_slave_config

Usually device_fc should be set to false for audio DMAs. Initialize it in a
common place so drivers don't have to do this manually.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 312bb4f6 22-Mar-2013 Lars-Peter Clausen <lars@metafoo.de>

ASoC: imx-pcm: Embed the imx_dma_data struct in the dma_params struct

Currently the imx_dma_data struct, which gets passed to the dmaengine driver, is
allocated and constructed in the pcm driver from the data stored in the
dma_params struct. The dma_params struct gets passed to the pcm driver from the
dai driver. Instead of going this route of indirection embed the dma_data struct
directly into the dma_params struct and let the dai driver fill it in. This
allows us to simplify the imx-pcm-dma driver quite a bit, since it doesn't have
care about memory managing the imx_dma_data struct anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 1927661b 27-Jan-2013 Shawn Guo <shawn.guo@linaro.org>

ASoC: fsl: fix snd-soc-imx-pcm module build

When building modules with CONFIG_SND_IMX_SOC=m in imx_v6_v7_defconfig,
we will see the following link error.

LD [M] sound/soc/fsl/snd-soc-fsl-ssi.o
LD [M] sound/soc/fsl/snd-soc-fsl-utils.o
LD [M] sound/soc/fsl/snd-soc-imx-ssi.o
LD [M] sound/soc/fsl/snd-soc-imx-audmux.o
LD [M] sound/soc/fsl/snd-soc-imx-pcm.o
sound/soc/fsl/imx-pcm-dma.o: In function `init_module':
imx-pcm-dma.c:(.init.text+0x0): multiple definition of `init_module'
sound/soc/fsl/imx-pcm-fiq.o:imx-pcm-fiq.c:(.init.text+0x0): first defined here
sound/soc/fsl/imx-pcm-dma.o: In function `cleanup_module':
imx-pcm-dma.c:(.exit.text+0x0): multiple definition of `cleanup_module'
sound/soc/fsl/imx-pcm-fiq.o:imx-pcm-fiq.c:(.exit.text+0x0): first defined here
make[4]: *** [sound/soc/fsl/snd-soc-imx-pcm.o] Error 1

The module snd-soc-imx-pcm is designed to link imx-pcm.o with
imx-pcm-dma.o or imx-pcm-fiq.o depending on if option SND_SOC_IMX_PCM_DMA
or SND_SOC_IMX_PCM_FIQ is enabled. Both imx-pcm-dma and imx-pcm-fiq
register their own module_platform_driver. However, these two options
are not mutually exclusive and can be enabled together. And that's
why we see above multiple init_module definition error.

Instead of having both imx-pcm-dma and imx-pcm-fiq register their
own platform_driver, we should do only once in imx-pcm.c. Using
platform_device_id to distinguish between imx-pcm-dma and imx-pcm-fiq,
we can run-time call imx-pcm-dma/fiq specific initialization in .probe
hook to have module snd-soc-imx-pcm work for both cases.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a0a3d518 07-Dec-2012 Bill Pemberton <wfp5p@virginia.edu>

ASoC: fsl: remove __dev* attributes

CONFIG_HOTPLUG is going away as an option. As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f31e08e1 18-Sep-2012 Richard Zhao <richard.zhao@freescale.com>

ASoC: imx-pcm-dma: open function failed when snd_dmaengine_pcm_open fail

snd_imx_open should return error code returned by snd_dmaengine_pcm_open.

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# d37777a1 18-Sep-2012 Richard Zhao <richard.zhao@freescale.com>

ASoC: imx-pcm-dma: check kzalloc return value in function snd_imx_open

It fixed smatch warning:
sound/soc/fsl/imx-pcm-dma.c:112 snd_imx_open() error: potential null dereference 'dma_data'. (kzalloc returns null)

Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 82906b13 24-Aug-2012 Arnd Bergmann <arnd@arndb.de>

ARM: imx: move platform_data definitions

Platform data for device drivers should be defined in
include/linux/platform_data/*.h, not in the architecture
and platform specific directories.

This moves such data out of the imx include directories

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Acked-by: Sascha Hauer <kernel@pengutronix.de>
Acked-by: Vinod Koul <vinod.koul@linux.intel.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Dan Williams <djbw@fb.com>
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
Cc: Chris Ball <cjb@laptop.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Alan Cox <alan@linux.intel.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Javier Martin <javier.martin@vista-silicon.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>


# 9883ab22 11-Jun-2012 Lars-Peter Clausen <lars@metafoo.de>

ASoC: dmaengine-pcm: Rename and deprecate snd_dmaengine_pcm_pointer

Currently the sound dmaengine pcm helper functions implement the pcm_pointer
callback by trying to count the number of elapsed periods. This is done by
advancing the stream position in the dmaengine callback by one period.
Unfortunately there is no guarantee that the callback will be called for each
elapsed period. It may be possible that under high system load it is only called
once for multiple elapsed periods. This patch renames the current implementation
and documents its shortcomings and that it should not be used anymore in new
drivers.

The next patch will introduce a new snd_dmaengine_pcm_pointer which will be
implemented based on querying the current stream position from the dma device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by Vinod Koul <vinod.koul@linux.intel.com>
Acked-by: Dong Aisheng <dong.aisheng@linaro.org
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b46b373f 28-Mar-2012 Shawn Guo <shawn.guo@linaro.org>

ASoC: fsl: assign dma peripheral type according to bus topology

The dma peripheral_type for SSI should be IMX_DMATYPE_SSI_SP if the SSI
is on SPBA bus.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f19493a3 16-Mar-2012 Shawn Guo <shawn.guo@linaro.org>

ASoC: fsl: rename imx-pcm Kconfig options and filename

Rename a couple of imx-pcm Kconfig options and filename to get them
well named and less confusing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>