udma-pcm.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2020 Texas Instruments Incorporated - https://www.ti.com
  4. * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
  5. */
  6. #include <linux/module.h>
  7. #include <sound/core.h>
  8. #include <sound/pcm.h>
  9. #include <sound/pcm_params.h>
  10. #include <sound/soc.h>
  11. #include <sound/dmaengine_pcm.h>
  12. #include "udma-pcm.h"
  13. static const struct snd_pcm_hardware udma_pcm_hardware = {
  14. .info = SNDRV_PCM_INFO_MMAP |
  15. SNDRV_PCM_INFO_MMAP_VALID |
  16. SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
  17. SNDRV_PCM_INFO_NO_PERIOD_WAKEUP |
  18. SNDRV_PCM_INFO_INTERLEAVED,
  19. .buffer_bytes_max = SIZE_MAX,
  20. .period_bytes_min = 32,
  21. .period_bytes_max = SZ_64K,
  22. .periods_min = 2,
  23. .periods_max = UINT_MAX,
  24. };
  25. static const struct snd_dmaengine_pcm_config udma_dmaengine_pcm_config = {
  26. .pcm_hardware = &udma_pcm_hardware,
  27. .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
  28. };
  29. int udma_pcm_platform_register(struct device *dev)
  30. {
  31. return devm_snd_dmaengine_pcm_register(dev, &udma_dmaengine_pcm_config,
  32. 0);
  33. }
  34. EXPORT_SYMBOL_GPL(udma_pcm_platform_register);
  35. MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
  36. MODULE_DESCRIPTION("UDMA PCM ASoC platform driver");
  37. MODULE_LICENSE("GPL v2");