tegra_pcm.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * tegra_pcm.c - Tegra PCM driver
  3. *
  4. * Author: Stephen Warren <swarren@nvidia.com>
  5. * Copyright (C) 2010,2012 - NVIDIA, Inc.
  6. *
  7. * Based on code copyright/by:
  8. *
  9. * Copyright (c) 2009-2010, NVIDIA Corporation.
  10. * Scott Peterson <speterson@nvidia.com>
  11. * Vijay Mali <vmali@nvidia.com>
  12. *
  13. * Copyright (C) 2010 Google, Inc.
  14. * Iliyan Malchev <malchev@google.com>
  15. *
  16. * This program is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU General Public License
  18. * version 2 as published by the Free Software Foundation.
  19. *
  20. * This program is distributed in the hope that it will be useful, but
  21. * WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23. * General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  28. * 02110-1301 USA
  29. *
  30. */
  31. #include <linux/module.h>
  32. #include <sound/core.h>
  33. #include <sound/pcm.h>
  34. #include <sound/pcm_params.h>
  35. #include <sound/soc.h>
  36. #include <sound/dmaengine_pcm.h>
  37. #include "tegra_pcm.h"
  38. static const struct snd_pcm_hardware tegra_pcm_hardware = {
  39. .info = SNDRV_PCM_INFO_MMAP |
  40. SNDRV_PCM_INFO_MMAP_VALID |
  41. SNDRV_PCM_INFO_INTERLEAVED,
  42. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  43. .channels_min = 2,
  44. .channels_max = 2,
  45. .period_bytes_min = 1024,
  46. .period_bytes_max = PAGE_SIZE,
  47. .periods_min = 2,
  48. .periods_max = 8,
  49. .buffer_bytes_max = PAGE_SIZE * 8,
  50. .fifo_size = 4,
  51. };
  52. static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = {
  53. .pcm_hardware = &tegra_pcm_hardware,
  54. .prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
  55. .compat_filter_fn = NULL,
  56. .prealloc_buffer_size = PAGE_SIZE * 8,
  57. };
  58. int tegra_pcm_platform_register(struct device *dev)
  59. {
  60. return snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config,
  61. SND_DMAENGINE_PCM_FLAG_NO_DT |
  62. SND_DMAENGINE_PCM_FLAG_COMPAT);
  63. }
  64. EXPORT_SYMBOL_GPL(tegra_pcm_platform_register);
  65. void tegra_pcm_platform_unregister(struct device *dev)
  66. {
  67. return snd_dmaengine_pcm_unregister(dev);
  68. }
  69. EXPORT_SYMBOL_GPL(tegra_pcm_platform_unregister);
  70. MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
  71. MODULE_DESCRIPTION("Tegra PCM ASoC driver");
  72. MODULE_LICENSE("GPL");