dsi_drm.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
  5. */
  6. #ifndef _DSI_DRM_H_
  7. #define _DSI_DRM_H_
  8. #include <linux/types.h>
  9. #include <drm/drm_crtc.h>
  10. #include "msm_drv.h"
  11. #include "dsi_display.h"
  12. #define NO_OVERRIDE -1
  13. struct dsi_bridge {
  14. struct drm_bridge base;
  15. u32 id;
  16. struct dsi_display *display;
  17. struct dsi_display_mode dsi_mode;
  18. };
  19. /**
  20. * dsi_conn_set_info_blob - callback to perform info blob initialization
  21. * @connector: Pointer to drm connector structure
  22. * @info: Pointer to sde connector info structure
  23. * @display: Pointer to private display handle
  24. * @mode_info: Pointer to mode info structure
  25. * Returns: Zero on success
  26. */
  27. int dsi_conn_set_info_blob(struct drm_connector *connector,
  28. void *info,
  29. void *display,
  30. struct msm_mode_info *mode_info);
  31. /**
  32. * dsi_conn_detect - callback to determine if connector is connected
  33. * @connector: Pointer to drm connector structure
  34. * @force: Force detect setting from drm framework
  35. * @display: Pointer to private display handle
  36. * Returns: Connector 'is connected' status
  37. */
  38. enum drm_connector_status dsi_conn_detect(struct drm_connector *conn,
  39. bool force,
  40. void *display);
  41. /**
  42. * dsi_connector_get_modes - callback to add drm modes via drm_mode_probed_add()
  43. * @connector: Pointer to drm connector structure
  44. * @display: Pointer to private display handle
  45. * @avail_res: Pointer with curr available resources
  46. * Returns: Number of modes added
  47. */
  48. int dsi_connector_get_modes(struct drm_connector *connector,
  49. void *display, const struct msm_resource_caps_info *avail_res);
  50. /**
  51. * dsi_connector_put_modes - callback to free up drm modes of the connector
  52. * @connector: Pointer to drm connector structure
  53. * @display: Pointer to private display handle
  54. */
  55. void dsi_connector_put_modes(struct drm_connector *connector,
  56. void *display);
  57. /**
  58. * dsi_conn_get_mode_info - retrieve information on the mode selected
  59. * @drm_mode: Display mode set for the display
  60. * @sub_mode: Additional mode info to drm display mode
  61. * @mode_info: Out parameter. information of the mode.
  62. * @display: Pointer to private display structure
  63. * @avail_res: Pointer with curr available resources
  64. * Returns: Zero on success
  65. */
  66. int dsi_conn_get_mode_info(struct drm_connector *connector,
  67. const struct drm_display_mode *drm_mode,
  68. struct msm_sub_mode *sub_mode,
  69. struct msm_mode_info *mode_info,
  70. void *display, const struct msm_resource_caps_info *avail_res);
  71. /**
  72. * dsi_conn_mode_valid - callback to determine if specified mode is valid
  73. * @connector: Pointer to drm connector structure
  74. * @mode: Pointer to drm mode structure
  75. * @display: Pointer to private display handle
  76. * @avail_res: Pointer with curr available resources
  77. * Returns: Validity status for specified mode
  78. */
  79. enum drm_mode_status dsi_conn_mode_valid(struct drm_connector *connector,
  80. struct drm_display_mode *mode,
  81. void *display, const struct msm_resource_caps_info *avail_res);
  82. /**
  83. * dsi_conn_enable_event - callback to notify DSI driver of event registration
  84. * @connector: Pointer to drm connector structure
  85. * @event_idx: Connector event index
  86. * @enable: Whether or not the event is enabled
  87. * @display: Pointer to private display handle
  88. */
  89. void dsi_conn_enable_event(struct drm_connector *connector,
  90. uint32_t event_idx, bool enable, void *display);
  91. struct dsi_bridge *dsi_drm_bridge_init(struct dsi_display *display,
  92. struct drm_device *dev,
  93. struct drm_encoder *encoder);
  94. void dsi_drm_bridge_cleanup(struct dsi_bridge *bridge);
  95. /**
  96. * dsi_display_pre_kickoff - program kickoff-time features
  97. * @connector: Pointer to drm connector structure
  98. * @display: Pointer to private display structure
  99. * @params: Parameters for kickoff-time programming
  100. * Returns: Zero on success
  101. */
  102. int dsi_conn_pre_kickoff(struct drm_connector *connector,
  103. void *display,
  104. struct msm_display_kickoff_params *params);
  105. /**
  106. * dsi_display_post_kickoff - program post kickoff-time features
  107. * @connector: Pointer to drm connector structure
  108. * @params: Parameters for post kickoff programming
  109. * Returns: Zero on success
  110. */
  111. int dsi_conn_post_kickoff(struct drm_connector *connector,
  112. struct msm_display_conn_params *params);
  113. /**
  114. * dsi_convert_to_drm_mode - Update drm mode with dsi mode information
  115. * @dsi_mode: input parameter. structure having dsi mode information.
  116. * @drm_mode: output parameter. DRM mode set for the display
  117. */
  118. void dsi_convert_to_drm_mode(const struct dsi_display_mode *dsi_mode,
  119. struct drm_display_mode *drm_mode);
  120. /**
  121. * dsi_conn_prepare_commit - program pre commit time features
  122. * @display: Pointer to private display structure
  123. * @params: Parameters for pre commit programming
  124. * Returns: Zero on success
  125. */
  126. int dsi_conn_prepare_commit(void *display,
  127. struct msm_display_conn_params *params);
  128. /**
  129. * dsi_set_allowed_mode_switch - set allowed mode switch bitmask
  130. * @connector: Pointer to drm connector structure
  131. * @display: Pointer to private display structure
  132. */
  133. void dsi_conn_set_allowed_mode_switch(struct drm_connector *connector,
  134. void *display);
  135. /**
  136. * dsi_conn_set_dyn_bit_clk - set target dynamic clock rate
  137. * @connector: Pointer to drm connector structure
  138. * @value: Target dynamic clock rate
  139. * Returns: Zero on success
  140. */
  141. int dsi_conn_set_dyn_bit_clk(struct drm_connector *connector,
  142. uint64_t value);
  143. /**
  144. * dsi_conn_set_submode_blob_info - populate given sub mode blob
  145. * @connector: Pointer to drm connector structure
  146. * @info: Pointer to sde connector info structure
  147. * @display: Pointer to private display handle
  148. * @drm_mode: Pointer to drm_display_mode structure
  149. */
  150. void dsi_conn_set_submode_blob_info(struct drm_connector *conn,
  151. void *info, void *display, struct drm_display_mode *drm_mode);
  152. /**
  153. * dsi_conn_get_qsync_min_fps() - get qsync min fps for given fps
  154. * @conn_state: Pointer to drm_connector_state structure
  155. *
  156. * Return: Qsync min fps rate or -ve error code.
  157. */
  158. int dsi_conn_get_qsync_min_fps(struct drm_connector_state *conn_state);
  159. /**
  160. * dsi_conn_get_avr_step_fps() - get avr step fps for given mode
  161. * @conn_state: Pointer to drm_connector_state structure
  162. *
  163. * Return: AVR step fps rate or -ve error code.
  164. */
  165. int dsi_conn_get_avr_step_fps(struct drm_connector_state *conn_state);
  166. #endif /* _DSI_DRM_H_ */