sde_hw_top.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SDE_HW_TOP_H
  6. #define _SDE_HW_TOP_H
  7. #include "sde_hw_catalog.h"
  8. #include "sde_hw_mdss.h"
  9. #include "sde_hw_util.h"
  10. struct sde_hw_mdp;
  11. /**
  12. * struct traffic_shaper_cfg: traffic shaper configuration
  13. * @en : enable/disable traffic shaper
  14. * @rd_client : true if read client; false if write client
  15. * @client_id : client identifier
  16. * @bpc_denom : denominator of byte per clk
  17. * @bpc_numer : numerator of byte per clk
  18. */
  19. struct traffic_shaper_cfg {
  20. bool en;
  21. bool rd_client;
  22. u32 client_id;
  23. u32 bpc_denom;
  24. u64 bpc_numer;
  25. };
  26. /**
  27. * struct split_pipe_cfg - pipe configuration for dual display panels
  28. * @en : Enable/disable dual pipe confguration
  29. * @mode : Panel interface mode
  30. * @intf : Interface id for main control path
  31. * @pp_split_slave: Slave interface for ping pong split, INTF_MAX to disable
  32. * @pp_split_idx: Ping pong index for ping pong split
  33. * @split_flush_en: Allows both the paths to be flushed when master path is
  34. * flushed
  35. * @split_link_en: Check if split link is enabled
  36. */
  37. struct split_pipe_cfg {
  38. bool en;
  39. enum sde_intf_mode mode;
  40. enum sde_intf intf;
  41. enum sde_intf pp_split_slave;
  42. u32 pp_split_index;
  43. bool split_flush_en;
  44. bool split_link_en;
  45. };
  46. /**
  47. * struct cdm_output_cfg: output configuration for cdm
  48. * @wb_en : enable/disable writeback output
  49. * @intf_en : enable/disable interface output
  50. */
  51. struct cdm_output_cfg {
  52. bool wb_en;
  53. bool intf_en;
  54. };
  55. /**
  56. * struct sde_danger_safe_status: danger and safe status signals
  57. * @mdp: top level status
  58. * @sspp: source pipe status
  59. * @wb: writebck output status
  60. */
  61. struct sde_danger_safe_status {
  62. u8 mdp;
  63. u8 sspp[SSPP_MAX];
  64. u8 wb[WB_MAX];
  65. };
  66. /**
  67. * struct sde_vsync_source_cfg - configure vsync source and configure the
  68. * watchdog timers if required.
  69. * @pp_count: number of ping pongs active
  70. * @frame_rate: Display frame rate
  71. * @ppnumber: ping pong index array
  72. * @vsync_source: vsync source selection
  73. */
  74. struct sde_vsync_source_cfg {
  75. u32 pp_count;
  76. u32 frame_rate;
  77. u32 ppnumber[PINGPONG_MAX];
  78. u32 vsync_source;
  79. };
  80. /**
  81. * struct sde_hw_mdp_ops - interface to the MDP TOP Hw driver functions
  82. * Assumption is these functions will be called after clocks are enabled.
  83. * @setup_split_pipe : Programs the pipe control registers
  84. * @setup_pp_split : Programs the pp split control registers
  85. * @setup_cdm_output : programs cdm control
  86. * @setup_traffic_shaper : programs traffic shaper control
  87. */
  88. struct sde_hw_mdp_ops {
  89. /** setup_split_pipe() : Regsiters are not double buffered, thisk
  90. * function should be called before timing control enable
  91. * @mdp : mdp top context driver
  92. * @cfg : upper and lower part of pipe configuration
  93. */
  94. void (*setup_split_pipe)(struct sde_hw_mdp *mdp,
  95. struct split_pipe_cfg *p);
  96. /** setup_pp_split() : Configure pp split related registers
  97. * @mdp : mdp top context driver
  98. * @cfg : upper and lower part of pipe configuration
  99. */
  100. void (*setup_pp_split)(struct sde_hw_mdp *mdp,
  101. struct split_pipe_cfg *cfg);
  102. /**
  103. * setup_cdm_output() : Setup selection control of the cdm data path
  104. * @mdp : mdp top context driver
  105. * @cfg : cdm output configuration
  106. */
  107. void (*setup_cdm_output)(struct sde_hw_mdp *mdp,
  108. struct cdm_output_cfg *cfg);
  109. /**
  110. * setup_traffic_shaper() : Setup traffic shaper control
  111. * @mdp : mdp top context driver
  112. * @cfg : traffic shaper configuration
  113. */
  114. void (*setup_traffic_shaper)(struct sde_hw_mdp *mdp,
  115. struct traffic_shaper_cfg *cfg);
  116. /**
  117. * setup_clk_force_ctrl - set clock force control
  118. * @mdp: mdp top context driver
  119. * @clk_ctrl: clock to be controlled
  120. * @enable: force on enable
  121. * @return: if the clock is forced-on by this function
  122. */
  123. bool (*setup_clk_force_ctrl)(struct sde_hw_mdp *mdp,
  124. enum sde_clk_ctrl_type clk_ctrl, bool enable);
  125. /**
  126. * get_clk_ctrl_status - get clock control status
  127. * @mdp: mdp top context driver
  128. * @clk_ctrl: clock to be controlled
  129. * @status: returns true if clock is on
  130. * @return: 0 if success, otherwise return code
  131. */
  132. int (*get_clk_ctrl_status)(struct sde_hw_mdp *mdp,
  133. enum sde_clk_ctrl_type clk_ctrl, bool *status);
  134. /**
  135. * setup_vsync_source - setup vsync source configuration details
  136. * @mdp: mdp top context driver
  137. * @cfg: vsync source selection configuration
  138. */
  139. void (*setup_vsync_source)(struct sde_hw_mdp *mdp,
  140. struct sde_vsync_source_cfg *cfg);
  141. /**
  142. * reset_ubwc - reset top level UBWC configuration
  143. * @mdp: mdp top context driver
  144. * @m: pointer to mdss catalog data
  145. */
  146. void (*reset_ubwc)(struct sde_hw_mdp *mdp, struct sde_mdss_cfg *m);
  147. /**
  148. * intf_audio_select - select the external interface for audio
  149. * @mdp: mdp top context driver
  150. */
  151. void (*intf_audio_select)(struct sde_hw_mdp *mdp);
  152. /**
  153. * set_mdp_hw_events - enable qdss hardware events for mdp
  154. * @mdp: mdp top context driver
  155. * @enable: enable/disable hw events
  156. */
  157. void (*set_mdp_hw_events)(struct sde_hw_mdp *mdp, bool enable);
  158. /**
  159. * set_cwb_ppb_cntl - select the data point for CWB
  160. * @mdp: mdp top context driver
  161. * @dual: indicates if dual pipe line needs to be programmed
  162. * @dspp_out : true if dspp output required. LM is default tap point
  163. */
  164. void (*set_cwb_ppb_cntl)(struct sde_hw_mdp *mdp,
  165. bool dual, bool dspp_out);
  166. /**
  167. * set_hdr_plus_metadata - program the dynamic hdr metadata
  168. * @mdp: mdp top context driver
  169. * @payload: pointer to payload data
  170. * @len: size of the valid data within payload
  171. * @stream_id: stream ID for MST (0 or 1)
  172. */
  173. void (*set_hdr_plus_metadata)(struct sde_hw_mdp *mdp,
  174. u8 *payload, u32 len, u32 stream_id);
  175. /**
  176. * get_autorefresh_status - get autorefresh status
  177. * @mdp: mdp top context driver
  178. * @intf_idx: intf block index for relative information
  179. */
  180. u32 (*get_autorefresh_status)(struct sde_hw_mdp *mdp,
  181. u32 intf_idx);
  182. };
  183. struct sde_hw_mdp {
  184. struct sde_hw_blk_reg_map hw;
  185. /* top */
  186. enum sde_mdp idx;
  187. const struct sde_mdp_cfg *caps;
  188. /* ops */
  189. struct sde_hw_mdp_ops ops;
  190. };
  191. struct sde_hw_sid {
  192. /* rotator base */
  193. struct sde_hw_blk_reg_map hw;
  194. };
  195. /**
  196. * sde_hw_sid_init - initialize the sid blk reg map
  197. * @addr: Mapped register io address
  198. * @sid_len: Length of block
  199. * @m: Pointer to mdss catalog data
  200. */
  201. struct sde_hw_sid *sde_hw_sid_init(void __iomem *addr,
  202. u32 sid_len, const struct sde_mdss_cfg *m);
  203. /**
  204. * sde_hw_set_rotator_sid - set sid values for rotator
  205. * sid: sde_hw_sid passed from kms
  206. */
  207. void sde_hw_set_rotator_sid(struct sde_hw_sid *sid);
  208. /**
  209. * sde_hw_set_sspp_sid - set sid values for the pipes
  210. * sid: sde_hw_sid passed from kms
  211. * pipe: sspp id
  212. * vm: vm id to set for SIDs
  213. */
  214. void sde_hw_set_sspp_sid(struct sde_hw_sid *sid, u32 pipe, u32 vm);
  215. /**
  216. * sde_hw_set_lutdma_sid - set sid values for the pipes
  217. * sid: sde_hw_sid passed from kms
  218. * vm: vm id to set for SIDs
  219. */
  220. void sde_hw_set_lutdma_sid(struct sde_hw_sid *sid, u32 vm);
  221. /**
  222. * sde_hw_mdptop_init - initializes the top driver for the passed idx
  223. * @idx: Interface index for which driver object is required
  224. * @addr: Mapped register io address of MDP
  225. * @m: Pointer to mdss catalog data
  226. */
  227. struct sde_hw_mdp *sde_hw_mdptop_init(enum sde_mdp idx,
  228. void __iomem *addr,
  229. const struct sde_mdss_cfg *m);
  230. void sde_hw_mdp_destroy(struct sde_hw_mdp *mdp);
  231. #endif /*_SDE_HW_TOP_H */