msm-dai-stub-v2.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* Copyright (c) 2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/module.h>
  14. #include <linux/device.h>
  15. #include <linux/platform_device.h>
  16. #include <sound/core.h>
  17. #include <sound/pcm.h>
  18. #include <sound/soc.h>
  19. static int msm_dai_stub_set_channel_map(struct snd_soc_dai *dai,
  20. unsigned int tx_num, unsigned int *tx_slot,
  21. unsigned int rx_num, unsigned int *rx_slot)
  22. {
  23. pr_debug("%s:\n", __func__);
  24. return 0;
  25. }
  26. static struct snd_soc_dai_ops msm_dai_stub_ops = {
  27. .set_channel_map = msm_dai_stub_set_channel_map,
  28. };
  29. static struct snd_soc_dai_driver msm_dai_stub_dai = {
  30. .playback = {
  31. .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
  32. SNDRV_PCM_RATE_16000,
  33. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  34. .channels_min = 1,
  35. .channels_max = 2,
  36. .rate_min = 8000,
  37. .rate_max = 48000,
  38. },
  39. .capture = {
  40. .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
  41. SNDRV_PCM_RATE_16000,
  42. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  43. .channels_min = 1,
  44. .channels_max = 2,
  45. .rate_min = 8000,
  46. .rate_max = 48000,
  47. },
  48. .ops = &msm_dai_stub_ops,
  49. };
  50. static __devinit int msm_dai_stub_dev_probe(struct platform_device *pdev)
  51. {
  52. int rc = 0;
  53. dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
  54. if (pdev->dev.of_node)
  55. dev_set_name(&pdev->dev, "%s", "msm-dai-stub");
  56. pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
  57. rc = snd_soc_register_dai(&pdev->dev, &msm_dai_stub_dai);
  58. return rc;
  59. }
  60. static __devexit int msm_dai_stub_dev_remove(struct platform_device *pdev)
  61. {
  62. pr_debug("%s:\n", __func__);
  63. snd_soc_unregister_dai(&pdev->dev);
  64. return 0;
  65. }
  66. static const struct of_device_id msm_dai_stub_dt_match[] = {
  67. {.compatible = "qcom,msm-dai-stub"},
  68. {}
  69. };
  70. MODULE_DEVICE_TABLE(of, msm_dai_stub_dt_match);
  71. static struct platform_driver msm_dai_stub_driver = {
  72. .probe = msm_dai_stub_dev_probe,
  73. .remove = msm_dai_stub_dev_remove,
  74. .driver = {
  75. .name = "msm-dai-stub",
  76. .owner = THIS_MODULE,
  77. .of_match_table = msm_dai_stub_dt_match,
  78. },
  79. };
  80. static int __init msm_dai_stub_init(void)
  81. {
  82. pr_debug("%s:\n", __func__);
  83. return platform_driver_register(&msm_dai_stub_driver);
  84. }
  85. module_init(msm_dai_stub_init);
  86. static void __exit msm_dai_stub_exit(void)
  87. {
  88. pr_debug("%s:\n", __func__);
  89. platform_driver_unregister(&msm_dai_stub_driver);
  90. }
  91. module_exit(msm_dai_stub_exit);
  92. /* Module information */
  93. MODULE_DESCRIPTION("MSM Stub DSP DAI driver");
  94. MODULE_LICENSE("GPL v2");