rockchip_pcm.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2018 Rockchip Electronics Co. Ltd.
  4. */
  5. #include <linux/device.h>
  6. #include <linux/init.h>
  7. #include <linux/module.h>
  8. #include <sound/core.h>
  9. #include <sound/pcm.h>
  10. #include <sound/soc.h>
  11. #include <sound/dmaengine_pcm.h>
  12. #include "rockchip_pcm.h"
  13. static const struct snd_pcm_hardware snd_rockchip_hardware = {
  14. .info = SNDRV_PCM_INFO_MMAP |
  15. SNDRV_PCM_INFO_MMAP_VALID |
  16. SNDRV_PCM_INFO_PAUSE |
  17. SNDRV_PCM_INFO_RESUME |
  18. SNDRV_PCM_INFO_INTERLEAVED,
  19. .period_bytes_min = 32,
  20. .period_bytes_max = 8192,
  21. .periods_min = 1,
  22. .periods_max = 52,
  23. .buffer_bytes_max = 64 * 1024,
  24. .fifo_size = 32,
  25. };
  26. static const struct snd_dmaengine_pcm_config rk_dmaengine_pcm_config = {
  27. .pcm_hardware = &snd_rockchip_hardware,
  28. .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
  29. .prealloc_buffer_size = 32 * 1024,
  30. };
  31. int rockchip_pcm_platform_register(struct device *dev)
  32. {
  33. return devm_snd_dmaengine_pcm_register(dev, &rk_dmaengine_pcm_config,
  34. SND_DMAENGINE_PCM_FLAG_COMPAT);
  35. }
  36. EXPORT_SYMBOL_GPL(rockchip_pcm_platform_register);
  37. MODULE_LICENSE("GPL v2");