sde_vbif.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __SDE_VBIF_H__
  6. #define __SDE_VBIF_H__
  7. #include "sde_kms.h"
  8. struct sde_vbif_set_ot_params {
  9. u32 xin_id;
  10. u32 num;
  11. u32 width;
  12. u32 height;
  13. u32 frame_rate;
  14. bool rd;
  15. bool is_wfd;
  16. u32 vbif_idx;
  17. u32 clk_ctrl;
  18. };
  19. struct sde_vbif_set_memtype_params {
  20. u32 xin_id;
  21. u32 vbif_idx;
  22. u32 clk_ctrl;
  23. bool is_cacheable;
  24. };
  25. /**
  26. * struct sde_vbif_set_xin_halt_params - xin halt parameters
  27. * @vbif_idx: vbif identifier
  28. * @xin_id: client interface identifier
  29. * @clk_ctrl: clock control identifier of the xin
  30. * @forced_on: whether or not previous call to xin halt forced the clocks on,
  31. * only applicable to xin halt disable calls
  32. * @enable: whether to enable/disable xin halts
  33. */
  34. struct sde_vbif_set_xin_halt_params {
  35. u32 vbif_idx;
  36. u32 xin_id;
  37. u32 clk_ctrl;
  38. bool forced_on;
  39. bool enable;
  40. };
  41. /**
  42. * struct sde_vbif_set_qos_params - QoS remapper parameter
  43. * @vbif_idx: vbif identifier
  44. * @xin_id: client interface identifier
  45. * @clk_ctrl: clock control identifier of the xin
  46. * @num: pipe identifier (debug only)
  47. * @client_type: client type enumerated by sde_vbif_client_type
  48. */
  49. struct sde_vbif_set_qos_params {
  50. u32 vbif_idx;
  51. u32 xin_id;
  52. u32 clk_ctrl;
  53. u32 num;
  54. enum sde_vbif_client_type client_type;
  55. };
  56. /**
  57. * sde_vbif_set_ot_limit - set OT limit for vbif client
  58. * @sde_kms: SDE handler
  59. * @params: Pointer to OT configuration parameters
  60. */
  61. void sde_vbif_set_ot_limit(struct sde_kms *sde_kms,
  62. struct sde_vbif_set_ot_params *params);
  63. /**
  64. * sde_vbif_set_xin_halt - halt one of the xin ports
  65. * This function isn't thread safe.
  66. * @sde_kms: SDE handler
  67. * @params: Pointer to halt configuration parameters
  68. * Returns: Whether or not VBIF clocks were forced on
  69. */
  70. bool sde_vbif_set_xin_halt(struct sde_kms *sde_kms,
  71. struct sde_vbif_set_xin_halt_params *params);
  72. /**
  73. * sde_vbif_set_qos_remap - set QoS priority level remap
  74. * @sde_kms: SDE handler
  75. * @params: Pointer to QoS configuration parameters
  76. */
  77. void sde_vbif_set_qos_remap(struct sde_kms *sde_kms,
  78. struct sde_vbif_set_qos_params *params);
  79. /**
  80. * sde_vbif_clear_errors - clear any vbif errors
  81. * @sde_kms: SDE handler
  82. */
  83. void sde_vbif_clear_errors(struct sde_kms *sde_kms);
  84. /**
  85. * sde_vbif_init_memtypes - initialize xin memory types for vbif
  86. * @sde_kms: SDE handler
  87. */
  88. void sde_vbif_init_memtypes(struct sde_kms *sde_kms);
  89. /**
  90. * sde_vbif_axi_halt_request - halt all axi transcations on vbif
  91. * @sde_kms: SDE handler
  92. */
  93. void sde_vbif_axi_halt_request(struct sde_kms *sde_kms);
  94. /**
  95. * sde_vbif_halt_plane_xin - halts the xin client for the unused plane
  96. * On unused plane, check if the vbif for this plane is idle or not.
  97. * If not then first force_on the planes clock and then send the
  98. * halt request. Wait for some time then check for the vbif idle
  99. * or not again.
  100. * @sde_kms: SDE handler
  101. * @xin_id: xin id of the unused plane
  102. * @clk_ctrl: clk ctrl type for the unused plane
  103. * Returns: 0 on success, error code otherwise
  104. */
  105. int sde_vbif_halt_plane_xin(struct sde_kms *sde_kms, u32 xin_id,
  106. u32 clk_ctrl);
  107. /**
  108. * sde_vbif_halt_xin_mask - halts/unhalts all the xin clients present in
  109. * the mask.
  110. * @sde_kms: SDE handler
  111. * @xin_id_mask: Mask of all the xin-ids to be halted/unhalted
  112. * halt: boolen to indicate halt/unhalt
  113. */
  114. int sde_vbif_halt_xin_mask(struct sde_kms *sde_kms, u32 xin_id_mask, bool halt);
  115. #ifdef CONFIG_DEBUG_FS
  116. int sde_debugfs_vbif_init(struct sde_kms *sde_kms, struct dentry *debugfs_root);
  117. void sde_debugfs_vbif_destroy(struct sde_kms *sde_kms);
  118. #else
  119. static inline int sde_debugfs_vbif_init(struct sde_kms *sde_kms,
  120. struct dentry *debugfs_root)
  121. {
  122. return 0;
  123. }
  124. static inline void sde_debugfs_vbif_destroy(struct sde_kms *sde_kms)
  125. {
  126. }
  127. #endif
  128. #endif /* __SDE_VBIF_H__ */