dp_display.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_DISPLAY_H_
  6. #define _DP_DISPLAY_H_
  7. #include <linux/list.h>
  8. #include <drm/drmP.h>
  9. #include <drm/sde_drm.h>
  10. #include "dp_panel.h"
  11. #define DP_MST_SIM_MAX_PORTS 8
  12. enum dp_drv_state {
  13. PM_DEFAULT,
  14. PM_SUSPEND,
  15. };
  16. struct dp_mst_hpd_info {
  17. bool mst_protocol;
  18. bool mst_hpd_sim;
  19. u32 mst_port_cnt;
  20. u8 *edid;
  21. bool mst_sim_add_con;
  22. bool mst_sim_remove_con;
  23. int mst_sim_remove_con_id;
  24. };
  25. struct dp_mst_drm_cbs {
  26. void (*hpd)(void *display, bool hpd_status);
  27. void (*hpd_irq)(void *display, struct dp_mst_hpd_info *info);
  28. void (*set_drv_state)(void *dp_display,
  29. enum dp_drv_state mst_state);
  30. int (*set_mgr_state)(void *dp_display, bool state,
  31. struct dp_mst_hpd_info *info);
  32. };
  33. struct dp_mst_drm_install_info {
  34. void *dp_mst_prv_info;
  35. const struct dp_mst_drm_cbs *cbs;
  36. };
  37. struct dp_mst_caps {
  38. bool has_mst;
  39. u32 max_streams_supported;
  40. u32 max_dpcd_transaction_bytes;
  41. struct drm_dp_aux *drm_aux;
  42. };
  43. struct dp_mst_connector {
  44. bool debug_en;
  45. int con_id;
  46. int hdisplay;
  47. int vdisplay;
  48. int vrefresh;
  49. int aspect_ratio;
  50. struct drm_connector *conn;
  51. struct mutex lock;
  52. struct list_head list;
  53. enum drm_connector_status state;
  54. };
  55. struct dp_display {
  56. struct drm_device *drm_dev;
  57. struct dp_bridge *bridge;
  58. struct drm_connector *base_connector;
  59. void *base_dp_panel;
  60. bool is_sst_connected;
  61. bool is_mst_supported;
  62. bool dsc_cont_pps;
  63. u32 max_pclk_khz;
  64. void *dp_mst_prv_info;
  65. u32 max_mixer_count;
  66. u32 max_dsc_count;
  67. int (*enable)(struct dp_display *dp_display, void *panel);
  68. int (*post_enable)(struct dp_display *dp_display, void *panel);
  69. int (*pre_disable)(struct dp_display *dp_display, void *panel);
  70. int (*disable)(struct dp_display *dp_display, void *panel);
  71. int (*set_mode)(struct dp_display *dp_display, void *panel,
  72. struct dp_display_mode *mode);
  73. enum drm_mode_status (*validate_mode)(struct dp_display *dp_display,
  74. void *panel, struct drm_display_mode *mode,
  75. const struct msm_resource_caps_info *avail_res);
  76. int (*get_modes)(struct dp_display *dp_display, void *panel,
  77. struct dp_display_mode *dp_mode);
  78. int (*prepare)(struct dp_display *dp_display, void *panel);
  79. int (*unprepare)(struct dp_display *dp_display, void *panel);
  80. int (*request_irq)(struct dp_display *dp_display);
  81. struct dp_debug *(*get_debug)(struct dp_display *dp_display);
  82. void (*post_open)(struct dp_display *dp_display);
  83. int (*config_hdr)(struct dp_display *dp_display, void *panel,
  84. struct drm_msm_ext_hdr_metadata *hdr_meta,
  85. bool dhdr_update);
  86. int (*set_colorspace)(struct dp_display *dp_display, void *panel,
  87. u32 colorspace);
  88. int (*post_init)(struct dp_display *dp_display);
  89. int (*mst_install)(struct dp_display *dp_display,
  90. struct dp_mst_drm_install_info *mst_install_info);
  91. int (*mst_uninstall)(struct dp_display *dp_display);
  92. int (*mst_connector_install)(struct dp_display *dp_display,
  93. struct drm_connector *connector);
  94. int (*mst_connector_uninstall)(struct dp_display *dp_display,
  95. struct drm_connector *connector);
  96. int (*mst_connector_update_edid)(struct dp_display *dp_display,
  97. struct drm_connector *connector,
  98. struct edid *edid);
  99. int (*mst_connector_update_link_info)(struct dp_display *dp_display,
  100. struct drm_connector *connector);
  101. int (*mst_get_connector_info)(struct dp_display *dp_display,
  102. struct drm_connector *connector,
  103. struct dp_mst_connector *mst_conn);
  104. int (*mst_get_fixed_topology_port)(struct dp_display *dp_display,
  105. u32 strm_id, u32 *port_num);
  106. int (*get_mst_caps)(struct dp_display *dp_display,
  107. struct dp_mst_caps *mst_caps);
  108. int (*set_stream_info)(struct dp_display *dp_display, void *panel,
  109. u32 strm_id, u32 start_slot, u32 num_slots, u32 pbn,
  110. int vcpi);
  111. void (*convert_to_dp_mode)(struct dp_display *dp_display, void *panel,
  112. const struct drm_display_mode *drm_mode,
  113. struct dp_display_mode *dp_mode);
  114. int (*update_pps)(struct dp_display *dp_display,
  115. struct drm_connector *connector, char *pps_cmd);
  116. void (*wakeup_phy_layer)(struct dp_display *dp_display,
  117. bool wakeup);
  118. int (*get_available_dp_resources)(struct dp_display *dp_display,
  119. const struct msm_resource_caps_info *avail_res,
  120. struct msm_resource_caps_info *max_dp_avail_res);
  121. };
  122. #if IS_ENABLED(CONFIG_DRM_MSM_DP)
  123. int dp_display_get_num_of_displays(void);
  124. int dp_display_get_displays(void **displays, int count);
  125. int dp_display_get_num_of_streams(void);
  126. #else
  127. static inline int dp_display_get_num_of_displays(void)
  128. {
  129. return 0;
  130. }
  131. static inline int dp_display_get_displays(void **displays, int count)
  132. {
  133. return 0;
  134. }
  135. static inline int dp_display_get_num_of_streams(void)
  136. {
  137. return 0;
  138. }
  139. static inline int dp_connector_update_pps(struct drm_connector *connector,
  140. char *pps_cmd, void *display)
  141. {
  142. return 0;
  143. }
  144. #endif /* CONFIG_DRM_MSM_DP */
  145. #endif /* _DP_DISPLAY_H_ */