msm_stub.c 2.3 KB

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