dp_audio.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _DP_AUDIO_H_
  7. #define _DP_AUDIO_H_
  8. #include <linux/platform_device.h>
  9. #include "dp_panel.h"
  10. #include "dp_catalog.h"
  11. /**
  12. * struct dp_audio
  13. * @lane_count: number of lanes configured in current session
  14. * @bw_code: link rate's bandwidth code for current session
  15. * @tui_active: set to true if TUI is active in the system
  16. */
  17. struct dp_audio {
  18. u32 lane_count;
  19. u32 bw_code;
  20. bool tui_active;
  21. #if defined(CONFIG_SECDP_SWITCH)
  22. bool has_mst;
  23. #endif
  24. /**
  25. * on()
  26. *
  27. * Notifies user mode clients that DP is powered on, and that audio
  28. * playback can start on the external display.
  29. *
  30. * @dp_audio: an instance of struct dp_audio.
  31. *
  32. * Returns the error code in case of failure, 0 in success case.
  33. */
  34. int (*on)(struct dp_audio *dp_audio);
  35. /**
  36. * off()
  37. *
  38. * Notifies user mode clients that DP is shutting down, and audio
  39. * playback should be stopped on the external display.
  40. *
  41. * @dp_audio: an instance of struct dp_audio.
  42. * @skip_wait: flag to skip any waits
  43. *
  44. * Returns the error code in case of failure, 0 in success case.
  45. */
  46. int (*off)(struct dp_audio *dp_audio, bool skip_wait);
  47. };
  48. /**
  49. * dp_audio_get()
  50. *
  51. * Creates and instance of dp audio.
  52. *
  53. * @pdev: caller's platform device instance.
  54. * @panel: an instance of dp_panel module.
  55. * @catalog: an instance of dp_catalog_audio module.
  56. *
  57. * Returns the error code in case of failure, otherwize
  58. * an instance of newly created dp_module.
  59. */
  60. struct dp_audio *dp_audio_get(struct platform_device *pdev,
  61. struct dp_panel *panel,
  62. struct dp_catalog_audio *catalog);
  63. /**
  64. * dp_audio_put()
  65. *
  66. * Cleans the dp_audio instance.
  67. *
  68. * @dp_audio: an instance of dp_audio.
  69. */
  70. void dp_audio_put(struct dp_audio *dp_audio);
  71. #if defined(CONFIG_SECDP_SWITCH)
  72. int secdp_audio_register_switch(struct dp_audio *dp_audio);
  73. #endif
  74. #endif /* _DP_AUDIO_H_ */