msm_stub.c 2.0 KB

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