dmaengine.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0
  2. //
  3. // dmaengine.c - Samsung dmaengine wrapper
  4. //
  5. // Author: Mark Brown <[email protected]>
  6. // Copyright 2013 Linaro
  7. #include <linux/module.h>
  8. #include <sound/core.h>
  9. #include <sound/pcm.h>
  10. #include <sound/pcm_params.h>
  11. #include <sound/dmaengine_pcm.h>
  12. #include <sound/soc.h>
  13. #include "dma.h"
  14. int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
  15. const char *tx, const char *rx,
  16. struct device *dma_dev)
  17. {
  18. struct snd_dmaengine_pcm_config *pcm_conf;
  19. pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
  20. if (!pcm_conf)
  21. return -ENOMEM;
  22. pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
  23. pcm_conf->compat_filter_fn = filter;
  24. pcm_conf->dma_dev = dma_dev;
  25. pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
  26. pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
  27. return devm_snd_dmaengine_pcm_register(dev, pcm_conf,
  28. SND_DMAENGINE_PCM_FLAG_COMPAT);
  29. }
  30. EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
  31. MODULE_AUTHOR("Mark Brown <[email protected]>");
  32. MODULE_DESCRIPTION("Samsung dmaengine ASoC driver");
  33. MODULE_LICENSE("GPL");