msm-pcm-hostless.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* Copyright (c) 2011-2014, 2017-2018, The Linux Foundation. All rights reserved.
  3. */
  4. #include <linux/init.h>
  5. #include <linux/module.h>
  6. #include <linux/platform_device.h>
  7. #include <linux/of_device.h>
  8. #include <sound/core.h>
  9. #include <sound/soc.h>
  10. #include <sound/pcm.h>
  11. #define DRV_NAME "msm-pcm-hostless"
  12. static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
  13. {
  14. if (!substream) {
  15. pr_err("%s: invalid params\n", __func__);
  16. return -EINVAL;
  17. }
  18. pm_qos_remove_request(&substream->latency_pm_qos_req);
  19. return 0;
  20. }
  21. static const struct snd_pcm_ops msm_pcm_hostless_ops = {
  22. .prepare = msm_pcm_hostless_prepare
  23. };
  24. static struct snd_soc_component_driver msm_soc_hostless_component = {
  25. .name = DRV_NAME,
  26. .ops = &msm_pcm_hostless_ops,
  27. };
  28. static int msm_pcm_hostless_probe(struct platform_device *pdev)
  29. {
  30. pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
  31. return snd_soc_register_component(&pdev->dev,
  32. &msm_soc_hostless_component,
  33. NULL, 0);
  34. }
  35. static int msm_pcm_hostless_remove(struct platform_device *pdev)
  36. {
  37. snd_soc_unregister_component(&pdev->dev);
  38. return 0;
  39. }
  40. static const struct of_device_id msm_pcm_hostless_dt_match[] = {
  41. {.compatible = "qcom,msm-pcm-hostless"},
  42. {}
  43. };
  44. static struct platform_driver msm_pcm_hostless_driver = {
  45. .driver = {
  46. .name = "msm-pcm-hostless",
  47. .owner = THIS_MODULE,
  48. .of_match_table = msm_pcm_hostless_dt_match,
  49. },
  50. .probe = msm_pcm_hostless_probe,
  51. .remove = msm_pcm_hostless_remove,
  52. };
  53. int __init msm_pcm_hostless_init(void)
  54. {
  55. return platform_driver_register(&msm_pcm_hostless_driver);
  56. }
  57. void msm_pcm_hostless_exit(void)
  58. {
  59. platform_driver_unregister(&msm_pcm_hostless_driver);
  60. }
  61. MODULE_DESCRIPTION("Hostless platform driver");
  62. MODULE_LICENSE("GPL v2");