dp_display.h 4.2 KB

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