dmaengine.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * dmaengine.c - Samsung dmaengine wrapper
  3. *
  4. * Author: Mark Brown <broonie@linaro.org>
  5. * Copyright 2013 Linaro
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. */
  17. #include <linux/module.h>
  18. #include <sound/core.h>
  19. #include <sound/pcm.h>
  20. #include <sound/pcm_params.h>
  21. #include <sound/dmaengine_pcm.h>
  22. #include <sound/soc.h>
  23. #include "dma.h"
  24. int samsung_asoc_dma_platform_register(struct device *dev, dma_filter_fn filter,
  25. const char *tx, const char *rx)
  26. {
  27. unsigned int flags = SND_DMAENGINE_PCM_FLAG_COMPAT;
  28. struct snd_dmaengine_pcm_config *pcm_conf;
  29. pcm_conf = devm_kzalloc(dev, sizeof(*pcm_conf), GFP_KERNEL);
  30. if (!pcm_conf)
  31. return -ENOMEM;
  32. pcm_conf->prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
  33. pcm_conf->compat_filter_fn = filter;
  34. pcm_conf->chan_names[SNDRV_PCM_STREAM_PLAYBACK] = tx;
  35. pcm_conf->chan_names[SNDRV_PCM_STREAM_CAPTURE] = rx;
  36. return devm_snd_dmaengine_pcm_register(dev, pcm_conf, flags);
  37. }
  38. EXPORT_SYMBOL_GPL(samsung_asoc_dma_platform_register);
  39. MODULE_AUTHOR("Mark Brown <broonie@linaro.org>");
  40. MODULE_DESCRIPTION("Samsung dmaengine ASoC driver");
  41. MODULE_LICENSE("GPL");