dsi_drm.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. * @mode_info: Out parameter. information of the mode.
  60. * @display: Pointer to private display structure
  61. * @avail_res: Pointer with curr available resources
  62. * Returns: Zero on success
  63. */
  64. int dsi_conn_get_mode_info(struct drm_connector *connector,
  65. const struct drm_display_mode *drm_mode,
  66. struct msm_mode_info *mode_info,
  67. void *display, const struct msm_resource_caps_info *avail_res);
  68. /**
  69. * dsi_conn_mode_valid - callback to determine if specified mode is valid
  70. * @connector: Pointer to drm connector structure
  71. * @mode: Pointer to drm mode structure
  72. * @display: Pointer to private display handle
  73. * @avail_res: Pointer with curr available resources
  74. * Returns: Validity status for specified mode
  75. */
  76. enum drm_mode_status dsi_conn_mode_valid(struct drm_connector *connector,
  77. struct drm_display_mode *mode,
  78. void *display, const struct msm_resource_caps_info *avail_res);
  79. /**
  80. * dsi_conn_enable_event - callback to notify DSI driver of event registration
  81. * @connector: Pointer to drm connector structure
  82. * @event_idx: Connector event index
  83. * @enable: Whether or not the event is enabled
  84. * @display: Pointer to private display handle
  85. */
  86. void dsi_conn_enable_event(struct drm_connector *connector,
  87. uint32_t event_idx, bool enable, void *display);
  88. struct dsi_bridge *dsi_drm_bridge_init(struct dsi_display *display,
  89. struct drm_device *dev,
  90. struct drm_encoder *encoder);
  91. void dsi_drm_bridge_cleanup(struct dsi_bridge *bridge);
  92. /**
  93. * dsi_display_pre_kickoff - program kickoff-time features
  94. * @connector: Pointer to drm connector structure
  95. * @display: Pointer to private display structure
  96. * @params: Parameters for kickoff-time programming
  97. * Returns: Zero on success
  98. */
  99. int dsi_conn_pre_kickoff(struct drm_connector *connector,
  100. void *display,
  101. struct msm_display_kickoff_params *params);
  102. /**
  103. * dsi_display_post_kickoff - program post kickoff-time features
  104. * @connector: Pointer to drm connector structure
  105. * @params: Parameters for post kickoff programming
  106. * Returns: Zero on success
  107. */
  108. int dsi_conn_post_kickoff(struct drm_connector *connector,
  109. struct msm_display_conn_params *params);
  110. /**
  111. * dsi_convert_to_drm_mode - Update drm mode with dsi mode information
  112. * @dsi_mode: input parameter. structure having dsi mode information.
  113. * @drm_mode: output parameter. DRM mode set for the display
  114. */
  115. void dsi_convert_to_drm_mode(const struct dsi_display_mode *dsi_mode,
  116. struct drm_display_mode *drm_mode);
  117. /**
  118. * dsi_conn_prepare_commit - program pre commit time features
  119. * @display: Pointer to private display structure
  120. * @params: Parameters for pre commit programming
  121. * Returns: Zero on success
  122. */
  123. int dsi_conn_prepare_commit(void *display,
  124. struct msm_display_conn_params *params);
  125. /**
  126. * dsi_set_allowed_mode_switch - set allowed mode switch bitmask
  127. * @connector: Pointer to drm connector structure
  128. * @display: Pointer to private display structure
  129. */
  130. void dsi_conn_set_allowed_mode_switch(struct drm_connector *connector,
  131. void *display);
  132. /**
  133. * dsi_conn_set_dyn_bit_clk - set target dynamic clock rate
  134. * @connector: Pointer to drm connector structure
  135. * @value: Target dynamic clock rate
  136. * Returns: Zero on success
  137. */
  138. int dsi_conn_set_dyn_bit_clk(struct drm_connector *connector,
  139. uint64_t value);
  140. #endif /* _DSI_DRM_H_ */