msm_stub.c 1.9 KB

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