dp_debug.h 5.6 KB

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