dp_display.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. int (*get_modes)(struct dp_display *dp_display, void *panel,
  72. struct dp_display_mode *dp_mode);
  73. int (*prepare)(struct dp_display *dp_display, void *panel);
  74. int (*unprepare)(struct dp_display *dp_display, void *panel);
  75. int (*request_irq)(struct dp_display *dp_display);
  76. struct dp_debug *(*get_debug)(struct dp_display *dp_display);
  77. void (*post_open)(struct dp_display *dp_display);
  78. int (*config_hdr)(struct dp_display *dp_display, void *panel,
  79. struct drm_msm_ext_hdr_metadata *hdr_meta,
  80. bool dhdr_update);
  81. int (*post_init)(struct dp_display *dp_display);
  82. int (*mst_install)(struct dp_display *dp_display,
  83. struct dp_mst_drm_install_info *mst_install_info);
  84. int (*mst_uninstall)(struct dp_display *dp_display);
  85. int (*mst_connector_install)(struct dp_display *dp_display,
  86. struct drm_connector *connector);
  87. int (*mst_connector_uninstall)(struct dp_display *dp_display,
  88. struct drm_connector *connector);
  89. int (*mst_connector_update_edid)(struct dp_display *dp_display,
  90. struct drm_connector *connector,
  91. struct edid *edid);
  92. int (*mst_connector_update_link_info)(struct dp_display *dp_display,
  93. struct drm_connector *connector);
  94. int (*mst_get_connector_info)(struct dp_display *dp_display,
  95. struct drm_connector *connector,
  96. struct dp_mst_connector *mst_conn);
  97. int (*mst_get_fixed_topology_port)(struct dp_display *dp_display,
  98. u32 strm_id, u32 *port_num);
  99. int (*get_mst_caps)(struct dp_display *dp_display,
  100. struct dp_mst_caps *mst_caps);
  101. int (*set_stream_info)(struct dp_display *dp_display, void *panel,
  102. u32 strm_id, u32 start_slot, u32 num_slots, u32 pbn,
  103. int vcpi);
  104. void (*convert_to_dp_mode)(struct dp_display *dp_display, void *panel,
  105. const struct drm_display_mode *drm_mode,
  106. struct dp_display_mode *dp_mode);
  107. int (*update_pps)(struct dp_display *dp_display,
  108. struct drm_connector *connector, char *pps_cmd);
  109. void (*wakeup_phy_layer)(struct dp_display *dp_display,
  110. bool wakeup);
  111. };
  112. #ifdef CONFIG_DRM_MSM_DP
  113. int dp_display_get_num_of_displays(void);
  114. int dp_display_get_displays(void **displays, int count);
  115. int dp_display_get_num_of_streams(void);
  116. #else
  117. static inline int dp_display_get_num_of_displays(void)
  118. {
  119. return 0;
  120. }
  121. static inline int dp_display_get_displays(void **displays, int count)
  122. {
  123. return 0;
  124. }
  125. static inline int dp_display_get_num_of_streams(void)
  126. {
  127. return 0;
  128. }
  129. static inline int dp_connector_update_pps(struct drm_connector *connector,
  130. char *pps_cmd, void *display)
  131. {
  132. return 0;
  133. }
  134. #endif
  135. #endif /* _DP_DISPLAY_H_ */