dsi_catalog.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DSI_CATALOG_H_
  6. #define _DSI_CATALOG_H_
  7. #include "dsi_ctrl_hw.h"
  8. #include "dsi_phy_hw.h"
  9. /**
  10. * dsi_catalog_ctrl_setup() - return catalog info for dsi controller
  11. * @ctrl: Pointer to DSI controller hw object.
  12. * @version: DSI controller version.
  13. * @index: DSI controller instance ID.
  14. * @phy_isolation_enabled: DSI controller works isolated from phy.
  15. * @null_insertion_enabled: DSI controller inserts null packet.
  16. *
  17. * This function setups the catalog information in the dsi_ctrl_hw object.
  18. *
  19. * return: error code for failure and 0 for success.
  20. */
  21. int dsi_catalog_ctrl_setup(struct dsi_ctrl_hw *ctrl,
  22. enum dsi_ctrl_version version, u32 index,
  23. bool phy_isolation_enabled, bool null_insertion_enabled);
  24. /**
  25. * dsi_catalog_phy_setup() - return catalog info for dsi phy hardware
  26. * @phy: Pointer to DSI PHY hw object.
  27. * @version: DSI PHY version.
  28. * @index: DSI PHY instance ID.
  29. *
  30. * This function setups the catalog information in the dsi_phy_hw object.
  31. *
  32. * return: error code for failure and 0 for success.
  33. */
  34. int dsi_catalog_phy_setup(struct dsi_phy_hw *phy,
  35. enum dsi_phy_version version,
  36. u32 index);
  37. /**
  38. * dsi_phy_timing_calc_init() - initialize info for DSI PHY timing calculations
  39. * @phy: Pointer to DSI PHY hw object.
  40. * @version: DSI PHY version.
  41. *
  42. * This function setups the catalog information in the dsi_phy_hw object.
  43. *
  44. * return: error code for failure and 0 for success.
  45. */
  46. int dsi_phy_timing_calc_init(struct dsi_phy_hw *phy,
  47. enum dsi_phy_version version);
  48. /**
  49. * dsi_phy_hw_calculate_timing_params() - DSI PHY timing parameter calculations
  50. * @phy: Pointer to DSI PHY hw object.
  51. * @mode: DSI mode information.
  52. * @host: DSI host configuration.
  53. * @timing: DSI phy lane configurations.
  54. *
  55. * This function setups the catalog information in the dsi_phy_hw object.
  56. *
  57. * return: error code for failure and 0 for success.
  58. */
  59. int dsi_phy_hw_calculate_timing_params(struct dsi_phy_hw *phy,
  60. struct dsi_mode_info *mode,
  61. struct dsi_host_common_cfg *host,
  62. struct dsi_phy_per_lane_cfgs *timing);
  63. /* Definitions for 14nm PHY hardware driver */
  64. void dsi_phy_hw_v2_0_regulator_enable(struct dsi_phy_hw *phy,
  65. struct dsi_phy_per_lane_cfgs *cfg);
  66. void dsi_phy_hw_v2_0_regulator_disable(struct dsi_phy_hw *phy);
  67. void dsi_phy_hw_v2_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  68. void dsi_phy_hw_v2_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  69. void dsi_phy_hw_v2_0_idle_on(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  70. void dsi_phy_hw_v2_0_idle_off(struct dsi_phy_hw *phy);
  71. int dsi_phy_hw_timing_val_v2_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  72. u32 *timing_val, u32 size);
  73. void dsi_phy_hw_v2_0_clamp_ctrl(struct dsi_phy_hw *phy, bool enable);
  74. /* Definitions for 10nm PHY hardware driver */
  75. void dsi_phy_hw_v3_0_regulator_enable(struct dsi_phy_hw *phy,
  76. struct dsi_phy_per_lane_cfgs *cfg);
  77. void dsi_phy_hw_v3_0_regulator_disable(struct dsi_phy_hw *phy);
  78. void dsi_phy_hw_v3_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  79. void dsi_phy_hw_v3_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  80. int dsi_phy_hw_v3_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
  81. void dsi_phy_hw_v3_0_ulps_request(struct dsi_phy_hw *phy,
  82. struct dsi_phy_cfg *cfg, u32 lanes);
  83. void dsi_phy_hw_v3_0_ulps_exit(struct dsi_phy_hw *phy,
  84. struct dsi_phy_cfg *cfg, u32 lanes);
  85. u32 dsi_phy_hw_v3_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
  86. bool dsi_phy_hw_v3_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
  87. int dsi_phy_hw_timing_val_v3_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  88. u32 *timing_val, u32 size);
  89. void dsi_phy_hw_v3_0_clamp_ctrl(struct dsi_phy_hw *phy, bool enable);
  90. int dsi_phy_hw_v3_0_lane_reset(struct dsi_phy_hw *phy);
  91. void dsi_phy_hw_v3_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
  92. /* Definitions for 7nm PHY hardware driver */
  93. void dsi_phy_hw_v4_0_enable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  94. void dsi_phy_hw_v4_0_disable(struct dsi_phy_hw *phy, struct dsi_phy_cfg *cfg);
  95. int dsi_phy_hw_v4_0_wait_for_lane_idle(struct dsi_phy_hw *phy, u32 lanes);
  96. void dsi_phy_hw_v4_0_ulps_request(struct dsi_phy_hw *phy,
  97. struct dsi_phy_cfg *cfg, u32 lanes);
  98. void dsi_phy_hw_v4_0_ulps_exit(struct dsi_phy_hw *phy,
  99. struct dsi_phy_cfg *cfg, u32 lanes);
  100. u32 dsi_phy_hw_v4_0_get_lanes_in_ulps(struct dsi_phy_hw *phy);
  101. bool dsi_phy_hw_v4_0_is_lanes_in_ulps(u32 lanes, u32 ulps_lanes);
  102. int dsi_phy_hw_timing_val_v4_0(struct dsi_phy_per_lane_cfgs *timing_cfg,
  103. u32 *timing_val, u32 size);
  104. int dsi_phy_hw_v4_0_lane_reset(struct dsi_phy_hw *phy);
  105. void dsi_phy_hw_v4_0_toggle_resync_fifo(struct dsi_phy_hw *phy);
  106. void dsi_phy_hw_v4_0_reset_clk_en_sel(struct dsi_phy_hw *phy);
  107. /* DSI controller common ops */
  108. u32 dsi_ctrl_hw_cmn_get_interrupt_status(struct dsi_ctrl_hw *ctrl);
  109. void dsi_ctrl_hw_cmn_debug_bus(struct dsi_ctrl_hw *ctrl, u32 *entries,
  110. u32 size);
  111. void dsi_ctrl_hw_cmn_clear_interrupt_status(struct dsi_ctrl_hw *ctrl, u32 ints);
  112. void dsi_ctrl_hw_cmn_enable_status_interrupts(struct dsi_ctrl_hw *ctrl,
  113. u32 ints);
  114. u64 dsi_ctrl_hw_cmn_get_error_status(struct dsi_ctrl_hw *ctrl);
  115. void dsi_ctrl_hw_cmn_clear_error_status(struct dsi_ctrl_hw *ctrl, u64 errors);
  116. void dsi_ctrl_hw_cmn_enable_error_interrupts(struct dsi_ctrl_hw *ctrl,
  117. u64 errors);
  118. void dsi_ctrl_hw_cmn_video_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
  119. enum dsi_test_pattern type,
  120. u32 init_val);
  121. void dsi_ctrl_hw_cmn_cmd_test_pattern_setup(struct dsi_ctrl_hw *ctrl,
  122. enum dsi_test_pattern type,
  123. u32 init_val,
  124. u32 stream_id);
  125. void dsi_ctrl_hw_cmn_test_pattern_enable(struct dsi_ctrl_hw *ctrl, bool enable);
  126. void dsi_ctrl_hw_cmn_trigger_cmd_test_pattern(struct dsi_ctrl_hw *ctrl,
  127. u32 stream_id);
  128. void dsi_ctrl_hw_cmn_host_setup(struct dsi_ctrl_hw *ctrl,
  129. struct dsi_host_common_cfg *config);
  130. void dsi_ctrl_hw_cmn_video_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
  131. void dsi_ctrl_hw_cmn_video_engine_setup(struct dsi_ctrl_hw *ctrl,
  132. struct dsi_host_common_cfg *common_cfg,
  133. struct dsi_video_engine_cfg *cfg);
  134. void dsi_ctrl_hw_cmn_setup_avr(struct dsi_ctrl_hw *ctrl, bool enable);
  135. void dsi_ctrl_hw_cmn_set_video_timing(struct dsi_ctrl_hw *ctrl,
  136. struct dsi_mode_info *mode);
  137. void dsi_ctrl_hw_cmn_set_timing_db(struct dsi_ctrl_hw *ctrl,
  138. bool enable);
  139. void dsi_ctrl_hw_cmn_cmd_engine_setup(struct dsi_ctrl_hw *ctrl,
  140. struct dsi_host_common_cfg *common_cfg,
  141. struct dsi_cmd_engine_cfg *cfg);
  142. void dsi_ctrl_hw_cmn_ctrl_en(struct dsi_ctrl_hw *ctrl, bool on);
  143. void dsi_ctrl_hw_cmn_cmd_engine_en(struct dsi_ctrl_hw *ctrl, bool on);
  144. void dsi_ctrl_hw_cmn_setup_cmd_stream(struct dsi_ctrl_hw *ctrl,
  145. struct dsi_mode_info *mode,
  146. u32 h_stride,
  147. u32 vc_id,
  148. struct dsi_rect *roi);
  149. void dsi_ctrl_hw_cmn_phy_sw_reset(struct dsi_ctrl_hw *ctrl);
  150. void dsi_ctrl_hw_cmn_soft_reset(struct dsi_ctrl_hw *ctrl);
  151. void dsi_ctrl_hw_cmn_setup_misr(struct dsi_ctrl_hw *ctrl,
  152. enum dsi_op_mode panel_mode,
  153. bool enable, u32 frame_count);
  154. u32 dsi_ctrl_hw_cmn_collect_misr(struct dsi_ctrl_hw *ctrl,
  155. enum dsi_op_mode panel_mode);
  156. void dsi_ctrl_hw_cmn_kickoff_command(struct dsi_ctrl_hw *ctrl,
  157. struct dsi_ctrl_cmd_dma_info *cmd,
  158. u32 flags);
  159. void dsi_ctrl_hw_cmn_kickoff_fifo_command(struct dsi_ctrl_hw *ctrl,
  160. struct dsi_ctrl_cmd_dma_fifo_info *cmd,
  161. u32 flags);
  162. void dsi_ctrl_hw_cmn_reset_cmd_fifo(struct dsi_ctrl_hw *ctrl);
  163. void dsi_ctrl_hw_cmn_trigger_command_dma(struct dsi_ctrl_hw *ctrl);
  164. void dsi_ctrl_hw_dln0_phy_err(struct dsi_ctrl_hw *ctrl);
  165. void dsi_ctrl_hw_cmn_phy_reset_config(struct dsi_ctrl_hw *ctrl,
  166. bool enable);
  167. void dsi_ctrl_hw_22_phy_reset_config(struct dsi_ctrl_hw *ctrl,
  168. bool enable);
  169. u32 dsi_ctrl_hw_cmn_get_cmd_read_data(struct dsi_ctrl_hw *ctrl,
  170. u8 *rd_buf,
  171. u32 read_offset,
  172. u32 rx_byte,
  173. u32 pkt_size, u32 *hw_read_cnt);
  174. void dsi_ctrl_hw_cmn_clear_rdbk_reg(struct dsi_ctrl_hw *ctrl);
  175. void dsi_ctrl_hw_22_schedule_dma_cmd(struct dsi_ctrl_hw *ctrl, int line_on);
  176. int dsi_ctrl_hw_cmn_ctrl_reset(struct dsi_ctrl_hw *ctrl,
  177. int mask);
  178. void dsi_ctrl_hw_cmn_mask_error_intr(struct dsi_ctrl_hw *ctrl, u32 idx,
  179. bool en);
  180. void dsi_ctrl_hw_cmn_error_intr_ctrl(struct dsi_ctrl_hw *ctrl, bool en);
  181. u32 dsi_ctrl_hw_cmn_get_error_mask(struct dsi_ctrl_hw *ctrl);
  182. u32 dsi_ctrl_hw_cmn_get_hw_version(struct dsi_ctrl_hw *ctrl);
  183. int dsi_ctrl_hw_cmn_wait_for_cmd_mode_mdp_idle(struct dsi_ctrl_hw *ctrl);
  184. /* Definitions specific to 1.4 DSI controller hardware */
  185. int dsi_ctrl_hw_14_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
  186. void dsi_ctrl_hw_14_setup_lane_map(struct dsi_ctrl_hw *ctrl,
  187. struct dsi_lane_map *lane_map);
  188. void dsi_ctrl_hw_cmn_ulps_request(struct dsi_ctrl_hw *ctrl, u32 lanes);
  189. void dsi_ctrl_hw_cmn_ulps_exit(struct dsi_ctrl_hw *ctrl, u32 lanes);
  190. u32 dsi_ctrl_hw_cmn_get_lanes_in_ulps(struct dsi_ctrl_hw *ctrl);
  191. void dsi_ctrl_hw_14_clamp_enable(struct dsi_ctrl_hw *ctrl,
  192. u32 lanes,
  193. bool enable_ulps);
  194. void dsi_ctrl_hw_14_clamp_disable(struct dsi_ctrl_hw *ctrl,
  195. u32 lanes,
  196. bool disable_ulps);
  197. ssize_t dsi_ctrl_hw_14_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
  198. char *buf,
  199. u32 size);
  200. /* Definitions specific to 2.0 DSI controller hardware */
  201. void dsi_ctrl_hw_20_setup_lane_map(struct dsi_ctrl_hw *ctrl,
  202. struct dsi_lane_map *lane_map);
  203. int dsi_ctrl_hw_20_wait_for_lane_idle(struct dsi_ctrl_hw *ctrl, u32 lanes);
  204. ssize_t dsi_ctrl_hw_20_reg_dump_to_buffer(struct dsi_ctrl_hw *ctrl,
  205. char *buf,
  206. u32 size);
  207. void dsi_ctrl_hw_kickoff_non_embedded_mode(struct dsi_ctrl_hw *ctrl,
  208. struct dsi_ctrl_cmd_dma_info *cmd,
  209. u32 flags);
  210. /* Definitions specific to 2.2 DSI controller hardware */
  211. bool dsi_ctrl_hw_22_get_cont_splash_status(struct dsi_ctrl_hw *ctrl);
  212. void dsi_ctrl_hw_22_config_clk_gating(struct dsi_ctrl_hw *ctrl, bool enable,
  213. enum dsi_clk_gate_type clk_selection);
  214. void dsi_ctrl_hw_cmn_set_continuous_clk(struct dsi_ctrl_hw *ctrl, bool enable);
  215. #endif /* _DSI_CATALOG_H_ */