dp_debug.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_DEBUG_H_
  6. #define _DP_DEBUG_H_
  7. #include "dp_panel.h"
  8. #include "dp_ctrl.h"
  9. #include "dp_link.h"
  10. #include "dp_aux.h"
  11. #include "dp_display.h"
  12. #include "dp_pll.h"
  13. #define DP_DEBUG(fmt, ...) \
  14. do { \
  15. if (drm_debug_enabled(DRM_UT_KMS)) \
  16. DRM_DEBUG("[msm-dp-debug][%-4d]"fmt, current->pid, \
  17. ##__VA_ARGS__); \
  18. else \
  19. pr_debug("[drm:%s][msm-dp-debug][%-4d]"fmt, __func__,\
  20. current->pid, ##__VA_ARGS__); \
  21. } while (0)
  22. #define DP_INFO(fmt, ...) \
  23. do { \
  24. if (drm_debug_enabled(DRM_UT_KMS)) \
  25. DRM_INFO("[msm-dp-info][%-4d]"fmt, current->pid, \
  26. ##__VA_ARGS__); \
  27. else \
  28. pr_info("[drm:%s][msm-dp-info][%-4d]"fmt, __func__, \
  29. current->pid, ##__VA_ARGS__); \
  30. } while (0)
  31. #define DP_WARN(fmt, ...) \
  32. pr_warn("[drm:%s][msm-dp-warn][%-4d]"fmt, __func__, \
  33. current->pid, ##__VA_ARGS__)
  34. #define DP_ERR(fmt, ...) \
  35. pr_err("[drm:%s][msm-dp-err][%-4d]"fmt, __func__, \
  36. current->pid, ##__VA_ARGS__)
  37. #define DEFAULT_DISCONNECT_DELAY_MS 0
  38. #define MAX_DISCONNECT_DELAY_MS 10000
  39. #define DEFAULT_CONNECT_NOTIFICATION_DELAY_MS 150
  40. #define MAX_CONNECT_NOTIFICATION_DELAY_MS 5000
  41. /**
  42. * struct dp_debug
  43. * @debug_en: specifies whether debug mode enabled
  44. * @sim_mode: specifies whether sim mode enabled
  45. * @psm_enabled: specifies whether psm enabled
  46. * @hdcp_disabled: specifies if hdcp is disabled
  47. * @hdcp_wait_sink_sync: used to wait for sink synchronization before HDCP auth
  48. * @aspect_ratio: used to filter out aspect_ratio value
  49. * @vdisplay: used to filter out vdisplay value
  50. * @hdisplay: used to filter out hdisplay value
  51. * @vrefresh: used to filter out vrefresh value
  52. * @tpg_state: specifies whether tpg feature is enabled
  53. * @max_pclk_khz: max pclk supported
  54. * @force_encryption: enable/disable forced encryption for HDCP 2.2
  55. * @skip_uevent: skip hotplug uevent to the user space
  56. * @hdcp_status: string holding hdcp status information
  57. * @dp_mst_connector_list: list containing all dp mst connectors
  58. * @mst_hpd_sim: specifies whether simulated hpd enabled
  59. * @mst_sim_add_con: specifies whether new sim connector is to be added
  60. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  61. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  62. * @mst_port_cnt: number of mst ports to be added during hpd
  63. * @connect_notification_delay_ms: time (in ms) to wait for any attention
  64. * messages before sending the connect notification uevent
  65. * @disconnect_delay_ms: time (in ms) to wait before turning off the mainlink
  66. * in response to HPD low of cable disconnect event
  67. */
  68. struct dp_debug {
  69. bool debug_en;
  70. bool sim_mode;
  71. bool psm_enabled;
  72. bool hdcp_disabled;
  73. bool hdcp_wait_sink_sync;
  74. int aspect_ratio;
  75. int vdisplay;
  76. int hdisplay;
  77. int vrefresh;
  78. bool tpg_state;
  79. u32 max_pclk_khz;
  80. bool force_encryption;
  81. bool skip_uevent;
  82. char hdcp_status[SZ_128];
  83. struct dp_mst_connector dp_mst_connector_list;
  84. bool mst_hpd_sim;
  85. bool mst_sim_add_con;
  86. bool mst_sim_remove_con;
  87. int mst_sim_remove_con_id;
  88. u32 mst_port_cnt;
  89. unsigned long connect_notification_delay_ms;
  90. u32 disconnect_delay_ms;
  91. struct dp_mst_connector mst_connector_cache;
  92. u8 *(*get_edid)(struct dp_debug *dp_debug);
  93. void (*abort)(struct dp_debug *dp_debug);
  94. void (*set_mst_con)(struct dp_debug *dp_debug, int con_id);
  95. };
  96. /**
  97. * struct dp_debug_in
  98. * @dev: device instance of the caller
  99. * @panel: instance of panel module
  100. * @hpd: instance of hpd module
  101. * @link: instance of link module
  102. * @aux: instance of aux module
  103. * @connector: double pointer to display connector
  104. * @catalog: instance of catalog module
  105. * @parser: instance of parser module
  106. * @ctrl: instance of controller module
  107. * @pll: instance of pll module
  108. */
  109. struct dp_debug_in {
  110. struct device *dev;
  111. struct dp_panel *panel;
  112. struct dp_hpd *hpd;
  113. struct dp_link *link;
  114. struct dp_aux *aux;
  115. struct drm_connector **connector;
  116. struct dp_catalog *catalog;
  117. struct dp_parser *parser;
  118. struct dp_ctrl *ctrl;
  119. struct dp_pll *pll;
  120. };
  121. /**
  122. * dp_debug_get() - configure and get the DisplayPlot debug module data
  123. *
  124. * @in: input structure containing data to initialize the debug module
  125. * return: pointer to allocated debug module data
  126. *
  127. * This function sets up the debug module and provides a way
  128. * for debugfs input to be communicated with existing modules
  129. */
  130. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  131. /**
  132. * dp_debug_put()
  133. *
  134. * Cleans up dp_debug instance
  135. *
  136. * @dp_debug: instance of dp_debug
  137. */
  138. void dp_debug_put(struct dp_debug *dp_debug);
  139. #endif /* _DP_DEBUG_H_ */