sde_hw_wb.h 4.8 KB

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