dsi_drm.h 5.2 KB

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