ep93xx-pcm.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * linux/sound/arm/ep93xx-pcm.c - EP93xx ALSA PCM interface
  3. *
  4. * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
  5. * Copyright (C) 2006 Applied Data Systems
  6. *
  7. * Rewritten for the SoC audio subsystem (Based on PXA2xx code):
  8. * Copyright (c) 2008 Ryan Mallon
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/dmaengine.h>
  18. #include <sound/pcm.h>
  19. #include <sound/soc.h>
  20. #include <sound/dmaengine_pcm.h>
  21. #include <linux/platform_data/dma-ep93xx.h>
  22. #include "ep93xx-pcm.h"
  23. static const struct snd_pcm_hardware ep93xx_pcm_hardware = {
  24. .info = (SNDRV_PCM_INFO_MMAP |
  25. SNDRV_PCM_INFO_MMAP_VALID |
  26. SNDRV_PCM_INFO_INTERLEAVED |
  27. SNDRV_PCM_INFO_BLOCK_TRANSFER),
  28. .buffer_bytes_max = 131072,
  29. .period_bytes_min = 32,
  30. .period_bytes_max = 32768,
  31. .periods_min = 1,
  32. .periods_max = 32,
  33. .fifo_size = 32,
  34. };
  35. static bool ep93xx_pcm_dma_filter(struct dma_chan *chan, void *filter_param)
  36. {
  37. struct ep93xx_dma_data *data = filter_param;
  38. if (data->direction == ep93xx_dma_chan_direction(chan)) {
  39. chan->private = data;
  40. return true;
  41. }
  42. return false;
  43. }
  44. static const struct snd_dmaengine_pcm_config ep93xx_dmaengine_pcm_config = {
  45. .pcm_hardware = &ep93xx_pcm_hardware,
  46. .compat_filter_fn = ep93xx_pcm_dma_filter,
  47. .prealloc_buffer_size = 131072,
  48. };
  49. int devm_ep93xx_pcm_platform_register(struct device *dev)
  50. {
  51. return devm_snd_dmaengine_pcm_register(dev,
  52. &ep93xx_dmaengine_pcm_config,
  53. SND_DMAENGINE_PCM_FLAG_NO_DT |
  54. SND_DMAENGINE_PCM_FLAG_COMPAT);
  55. }
  56. EXPORT_SYMBOL_GPL(devm_ep93xx_pcm_platform_register);
  57. MODULE_AUTHOR("Ryan Mallon");
  58. MODULE_DESCRIPTION("EP93xx ALSA PCM interface");
  59. MODULE_LICENSE("GPL");