Commit graph

60 commits

Author SHA1 Message Date
Mark Brown 90130d2e8f 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>
2013-10-24 11:03:19 +01:00
Mark Brown ea73b7ddf1 ASoC: dmaengine: Support custom channel names
Some devices have more than just simple TX and RX DMA channels, for example
modern Samsung I2S IPs support a secondary transmit DMA stream which is
mixed into the primary stream during playback. Allow such devices to
specify the names of the channels to be requested in their dma_data.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-10-24 09:52:14 +01:00
Lars-Peter Clausen fa654e0853 ASoC: dmaengine-pcm: Provide default config
This patch adds some default settings for the generic dmaengine PCM driver for
the case that no config has been supplied. The following defaults are used:
	* Use snd_dmaengine_pcm_prepare_slave_config for preparing the DMA slave
	  config.
	* 512kB for the prealloc buffer size. This value has been chosen based on
	  'feels about right' and is not backed up by any scientific facts. We
	  may need to come up with something smarter in the future but it should
	  work fine for now.

With this infrastructure in place we can finally write DAI drivers which are
independent of the DMA controller they are connected to. This is e.g. useful if
the DAI IP core is reused across different SoCs, but the SoCs uses different DMA
controllers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-19 21:26:06 +01:00
Lars-Peter Clausen c0de42bf59 ASoC: dmaengine-pcm: Add support for querying DMA capabilities
Currently each platform making use the the generic dmaengine PCM driver still
needs to provide a custom snd_pcm_hardware struct which specifies the
capabilities of the DMA controller, e.g. the maximum period size that can be
supported. This patch adds code which uses the newly introduced
dma_get_slave_caps() API to query this information from the dmaengine driver.
The new code path will only be taken if the 'pcm_hardware' field of the
snd_dmaengine_pcm_config struct is NULL.

The patch also introduces a new 'fifo_size' field to the
snd_dmaengine_dai_dma_data struct which is used to initialize the
snd_pcm_hardware 'fifo_size' field and needs to be set by the DAI driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-19 21:26:06 +01:00
Shawn Guo 6f1fd93e30 ASoC: generic-dmaengine-pcm: call dma_request_slave_channel()
dma_request_slave_channel() is a more appropriate API for dmaengine
clients that adopt generic DMA bindings to call.  Let's use it instead
of of_dma_request_slave_channel() to save <linux/of_dma.h> include.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:34:29 +01:00
Shawn Guo 19133d2cfd ASoC: generic-dmaengine-pcm: use a more common dma name
The examples in Documentation/devicetree/bindings/dma/dma.txt recommends
the name for dma channel doing both RX and TX to be "rx-tx".  This
becomes a common pattern that has been adopted by platforms that
converts to generic DMA bindings.  Let's follow this common pattern in
generic-dmaengine-pcm.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-23 11:34:09 +01:00
Lars-Peter Clausen d1e1406c6e ASoC: generic-dmaengine-pcm: Add support for half-duplex
Some platforms which are half-duplex share the same DMA channel between the
playback and capture stream. Add support for this to the generic dmaengine PCM
driver.

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>
2013-04-22 11:27:04 +01:00
Lars-Peter Clausen 610f780050 ASoC: dmaengine-pcm: Add support for platforms which can't report residue
Unfortunately there are still quite a few platforms with a dmaengine driver
which do not support reporting the number of bytes left to transfer. If we want
to support these platforms in the generic dmaengine PCM driver we have.

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>
2013-04-17 14:25:56 +01:00
Lars-Peter Clausen c999836d37 ASoC: dmaengine_pcm: Add support for compat platforms
Add support for platforms which don't use devicetree yet or have to optionally
support a non-devicetree way to request the DMA channel. The patch adds the
compat_request_channel and compat_filter_fn callbacks to the
snd_dmaengine_pcm_config struct. If the compat_request_channel is implemented it
will be used to request the DMA channel. If not dma_request_channel with
compat_filter_fn as the filter function will be used to request the channel.

The patch also exports the snd_dmaengine_pcm_request_chan() function, since
compat platforms will want to use it to request their DMA channel.

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>
2013-04-17 14:21:36 +01:00
Lars-Peter Clausen 28c4468b00 ASoC: Add a generic dmaengine_pcm driver
This patch adds a generic dmaengine PCM driver. It builds on top of the
dmaengine PCM library and adds the missing pieces like DMA channel management,
buffer management and channel configuration. It will be able to replace the
majority of the existing platform specific dmaengine based PCM drivers.
Devicetree is used to map the DMA channels to the PCM device.

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>
2013-04-17 14:21:25 +01:00