dp_display.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2019, 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/msm_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. struct dp_mst_hpd_info *info);
  28. void (*hpd_irq)(void *display, struct dp_mst_hpd_info *info);
  29. void (*set_drv_state)(void *dp_display,
  30. enum dp_drv_state mst_state);
  31. };
  32. struct dp_mst_drm_install_info {
  33. void *dp_mst_prv_info;
  34. const struct dp_mst_drm_cbs *cbs;
  35. };
  36. struct dp_mst_caps {
  37. bool has_mst;
  38. u32 max_streams_supported;
  39. u32 max_dpcd_transaction_bytes;
  40. struct drm_dp_aux *drm_aux;
  41. };
  42. struct dp_mst_connector {
  43. bool debug_en;
  44. int con_id;
  45. int hdisplay;
  46. int vdisplay;
  47. int vrefresh;
  48. int aspect_ratio;
  49. struct drm_connector *conn;
  50. struct mutex lock;
  51. struct list_head list;
  52. enum drm_connector_status state;
  53. };
  54. struct dp_display {
  55. struct drm_device *drm_dev;
  56. struct dp_bridge *bridge;
  57. struct drm_connector *base_connector;
  58. void *base_dp_panel;
  59. bool is_sst_connected;
  60. bool is_mst_supported;
  61. u32 max_pclk_khz;
  62. void *dp_mst_prv_info;
  63. int (*enable)(struct dp_display *dp_display, void *panel);
  64. int (*post_enable)(struct dp_display *dp_display, void *panel);
  65. int (*pre_disable)(struct dp_display *dp_display, void *panel);
  66. int (*disable)(struct dp_display *dp_display, void *panel);
  67. int (*set_mode)(struct dp_display *dp_display, void *panel,
  68. struct dp_display_mode *mode);
  69. enum drm_mode_status (*validate_mode)(struct dp_display *dp_display,
  70. void *panel, struct drm_display_mode *mode,
  71. const struct msm_resource_caps_info *avail_res);
  72. int (*get_modes)(struct dp_display *dp_display, void *panel,
  73. struct dp_display_mode *dp_mode);
  74. int (*prepare)(struct dp_display *dp_display, void *panel);
  75. int (*unprepare)(struct dp_display *dp_display, void *panel);
  76. int (*request_irq)(struct dp_display *dp_display);
  77. struct dp_debug *(*get_debug)(struct dp_display *dp_display);
  78. void (*post_open)(struct dp_display *dp_display);
  79. int (*config_hdr)(struct dp_display *dp_display, void *panel,
  80. struct drm_msm_ext_hdr_metadata *hdr_meta,
  81. bool dhdr_update);
  82. int (*post_init)(struct dp_display *dp_display);
  83. int (*mst_install)(struct dp_display *dp_display,
  84. struct dp_mst_drm_install_info *mst_install_info);
  85. int (*mst_uninstall)(struct dp_display *dp_display);
  86. int (*mst_connector_install)(struct dp_display *dp_display,
  87. struct drm_connector *connector);
  88. int (*mst_connector_uninstall)(struct dp_display *dp_display,
  89. struct drm_connector *connector);
  90. int (*mst_connector_update_edid)(struct dp_display *dp_display,
  91. struct drm_connector *connector,
  92. struct edid *edid);
  93. int (*mst_connector_update_link_info)(struct dp_display *dp_display,
  94. struct drm_connector *connector);
  95. int (*mst_get_connector_info)(struct dp_display *dp_display,
  96. struct drm_connector *connector,
  97. struct dp_mst_connector *mst_conn);
  98. int (*mst_get_fixed_topology_port)(struct dp_display *dp_display,
  99. u32 strm_id, u32 *port_num);
  100. int (*get_mst_caps)(struct dp_display *dp_display,
  101. struct dp_mst_caps *mst_caps);
  102. int (*set_stream_info)(struct dp_display *dp_display, void *panel,
  103. u32 strm_id, u32 start_slot, u32 num_slots, u32 pbn,
  104. int vcpi);
  105. void (*convert_to_dp_mode)(struct dp_display *dp_display, void *panel,
  106. const struct drm_display_mode *drm_mode,
  107. struct dp_display_mode *dp_mode);
  108. int (*update_pps)(struct dp_display *dp_display,
  109. struct drm_connector *connector, char *pps_cmd);
  110. void (*wakeup_phy_layer)(struct dp_display *dp_display,
  111. bool wakeup);
  112. };
  113. #ifdef CONFIG_DRM_MSM_DP
  114. int dp_display_get_num_of_displays(void);
  115. int dp_display_get_displays(void **displays, int count);
  116. int dp_display_get_num_of_streams(void);
  117. #else
  118. static inline int dp_display_get_num_of_displays(void)
  119. {
  120. return 0;
  121. }
  122. static inline int dp_display_get_displays(void **displays, int count)
  123. {
  124. return 0;
  125. }
  126. static inline int dp_display_get_num_of_streams(void)
  127. {
  128. return 0;
  129. }
  130. static inline int dp_connector_update_pps(struct drm_connector *connector,
  131. char *pps_cmd, void *display)
  132. {
  133. return 0;
  134. }
  135. #endif
  136. #endif /* _DP_DISPLAY_H_ */