sde_hw_vbif.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _SDE_HW_VBIF_H
  7. #define _SDE_HW_VBIF_H
  8. #include "sde_hw_catalog.h"
  9. #include "sde_hw_mdss.h"
  10. #include "sde_hw_util.h"
  11. struct sde_hw_vbif;
  12. /**
  13. * struct sde_hw_vbif_ops : Interface to the VBIF hardware driver functions
  14. * Assumption is these functions will be called after clocks are enabled
  15. */
  16. struct sde_hw_vbif_ops {
  17. /**
  18. * set_limit_conf - set transaction limit config
  19. * @vbif: vbif context driver
  20. * @xin_id: client interface identifier
  21. * @rd: true for read limit; false for write limit
  22. * @limit: outstanding transaction limit
  23. */
  24. void (*set_limit_conf)(struct sde_hw_vbif *vbif,
  25. u32 xin_id, bool rd, u32 limit);
  26. /**
  27. * get_limit_conf - get transaction limit config
  28. * @vbif: vbif context driver
  29. * @xin_id: client interface identifier
  30. * @rd: true for read limit; false for write limit
  31. * @return: outstanding transaction limit
  32. */
  33. u32 (*get_limit_conf)(struct sde_hw_vbif *vbif,
  34. u32 xin_id, bool rd);
  35. /**
  36. * set_xin_halt - set xin client halt control
  37. * @vbif: vbif context driver
  38. * @xin_id: client interface identifier
  39. * @enable: halt control enable
  40. */
  41. void (*set_xin_halt)(struct sde_hw_vbif *vbif,
  42. u32 xin_id, bool enable);
  43. /**
  44. * get_xin_halt_status - get xin client halt control
  45. * @vbif: vbif context driver
  46. * @xin_id: client interface identifier
  47. * @return: halt control enable
  48. */
  49. bool (*get_xin_halt_status)(struct sde_hw_vbif *vbif,
  50. u32 xin_id);
  51. /**
  52. * set_axi_halt - set axi port halt control
  53. * @vbif: vbif context driver
  54. */
  55. void (*set_axi_halt)(struct sde_hw_vbif *vbif);
  56. /**
  57. * get_axi_halt_status - get axi port halt control status
  58. * @vbif: vbif context driver
  59. */
  60. int (*get_axi_halt_status)(struct sde_hw_vbif *vbif);
  61. /**
  62. * set_qos_remap - set QoS priority remap
  63. * @vbif: vbif context driver
  64. * @xin_id: client interface identifier
  65. * @level: priority level
  66. * @rp_remap: rp_remap level
  67. * @lvl_remap: lvl_remap level
  68. */
  69. void (*set_qos_remap)(struct sde_hw_vbif *vbif,
  70. u32 xin_id, u32 level, u32 rp_remap, u32 lvl_remap);
  71. /**
  72. * set_mem_type - set memory type
  73. * @vbif: vbif context driver
  74. * @xin_id: client interface identifier
  75. * @value: memory type value
  76. */
  77. void (*set_mem_type)(struct sde_hw_vbif *vbif,
  78. u32 xin_id, u32 value);
  79. /**
  80. * clear_errors - clear any vbif errors
  81. * This function clears any detected pending/source errors
  82. * on the VBIF interface, and optionally returns the detected
  83. * error mask(s).
  84. * @vbif: vbif context driver
  85. * @pnd_errors: pointer to pending error reporting variable
  86. * @src_errors: pointer to source error reporting variable
  87. */
  88. void (*clear_errors)(struct sde_hw_vbif *vbif,
  89. u32 *pnd_errors, u32 *src_errors);
  90. /**
  91. * set_write_gather_en - set write_gather enable
  92. * @vbif: vbif context driver
  93. * @xin_id: client interface identifier
  94. */
  95. void (*set_write_gather_en)(struct sde_hw_vbif *vbif, u32 xin_id);
  96. };
  97. struct sde_hw_vbif {
  98. /* base */
  99. struct sde_hw_blk_reg_map hw;
  100. /* vbif */
  101. enum sde_vbif idx;
  102. const struct sde_vbif_cfg *cap;
  103. /* ops */
  104. struct sde_hw_vbif_ops ops;
  105. /*
  106. * vbif is common across all displays, lock to serialize access.
  107. * must be take by client before using any ops
  108. */
  109. struct mutex mutex;
  110. };
  111. struct sde_vbif_clk_ops {
  112. /**
  113. * setup_clk_force_ctrl - set clock force control
  114. * @hw: hw block object
  115. * @clk_ctrl: clock to be controlled
  116. * @enable: force on enable
  117. * @return: if the clock is forced-on by this function
  118. */
  119. bool (*setup_clk_force_ctrl)(struct sde_hw_blk_reg_map *hw,
  120. enum sde_clk_ctrl_type clk_ctrl, bool enable);
  121. /**
  122. * get_clk_ctrl_status - get clock control status
  123. * @hw: hw block object
  124. * @clk_ctrl: clock to be controlled
  125. * @status: returns true if clock is on
  126. * @return: 0 if success, otherwise return error code
  127. */
  128. int (*get_clk_ctrl_status)(struct sde_hw_blk_reg_map *hw,
  129. enum sde_clk_ctrl_type clk_ctrl, bool *status);
  130. };
  131. /**
  132. * sde_vbif_clk_client - vbif client info
  133. * @hw: hw block object
  134. * @clk_ctrl: clock to be controlled
  135. * @ops: VBIF client ops
  136. */
  137. struct sde_vbif_clk_client {
  138. struct sde_hw_blk_reg_map *hw;
  139. enum sde_clk_ctrl_type clk_ctrl;
  140. struct sde_vbif_clk_ops ops;
  141. };
  142. /**
  143. * sde_hw_vbif_init - initializes the vbif driver for the passed interface idx
  144. * @idx: Interface index for which driver object is required
  145. * @addr: Mapped register io address of MDSS
  146. * @m: Pointer to mdss catalog data
  147. */
  148. struct sde_hw_vbif *sde_hw_vbif_init(enum sde_vbif idx,
  149. void __iomem *addr,
  150. const struct sde_mdss_cfg *m);
  151. void sde_hw_vbif_destroy(struct sde_hw_vbif *vbif);
  152. #endif /*_SDE_HW_VBIF_H */