sde_hw_wb.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_WB_H
  6. #define _SDE_HW_WB_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_top.h"
  10. #include "sde_hw_util.h"
  11. struct sde_hw_wb;
  12. struct sde_hw_wb_cfg {
  13. struct sde_hw_fmt_layout dest;
  14. enum sde_intf_mode intf_mode;
  15. struct traffic_shaper_cfg ts_cfg;
  16. struct sde_rect roi;
  17. bool is_secure;
  18. };
  19. /**
  20. * enum CDP preload ahead address size
  21. */
  22. enum {
  23. SDE_WB_CDP_PRELOAD_AHEAD_32,
  24. SDE_WB_CDP_PRELOAD_AHEAD_64
  25. };
  26. /**
  27. * struct sde_hw_wb_cdp_cfg : CDP configuration
  28. * @enable: true to enable CDP
  29. * @ubwc_meta_enable: true to enable ubwc metadata preload
  30. * @tile_amortize_enable: true to enable amortization control for tile format
  31. * @preload_ahead: number of request to preload ahead
  32. * SDE_WB_CDP_PRELOAD_AHEAD_32,
  33. * SDE_WB_CDP_PRELOAD_AHEAD_64
  34. */
  35. struct sde_hw_wb_cdp_cfg {
  36. bool enable;
  37. bool ubwc_meta_enable;
  38. bool tile_amortize_enable;
  39. u32 preload_ahead;
  40. };
  41. /**
  42. * struct sde_hw_wb_qos_cfg : Writeback pipe QoS configuration
  43. * @danger_lut: LUT for generate danger level based on fill level
  44. * @safe_lut: LUT for generate safe level based on fill level
  45. * @creq_lut: LUT for generate creq level based on fill level
  46. * @danger_safe_en: enable danger safe generation
  47. */
  48. struct sde_hw_wb_qos_cfg {
  49. u32 danger_lut;
  50. u32 safe_lut;
  51. u64 creq_lut;
  52. bool danger_safe_en;
  53. };
  54. /**
  55. *
  56. * struct sde_hw_wb_ops : Interface to the wb Hw driver functions
  57. * Assumption is these functions will be called after clocks are enabled
  58. */
  59. struct sde_hw_wb_ops {
  60. void (*setup_csc_data)(struct sde_hw_wb *ctx,
  61. struct sde_csc_cfg *data);
  62. void (*setup_outaddress)(struct sde_hw_wb *ctx,
  63. struct sde_hw_wb_cfg *wb);
  64. void (*setup_outformat)(struct sde_hw_wb *ctx,
  65. struct sde_hw_wb_cfg *wb);
  66. void (*setup_rotator)(struct sde_hw_wb *ctx,
  67. struct sde_hw_wb_cfg *wb);
  68. void (*setup_dither)(struct sde_hw_wb *ctx,
  69. struct sde_hw_wb_cfg *wb);
  70. void (*setup_cdwn)(struct sde_hw_wb *ctx,
  71. struct sde_hw_wb_cfg *wb);
  72. void (*setup_trafficshaper)(struct sde_hw_wb *ctx,
  73. struct sde_hw_wb_cfg *wb);
  74. void (*setup_roi)(struct sde_hw_wb *ctx,
  75. struct sde_hw_wb_cfg *wb);
  76. /**
  77. * setup_danger_safe_lut - setup danger safe LUTs
  78. * @ctx: Pointer to pipe context
  79. * @cfg: Pointer to pipe QoS configuration
  80. */
  81. void (*setup_danger_safe_lut)(struct sde_hw_wb *ctx,
  82. struct sde_hw_wb_qos_cfg *cfg);
  83. /**
  84. * setup_creq_lut - setup CREQ LUT
  85. * @ctx: Pointer to pipe context
  86. * @cfg: Pointer to pipe QoS configuration
  87. */
  88. void (*setup_creq_lut)(struct sde_hw_wb *ctx,
  89. struct sde_hw_wb_qos_cfg *cfg);
  90. /**
  91. * setup_qos_ctrl - setup QoS control
  92. * @ctx: Pointer to pipe context
  93. * @cfg: Pointer to pipe QoS configuration
  94. */
  95. void (*setup_qos_ctrl)(struct sde_hw_wb *ctx,
  96. struct sde_hw_wb_qos_cfg *cfg);
  97. /**
  98. * setup_cdp - setup CDP
  99. * @ctx: Pointer to pipe context
  100. * @cfg: Pointer to pipe CDP configuration
  101. */
  102. void (*setup_cdp)(struct sde_hw_wb *ctx,
  103. struct sde_hw_wb_cdp_cfg *cfg);
  104. /**
  105. * bind_pingpong_blk - enable/disable the connection with pp
  106. * @ctx: Pointer to wb context
  107. * @enable: enable/disable connection
  108. * @pp: pingpong blk id
  109. */
  110. void (*bind_pingpong_blk)(struct sde_hw_wb *ctx,
  111. bool enable,
  112. const enum sde_pingpong pp);
  113. /**
  114. * program_cwb_ctrl - program cwb block configp
  115. * @ctx: Pointer to wb context
  116. * @pp_idx: Current CWB block index to poram
  117. * @data_src: Source CWB/PingPong block index
  118. * @dspp_out: Tap dspp output or default LM output
  119. */
  120. void (*program_cwb_ctrl)(struct sde_hw_wb *ctx, const enum sde_cwb cwb,
  121. const enum sde_cwb data_src, bool dspp_out);
  122. };
  123. /**
  124. * struct sde_hw_wb : WB driver object
  125. * @base: hardware block base structure
  126. * @hw: block hardware details
  127. * @catalog: back pointer to catalog
  128. * @mdp: pointer to associated mdp portion of the catalog
  129. * @idx: hardware index number within type
  130. * @wb_hw_caps: hardware capabilities
  131. * @ops: function pointers
  132. * @hw_mdp: MDP top level hardware block
  133. * @cwb_hw: CWB control hwio details
  134. */
  135. struct sde_hw_wb {
  136. struct sde_hw_blk base;
  137. struct sde_hw_blk_reg_map hw;
  138. struct sde_mdss_cfg *catalog;
  139. struct sde_mdp_cfg *mdp;
  140. /* wb path */
  141. int idx;
  142. const struct sde_wb_cfg *caps;
  143. /* ops */
  144. struct sde_hw_wb_ops ops;
  145. struct sde_hw_mdp *hw_mdp;
  146. struct sde_hw_blk_reg_map cwb_hw;
  147. };
  148. /**
  149. * sde_hw_wb - convert base object sde_hw_base to container
  150. * @hw: Pointer to base hardware block
  151. * return: Pointer to hardware block container
  152. */
  153. static inline struct sde_hw_wb *to_sde_hw_wb(struct sde_hw_blk *hw)
  154. {
  155. return container_of(hw, struct sde_hw_wb, base);
  156. }
  157. /**
  158. * sde_hw_wb_init(): Initializes and return writeback hw driver object.
  159. * @idx: wb_path index for which driver object is required
  160. * @addr: mapped register io address of MDP
  161. * @m : pointer to mdss catalog data
  162. * @hw_mdp: pointer to mdp top hw driver object
  163. */
  164. struct sde_hw_wb *sde_hw_wb_init(enum sde_wb idx,
  165. void __iomem *addr,
  166. struct sde_mdss_cfg *m,
  167. struct sde_hw_mdp *hw_mdp);
  168. /**
  169. * sde_hw_wb_destroy(): Destroy writeback hw driver object.
  170. * @hw_wb: Pointer to writeback hw driver object
  171. */
  172. void sde_hw_wb_destroy(struct sde_hw_wb *hw_wb);
  173. #endif /*_SDE_HW_WB_H */