msm_stub.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (c) 2011-2014, 2017 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/platform_device.h>
  13. #include <linux/slab.h>
  14. #include <linux/module.h>
  15. #include <linux/of_device.h>
  16. #include <sound/core.h>
  17. #include <sound/pcm.h>
  18. #include <sound/soc.h>
  19. /* A dummy driver useful only to advertise hardware parameters */
  20. static struct snd_soc_dai_driver msm_stub_dais[] = {
  21. {
  22. .name = "msm-stub-rx",
  23. .playback = { /* Support maximum range */
  24. .stream_name = "Playback",
  25. .channels_min = 1,
  26. .channels_max = 8,
  27. .rates = SNDRV_PCM_RATE_8000_48000,
  28. .formats = SNDRV_PCM_FMTBIT_S16_LE,
  29. },
  30. },
  31. {
  32. .name = "msm-stub-tx",
  33. .capture = { /* Support maximum range */
  34. .stream_name = "Record",
  35. .channels_min = 1,
  36. .channels_max = 8,
  37. .rates = SNDRV_PCM_RATE_8000_48000,
  38. .formats = (SNDRV_PCM_FMTBIT_S16_LE |
  39. SNDRV_PCM_FMTBIT_S24_LE),
  40. },
  41. },
  42. };
  43. static struct snd_soc_codec_driver soc_msm_stub = {};
  44. static int msm_stub_dev_probe(struct platform_device *pdev)
  45. {
  46. dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev));
  47. return snd_soc_register_codec(&pdev->dev,
  48. &soc_msm_stub, msm_stub_dais, ARRAY_SIZE(msm_stub_dais));
  49. }
  50. static int msm_stub_dev_remove(struct platform_device *pdev)
  51. {
  52. snd_soc_unregister_codec(&pdev->dev);
  53. return 0;
  54. }
  55. static const struct of_device_id msm_stub_codec_dt_match[] = {
  56. { .compatible = "qcom,msm-stub-codec", },
  57. {}
  58. };
  59. static struct platform_driver msm_stub_driver = {
  60. .driver = {
  61. .name = "msm-stub-codec",
  62. .owner = THIS_MODULE,
  63. .of_match_table = msm_stub_codec_dt_match,
  64. },
  65. .probe = msm_stub_dev_probe,
  66. .remove = msm_stub_dev_remove,
  67. };
  68. static int __init msm_stub_init(void)
  69. {
  70. return platform_driver_register(&msm_stub_driver);
  71. }
  72. module_init(msm_stub_init);
  73. static void __exit msm_stub_exit(void)
  74. {
  75. platform_driver_unregister(&msm_stub_driver);
  76. }
  77. module_exit(msm_stub_exit);
  78. MODULE_DESCRIPTION("Generic MSM CODEC driver");
  79. MODULE_LICENSE("GPL v2");