summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-devres.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-12-12 00:39:48 +0100
committerStephen Warren <swarren@nvidia.com>2013-12-12 00:39:48 +0100
commitf229a93051c967e38850f0c213a0bf945e7c3c12 (patch)
tree51ea08cb9354f462a9a7785da869429e18b9a5d6 /sound/soc/soc-devres.c
parentMerge branch 'for-3.14/deps-from-dma-of' into for-3.14/dmas-resets-rework (diff)
parentASoC: dmaengine: fix deferred probe detection (diff)
downloadlinux-f229a93051c967e38850f0c213a0bf945e7c3c12.tar.xz
linux-f229a93051c967e38850f0c213a0bf945e7c3c12.zip
Merge tag 'asoc-dma-v3.14' into for-3.14/dmas-resets-rework
ASoC: dma: Generic ASoC dmaengine driver enhancements This is the work so far on dmaengine for v3.14, it is being cross merged into the Tegra tree to support a large DMA overhaul there. The main additions are a change in the DMA request API which allows better interaction at system startup using deferred probes and methods for overriding the default device and channel names used to request DMA.
Diffstat (limited to 'sound/soc/soc-devres.c')
-rw-r--r--sound/soc/soc-devres.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
index 3449c1e909ae..7ac745df1412 100644
--- a/sound/soc/soc-devres.c
+++ b/sound/soc/soc-devres.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <sound/soc.h>
+#include <sound/dmaengine_pcm.h>
static void devm_component_release(struct device *dev, void *res)
{
@@ -84,3 +85,43 @@ int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)
return ret;
}
EXPORT_SYMBOL_GPL(devm_snd_soc_register_card);
+
+#ifdef CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM
+
+static void devm_dmaengine_pcm_release(struct device *dev, void *res)
+{
+ snd_dmaengine_pcm_unregister(*(struct device **)res);
+}
+
+/**
+ * devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration
+ * @dev: The parent device for the PCM device
+ * @config: Platform specific PCM configuration
+ * @flags: Platform specific quirks
+ *
+ * Register a dmaengine based PCM device with automatic unregistration when the
+ * device is unregistered.
+ */
+int devm_snd_dmaengine_pcm_register(struct device *dev,
+ const struct snd_dmaengine_pcm_config *config, unsigned int flags)
+{
+ struct device **ptr;
+ int ret;
+
+ ptr = devres_alloc(devm_dmaengine_pcm_release, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ return -ENOMEM;
+
+ ret = snd_dmaengine_pcm_register(dev, config, flags);
+ if (ret == 0) {
+ *ptr = dev;
+ devres_add(dev, ptr);
+ } else {
+ devres_free(ptr);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(devm_snd_dmaengine_pcm_register);
+
+#endif