dsi_drm.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2019, 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/drmP.h>
  9. #include <drm/drm_crtc.h>
  10. #include <drm/drm_crtc_helper.h>
  11. #include "msm_drv.h"
  12. #include "dsi_display.h"
  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. * @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_mode_info *mode_info,
  68. void *display, const struct msm_resource_caps_info *avail_res);
  69. /**
  70. * dsi_conn_mode_valid - callback to determine if specified mode is valid
  71. * @connector: Pointer to drm connector structure
  72. * @mode: Pointer to drm mode structure
  73. * @display: Pointer to private display handle
  74. * @avail_res: Pointer with curr available resources
  75. * Returns: Validity status for specified mode
  76. */
  77. enum drm_mode_status dsi_conn_mode_valid(struct drm_connector *connector,
  78. struct drm_display_mode *mode,
  79. void *display, const struct msm_resource_caps_info *avail_res);
  80. /**
  81. * dsi_conn_enable_event - callback to notify DSI driver of event registration
  82. * @connector: Pointer to drm connector structure
  83. * @event_idx: Connector event index
  84. * @enable: Whether or not the event is enabled
  85. * @display: Pointer to private display handle
  86. */
  87. void dsi_conn_enable_event(struct drm_connector *connector,
  88. uint32_t event_idx, bool enable, void *display);
  89. struct dsi_bridge *dsi_drm_bridge_init(struct dsi_display *display,
  90. struct drm_device *dev,
  91. struct drm_encoder *encoder);
  92. void dsi_drm_bridge_cleanup(struct dsi_bridge *bridge);
  93. /**
  94. * dsi_display_pre_kickoff - program kickoff-time features
  95. * @connector: Pointer to drm connector structure
  96. * @display: Pointer to private display structure
  97. * @params: Parameters for kickoff-time programming
  98. * Returns: Zero on success
  99. */
  100. int dsi_conn_pre_kickoff(struct drm_connector *connector,
  101. void *display,
  102. struct msm_display_kickoff_params *params);
  103. /**
  104. * dsi_display_post_kickoff - program post kickoff-time features
  105. * @connector: Pointer to drm connector structure
  106. * @params: Parameters for post kickoff programming
  107. * Returns: Zero on success
  108. */
  109. int dsi_conn_post_kickoff(struct drm_connector *connector,
  110. struct msm_display_conn_params *params);
  111. /**
  112. * dsi_convert_to_drm_mode - Update drm mode with dsi mode information
  113. * @dsi_mode: input parameter. structure having dsi mode information.
  114. * @drm_mode: output parameter. DRM mode set for the display
  115. */
  116. void dsi_convert_to_drm_mode(const struct dsi_display_mode *dsi_mode,
  117. struct drm_display_mode *drm_mode);
  118. u64 dsi_drm_find_bit_clk_rate(void *display,
  119. const 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. #endif /* _DSI_DRM_H_ */