dsi_catalog.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _DSI_CATALOG_H_
  7. #define _DSI_CATALOG_H_
  8. #include "dsi_ctrl_hw.h"
  9. #include "dsi_phy_hw.h"
  10. /**
  11. * dsi_catalog_ctrl_setup() - return catalog info for dsi controller
  12. * @ctrl: Pointer to DSI controller hw object.
  13. * @version: DSI controller version.
  14. * @index: DSI controller instance ID.
  15. * @phy_pll_bypass: DSI PHY/PLL drivers bypass HW access.
  16. * @null_insertion_enabled: DSI controller inserts null packet.
  17. *
  18. * This function setups the catalog information in the dsi_ctrl_hw object.
  19. *
  20. * return: error code for failure and 0 for success.
  21. */
  22. int dsi_catalog_ctrl_setup(struct dsi_ctrl_hw *ctrl,
  23. enum dsi_ctrl_version version, u32 index,
  24. bool phy_pll_bypass, bool null_insertion_enabled);
  25. /**
  26. * dsi_catalog_phy_setup() - return catalog info for dsi phy hardware
  27. * @phy: Pointer to DSI PHY hw object.
  28. * @version: DSI PHY version.
  29. * @index: DSI PHY instance ID.
  30. *
  31. * This function setups the catalog information in the dsi_phy_hw object.
  32. *
  33. * return: error code for failure and 0 for success.
  34. */
  35. int dsi_catalog_phy_setup(struct dsi_phy_hw *phy,
  36. enum dsi_phy_version version,
  37. u32 index);
  38. /**
  39. * dsi_phy_timing_calc_init() - initialize info for DSI PHY timing calculations
  40. * @phy: Pointer to DSI PHY hw object.
  41. * @version: DSI PHY version.
  42. *
  43. * This function setups the catalog information in the dsi_phy_hw object.
  44. *
  45. * return: error code for failure and 0 for success.
  46. */
  47. int dsi_phy_timing_calc_init(struct dsi_phy_hw *phy,
  48. enum dsi_phy_version version);
  49. /**
  50. * dsi_phy_hw_calculate_timing_params() - DSI PHY timing parameter calculations
  51. * @phy: Pointer to DSI PHY hw object.
  52. * @mode: DSI mode information.
  53. * @host: DSI host configuration.
  54. * @timing: DSI phy lane configurations.
  55. * @use_mode_bit_clk: Boolean to indicate whether to recalculate bit clk.
  56. *
  57. * This function setups the catalog information in the dsi_phy_hw object.
  58. *
  59. * return: error code for failure and 0 for success.
  60. */
  61. int dsi_phy_hw_calculate_timing_params(struct dsi_phy_hw *phy,
  62. struct dsi_mode_info *mode,
  63. struct dsi_host_common_cfg *host,
  64. struct dsi_phy_per_lane_cfgs *timing,
  65. bool use_mode_bit_clk);
  66. /* Definitions for 14nm PHY hardware driver */
  67. void dsi_phy_hw_v2_0_regulator_enable(struct dsi_phy_hw *phy,
  68. struct dsi_phy_per_lane_cfgs *cfg);
  69. void dsi_phy_hw_v2_0_regulator_disable(struct dsi_phy_hw *phy);
  70. void dsi_phy_hw_v2_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  71. void dsi_phy_hw_v2_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  72. void dsi_phy_hw_v2_0_idle_on(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  73. void dsi_phy_hw_v2_0_idle_off(struct dsi_phy_hw *phy);
  74. int dsi_phy_hw_timing_val_v2_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  75. u32 *timing_val, u32 size);
  76. void dsi_phy_hw_v2_0_clamp_ctrl(struct dsi_phy_hw *phy, bool enable);
  77. void dsi_phy_hw_v2_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset);
  78. void dsi_phy_hw_v2_0_dyn_refresh_config(struct dsi_phy_hw *phy,
  79. struct dsi_phy_cfg *cfg, bool is_master);
  80. void dsi_phy_hw_v2_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
  81. struct dsi_dyn_clk_delay *delay);
  82. int dsi_phy_hw_v2_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
  83. u32 *dst, u32 size);
  84. /* Definitions for 10nm PHY hardware driver */
  85. void dsi_phy_hw_v3_0_regulator_enable(struct dsi_phy_hw *phy,
  86. struct dsi_phy_per_lane_cfgs *cfg);
  87. void dsi_phy_hw_v3_0_regulator_disable(struct dsi_phy_hw *phy);
  88. void dsi_phy_hw_v3_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  89. void dsi_phy_hw_v3_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  90. int dsi_phy_hw_v3_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
  91. void dsi_phy_hw_v3_0_ulps_request(struct dsi_phy_hw *phy,
  92. struct dsi_phy_cfg *cfg, u32 lanes);
  93. void dsi_phy_hw_v3_0_ulps_exit(struct dsi_phy_hw *phy,
  94. struct dsi_phy_cfg *cfg, u32 lanes);
  95. u32 dsi_phy_hw_v3_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
  96. bool dsi_phy_hw_v3_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
  97. int dsi_phy_hw_timing_val_v3_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  98. u32 *timing_val, u32 size);
  99. void dsi_phy_hw_v3_0_clamp_ctrl(struct dsi_phy_hw *phy, bool enable);
  100. int dsi_phy_hw_v3_0_lane_reset(struct dsi_phy_hw *phy);
  101. void dsi_phy_hw_v3_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
  102. /* Definitions for 7nm PHY hardware driver */
  103. void dsi_phy_hw_v4_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  104. void dsi_phy_hw_v4_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  105. int dsi_phy_hw_v4_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
  106. void dsi_phy_hw_v4_0_ulps_request(struct dsi_phy_hw *phy,
  107. struct dsi_phy_cfg *cfg, u32 lanes);
  108. void dsi_phy_hw_v4_0_ulps_exit(struct dsi_phy_hw *phy,
  109. struct dsi_phy_cfg *cfg, u32 lanes);
  110. u32 dsi_phy_hw_v4_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
  111. bool dsi_phy_hw_v4_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
  112. int dsi_phy_hw_timing_val_v4_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  113. u32 *timing_val, u32 size);
  114. int dsi_phy_hw_v4_0_lane_reset(struct dsi_phy_hw *phy);
  115. void dsi_phy_hw_v4_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
  116. void dsi_phy_hw_v4_0_reset_clk_en_sel(struct dsi_phy_hw *phy);
  117. void dsi_phy_hw_v4_0_set_continuous_clk(struct dsi_phy_hw *phy, bool enable);
  118. void dsi_phy_hw_v4_0_commit_phy_timing(struct dsi_phy_hw *phy,
  119. struct dsi_phy_per_lane_cfgs *timing);
  120. /* Definitions for 4nm PHY hardware driver */
  121. void dsi_phy_hw_v5_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  122. void dsi_phy_hw_v5_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  123. int dsi_phy_hw_v5_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
  124. void dsi_phy_hw_v5_0_ulps_request(struct dsi_phy_hw *phy,
  125. struct dsi_phy_cfg *cfg, u32 lanes);
  126. void dsi_phy_hw_v5_0_ulps_exit(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg, u32 lanes);
  127. u32 dsi_phy_hw_v5_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
  128. bool dsi_phy_hw_v5_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
  129. int dsi_phy_hw_timing_val_v5_0(struct dsi_phy_per_lane_cfgs *timing_cfg, u32 *timing_val,
  130. u32 size);
  131. int dsi_phy_hw_v5_0_lane_reset(struct dsi_phy_hw *phy);
  132. void dsi_phy_hw_v5_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
  133. void dsi_phy_hw_v5_0_reset_clk_en_sel(struct dsi_phy_hw *phy);
  134. void dsi_phy_hw_v5_0_set_continuous_clk(struct dsi_phy_hw *phy, bool enable);
  135. void dsi_phy_hw_v5_0_commit_phy_timing(struct dsi_phy_hw *phy,
  136. struct dsi_phy_per_lane_cfgs *timing);
  137. /* DSI controller common ops */
  138. u32 dsi_ctrl_hw_cmn_get_interrupt_status(struct dsi_ctrl_hw *ctrl);
  139. u32 dsi_ctrl_hw_cmn_poll_dma_status(struct dsi_ctrl_hw *ctrl);
  140. void dsi_ctrl_hw_cmn_clear_interrupt_status(struct dsi_ctrl_hw *ctrl, u32 ints);
  141. void dsi_ctrl_hw_cmn_enable_status_interrupts(struct dsi_ctrl_hw *ctrl,
  142. u32 ints);
  143. u64 dsi_ctrl_hw_cmn_get_error_status(struct dsi_ctrl_hw *ctrl);
  144. void dsi_ctrl_hw_cmn_clear_error_status(struct dsi_ctrl_hw *ctrl, u64 errors);
  145. void dsi_ctrl_hw_cmn_enable_error_interrupts(struct dsi_ctrl_hw *ctrl,
  146. u64 errors);
  147. void dsi_ctrl_hw_cmn_video_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
  148. enum dsi_test_pattern type,
  149. u32 init_val);
  150. void dsi_ctrl_hw_cmn_cmd_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
  151. enum dsi_test_pattern type,
  152. u32 init_val,
  153. u32 stream_id);
  154. void dsi_ctrl_hw_cmn_test_pattern_enable(struct dsi_ctrl_hw *ctrl, bool enable,
  155. enum dsi_ctrl_tpg_pattern pattern,
  156. enum dsi_op_mode panel_mode);
  157. void dsi_ctrl_hw_cmn_trigger_cmd_test_pattern(struct dsi_ctrl_hw *ctrl,
  158. u32 stream_id);
  159. void dsi_ctrl_hw_cmn_host_setup(struct dsi_ctrl_hw *ctrl,
  160. struct dsi_host_common_cfg *config);
  161. void dsi_ctrl_hw_cmn_video_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
  162. void dsi_ctrl_hw_cmn_video_engine_setup(struct dsi_ctrl_hw *ctrl,
  163. struct dsi_host_common_cfg *common_cfg,
  164. struct dsi_video_engine_cfg *cfg);
  165. void dsi_ctrl_hw_cmn_setup_avr(struct dsi_ctrl_hw *ctrl, bool enable);
  166. void dsi_ctrl_hw_cmn_set_video_timing(struct dsi_ctrl_hw *ctrl,
  167. struct dsi_mode_info *mode);
  168. void dsi_ctrl_hw_cmn_set_timing_db(struct dsi_ctrl_hw *ctrl,
  169. bool enable);
  170. void dsi_ctrl_hw_cmn_cmd_engine_setup(struct dsi_ctrl_hw *ctrl,
  171. struct dsi_host_common_cfg *common_cfg,
  172. struct dsi_cmd_engine_cfg *cfg);
  173. void dsi_ctrl_hw_cmn_ctrl_en(struct dsi_ctrl_hw *ctrl, bool on);
  174. void dsi_ctrl_hw_cmn_cmd_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
  175. void dsi_ctrl_hw_cmn_setup_cmd_stream(struct dsi_ctrl_hw *ctrl,
  176. struct dsi_mode_info *mode,
  177. struct dsi_host_common_cfg *cfg,
  178. u32 vc_id,
  179. struct dsi_rect *roi);
  180. void dsi_ctrl_hw_cmn_phy_sw_reset(struct dsi_ctrl_hw *ctrl);
  181. void dsi_ctrl_hw_cmn_soft_reset(struct dsi_ctrl_hw *ctrl);
  182. void dsi_ctrl_hw_cmn_setup_misr(struct dsi_ctrl_hw *ctrl,
  183. enum dsi_op_mode panel_mode,
  184. bool enable, u32 frame_count);
  185. u32 dsi_ctrl_hw_cmn_collect_misr(struct dsi_ctrl_hw *ctrl,
  186. enum dsi_op_mode panel_mode);
  187. void dsi_ctrl_hw_cmn_kickoff_command(struct dsi_ctrl_hw *ctrl,
  188. struct dsi_ctrl_cmd_dma_info *cmd,
  189. u32 flags);
  190. void dsi_ctrl_hw_cmn_kickoff_fifo_command(struct dsi_ctrl_hw *ctrl,
  191. struct dsi_ctrl_cmd_dma_fifo_info *cmd,
  192. u32 flags);
  193. void dsi_ctrl_hw_cmn_reset_cmd_fifo(struct dsi_ctrl_hw *ctrl);
  194. void dsi_ctrl_hw_cmn_trigger_command_dma(struct dsi_ctrl_hw *ctrl);
  195. void dsi_ctrl_hw_dln0_phy_err(struct dsi_ctrl_hw *ctrl);
  196. void dsi_ctrl_hw_cmn_phy_reset_config(struct dsi_ctrl_hw *ctrl,
  197. bool enable);
  198. void dsi_ctrl_hw_22_phy_reset_config(struct dsi_ctrl_hw *ctrl,
  199. bool enable);
  200. u32 dsi_ctrl_hw_cmn_get_cmd_read_data(struct dsi_ctrl_hw *ctrl,
  201. u8 *rd_buf,
  202. u32 read_offset,
  203. u32 rx_byte,
  204. u32 pkt_size, u32 *hw_read_cnt);
  205. void dsi_ctrl_hw_cmn_clear_rdbk_reg(struct dsi_ctrl_hw *ctrl);
  206. void dsi_ctrl_hw_22_schedule_dma_cmd(struct dsi_ctrl_hw *ctrl, int line_on);
  207. int dsi_ctrl_hw_cmn_ctrl_reset(struct dsi_ctrl_hw *ctrl,
  208. int mask);
  209. void dsi_ctrl_hw_cmn_mask_error_intr(struct dsi_ctrl_hw *ctrl, u32 idx,
  210. bool en);
  211. void dsi_ctrl_hw_cmn_error_intr_ctrl(struct dsi_ctrl_hw *ctrl, bool en);
  212. u32 dsi_ctrl_hw_cmn_get_error_mask(struct dsi_ctrl_hw *ctrl);
  213. u32 dsi_ctrl_hw_cmn_get_hw_version(struct dsi_ctrl_hw *ctrl);
  214. int dsi_ctrl_hw_cmn_wait_for_cmd_mode_mdp_idle(struct dsi_ctrl_hw *ctrl);
  215. /* Definitions specific to 1.4 DSI controller hardware */
  216. int dsi_ctrl_hw_14_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
  217. void dsi_ctrl_hw_14_setup_lane_map(struct dsi_ctrl_hw *ctrl,
  218. struct dsi_lane_map *lane_map);
  219. void dsi_ctrl_hw_cmn_ulps_request(struct dsi_ctrl_hw *ctrl, u32 lanes);
  220. void dsi_ctrl_hw_cmn_ulps_exit(struct dsi_ctrl_hw *ctrl, u32 lanes);
  221. u32 dsi_ctrl_hw_cmn_get_lanes_in_ulps(struct dsi_ctrl_hw *ctrl);
  222. void dsi_ctrl_hw_14_clamp_enable(struct dsi_ctrl_hw *ctrl,
  223. u32 lanes,
  224. bool enable_ulps);
  225. void dsi_ctrl_hw_14_clamp_disable(struct dsi_ctrl_hw *ctrl,
  226. u32 lanes,
  227. bool disable_ulps);
  228. ssize_t dsi_ctrl_hw_14_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
  229. char *buf,
  230. u32 size);
  231. /* Definitions specific to 2.0 DSI controller hardware */
  232. void dsi_ctrl_hw_20_setup_lane_map(struct dsi_ctrl_hw *ctrl,
  233. struct dsi_lane_map *lane_map);
  234. int dsi_ctrl_hw_20_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
  235. ssize_t dsi_ctrl_hw_20_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
  236. char *buf,
  237. u32 size);
  238. void dsi_ctrl_hw_kickoff_non_embedded_mode(struct dsi_ctrl_hw *ctrl,
  239. struct dsi_ctrl_cmd_dma_info *cmd,
  240. u32 flags);
  241. /* Definitions specific to 2.2 DSI controller hardware */
  242. void dsi_ctrl_hw_22_setup_lane_map(struct dsi_ctrl_hw *ctrl,
  243. struct dsi_lane_map *lane_map);
  244. int dsi_ctrl_hw_22_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
  245. ssize_t dsi_ctrl_hw_22_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
  246. char *buf, u32 size);
  247. void dsi_ctrl_hw_22_config_clk_gating(struct dsi_ctrl_hw *ctrl, bool enable,
  248. enum dsi_clk_gate_type clk_selection);
  249. void dsi_ctrl_hw_cmn_set_continuous_clk(struct dsi_ctrl_hw *ctrl, bool enable);
  250. void dsi_ctrl_hw_cmn_hs_req_sel(struct dsi_ctrl_hw *ctrl, bool sel_phy);
  251. void dsi_ctrl_hw_22_setup_misr(struct dsi_ctrl_hw *ctrl, enum dsi_op_mode panel_mode,
  252. bool enable, u32 frame_count);
  253. u32 dsi_ctrl_hw_22_collect_misr(struct dsi_ctrl_hw *ctrl, enum dsi_op_mode panel_mode);
  254. /* dynamic refresh specific functions */
  255. void dsi_phy_hw_v3_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset);
  256. void dsi_phy_hw_v3_0_dyn_refresh_config(struct dsi_phy_hw *phy,
  257. struct dsi_phy_cfg *cfg, bool is_master);
  258. void dsi_phy_hw_v3_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
  259. struct dsi_dyn_clk_delay *delay);
  260. int dsi_ctrl_hw_cmn_wait4dynamic_refresh_done(struct dsi_ctrl_hw *ctrl);
  261. bool dsi_ctrl_hw_cmn_vid_engine_busy(struct dsi_ctrl_hw *ctrl);
  262. int dsi_phy_hw_v3_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
  263. u32 *dst, u32 size);
  264. void dsi_phy_hw_v4_0_dyn_refresh_trigger_sel(struct dsi_phy_hw *phy,
  265. bool is_master);
  266. void dsi_phy_hw_v4_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset);
  267. void dsi_phy_hw_v4_0_dyn_refresh_config(struct dsi_phy_hw *phy,
  268. struct dsi_phy_cfg *cfg, bool is_master);
  269. void dsi_phy_hw_v4_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
  270. struct dsi_dyn_clk_delay *delay);
  271. int dsi_phy_hw_v4_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
  272. u32 *dst, u32 size);
  273. void dsi_phy_hw_v5_0_dyn_refresh_trigger_sel(struct dsi_phy_hw *phy,
  274. bool is_master);
  275. void dsi_phy_hw_v5_0_dyn_refresh_helper(struct dsi_phy_hw *phy, u32 offset);
  276. void dsi_phy_hw_v5_0_dyn_refresh_config(struct dsi_phy_hw *phy,
  277. struct dsi_phy_cfg *cfg, bool is_master);
  278. void dsi_phy_hw_v5_0_dyn_refresh_pipe_delay(struct dsi_phy_hw *phy,
  279. struct dsi_dyn_clk_delay *delay);
  280. int dsi_phy_hw_v5_0_cache_phy_timings(struct dsi_phy_per_lane_cfgs *timings,
  281. u32 *dst, u32 size);
  282. void dsi_phy_hw_v5_0_phy_idle_off(struct dsi_phy_hw *phy,
  283. struct dsi_phy_cfg *cfg);
  284. void dsi_ctrl_hw_22_configure_cmddma_window(struct dsi_ctrl_hw *ctrl,
  285. struct dsi_ctrl_cmd_dma_info *cmd,
  286. u32 line_no, u32 window);
  287. void dsi_ctrl_hw_22_reset_trigger_controls(struct dsi_ctrl_hw *ctrl,
  288. struct dsi_host_common_cfg *cfg);
  289. u32 dsi_ctrl_hw_22_log_line_count(struct dsi_ctrl_hw *ctrl, bool cmd_mode);
  290. /* PLL specific functions */
  291. int dsi_catalog_phy_pll_setup(struct dsi_phy_hw *phy, u32 pll_ver);
  292. int dsi_pll_5nm_configure(void *pll, bool commit);
  293. int dsi_pll_5nm_toggle(void *pll, bool prepare);
  294. int dsi_pll_4nm_configure(void *pll, bool commit);
  295. int dsi_pll_4nm_toggle(void *pll, bool prepare);
  296. void dsi_ctrl_hw_22_configure_splitlink(struct dsi_ctrl_hw *ctrl,
  297. struct dsi_host_common_cfg *common_cfg, u32 sublink);
  298. #endif /* _DSI_CATALOG_H_ */