dp_debug.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022-2023, 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 DP_ERR_RATELIMITED_V(fmt, ...) \
  65. pr_err_ratelimited("[drm:%s][msm-dp-err][%-4d]"fmt, __func__, \
  66. current->pid, ##__VA_ARGS__)
  67. #define DEFAULT_DISCONNECT_DELAY_MS 0
  68. #define MAX_DISCONNECT_DELAY_MS 10000
  69. #define DEFAULT_CONNECT_NOTIFICATION_DELAY_MS 150
  70. #define MAX_CONNECT_NOTIFICATION_DELAY_MS 5000
  71. /**
  72. * struct dp_debug
  73. * @sim_mode: specifies whether sim mode enabled
  74. * @psm_enabled: specifies whether psm enabled
  75. * @hdcp_disabled: specifies if hdcp is disabled
  76. * @hdcp_wait_sink_sync: used to wait for sink synchronization before HDCP auth
  77. * @tpg_pattern: selects tpg pattern on the controller
  78. * @max_pclk_khz: max pclk supported
  79. * @force_encryption: enable/disable forced encryption for HDCP 2.2
  80. * @skip_uevent: skip hotplug uevent to the user space
  81. * @hdcp_status: string holding hdcp status information
  82. * @mst_sim_add_con: specifies whether new sim connector is to be added
  83. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  84. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  85. * @connect_notification_delay_ms: time (in ms) to wait for any attention
  86. * messages before sending the connect notification uevent
  87. * @disconnect_delay_ms: time (in ms) to wait before turning off the mainlink
  88. * in response to HPD low of cable disconnect event
  89. */
  90. struct dp_debug {
  91. bool sim_mode;
  92. bool psm_enabled;
  93. bool hdcp_disabled;
  94. bool hdcp_wait_sink_sync;
  95. u32 tpg_pattern;
  96. u32 max_pclk_khz;
  97. bool force_encryption;
  98. bool skip_uevent;
  99. char hdcp_status[SZ_128];
  100. bool mst_sim_add_con;
  101. bool mst_sim_remove_con;
  102. int mst_sim_remove_con_id;
  103. unsigned long connect_notification_delay_ms;
  104. u32 disconnect_delay_ms;
  105. void (*abort)(struct dp_debug *dp_debug);
  106. void (*set_mst_con)(struct dp_debug *dp_debug, int con_id);
  107. };
  108. /**
  109. * struct dp_debug_in
  110. * @dev: device instance of the caller
  111. * @panel: instance of panel module
  112. * @hpd: instance of hpd module
  113. * @link: instance of link module
  114. * @aux: instance of aux module
  115. * @connector: double pointer to display connector
  116. * @catalog: instance of catalog module
  117. * @parser: instance of parser module
  118. * @ctrl: instance of controller module
  119. * @pll: instance of pll module
  120. * @display: instance of display module
  121. */
  122. struct dp_debug_in {
  123. struct device *dev;
  124. struct dp_panel *panel;
  125. struct dp_hpd *hpd;
  126. struct dp_link *link;
  127. struct dp_aux *aux;
  128. struct drm_connector **connector;
  129. struct dp_catalog *catalog;
  130. struct dp_parser *parser;
  131. struct dp_ctrl *ctrl;
  132. struct dp_pll *pll;
  133. struct dp_display *display;
  134. };
  135. /**
  136. * dp_debug_get() - configure and get the DisplayPlot debug module data
  137. *
  138. * @in: input structure containing data to initialize the debug module
  139. * return: pointer to allocated debug module data
  140. *
  141. * This function sets up the debug module and provides a way
  142. * for debugfs input to be communicated with existing modules
  143. */
  144. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  145. /**
  146. * dp_debug_put()
  147. *
  148. * Cleans up dp_debug instance
  149. *
  150. * @dp_debug: instance of dp_debug
  151. */
  152. void dp_debug_put(struct dp_debug *dp_debug);
  153. #endif /* _DP_DEBUG_H_ */