dp_debug.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. #define DP_DEBUG(fmt, ...) \
  15. do { \
  16. if (drm_debug_enabled(DRM_UT_KMS)) \
  17. DRM_DEBUG("[msm-dp-debug][%-4d]"fmt, current->pid, \
  18. ##__VA_ARGS__); \
  19. else \
  20. pr_debug("[drm:%s][msm-dp-debug][%-4d]"fmt, __func__,\
  21. current->pid, ##__VA_ARGS__); \
  22. } while (0)
  23. #define DP_INFO(fmt, ...) \
  24. do { \
  25. if (drm_debug_enabled(DRM_UT_KMS)) \
  26. DRM_INFO("[msm-dp-info][%-4d]"fmt, current->pid, \
  27. ##__VA_ARGS__); \
  28. else \
  29. pr_info("[drm:%s][msm-dp-info][%-4d]"fmt, __func__, \
  30. current->pid, ##__VA_ARGS__); \
  31. } while (0)
  32. #define DP_WARN(fmt, ...) \
  33. pr_warn("[drm:%s][msm-dp-warn][%-4d]"fmt, __func__, \
  34. current->pid, ##__VA_ARGS__)
  35. #define DP_ERR(fmt, ...) \
  36. pr_err("[drm:%s][msm-dp-err][%-4d]"fmt, __func__, \
  37. current->pid, ##__VA_ARGS__)
  38. #define DEFAULT_DISCONNECT_DELAY_MS 0
  39. #define MAX_DISCONNECT_DELAY_MS 10000
  40. #define DEFAULT_CONNECT_NOTIFICATION_DELAY_MS 150
  41. #define MAX_CONNECT_NOTIFICATION_DELAY_MS 5000
  42. /**
  43. * struct dp_debug
  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. * @tpg_pattern: selects tpg pattern on the controller
  49. * @max_pclk_khz: max pclk supported
  50. * @force_encryption: enable/disable forced encryption for HDCP 2.2
  51. * @skip_uevent: skip hotplug uevent to the user space
  52. * @hdcp_status: string holding hdcp status information
  53. * @mst_sim_add_con: specifies whether new sim connector is to be added
  54. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  55. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  56. * @connect_notification_delay_ms: time (in ms) to wait for any attention
  57. * messages before sending the connect notification uevent
  58. * @disconnect_delay_ms: time (in ms) to wait before turning off the mainlink
  59. * in response to HPD low of cable disconnect event
  60. */
  61. struct dp_debug {
  62. bool sim_mode;
  63. bool psm_enabled;
  64. bool hdcp_disabled;
  65. bool hdcp_wait_sink_sync;
  66. u32 tpg_pattern;
  67. u32 max_pclk_khz;
  68. bool force_encryption;
  69. bool skip_uevent;
  70. char hdcp_status[SZ_128];
  71. bool mst_sim_add_con;
  72. bool mst_sim_remove_con;
  73. int mst_sim_remove_con_id;
  74. unsigned long connect_notification_delay_ms;
  75. u32 disconnect_delay_ms;
  76. void (*abort)(struct dp_debug *dp_debug);
  77. void (*set_mst_con)(struct dp_debug *dp_debug, int con_id);
  78. };
  79. /**
  80. * struct dp_debug_in
  81. * @dev: device instance of the caller
  82. * @panel: instance of panel module
  83. * @hpd: instance of hpd module
  84. * @link: instance of link module
  85. * @aux: instance of aux module
  86. * @connector: double pointer to display connector
  87. * @catalog: instance of catalog module
  88. * @parser: instance of parser module
  89. * @ctrl: instance of controller module
  90. * @pll: instance of pll module
  91. * @display: instance of display module
  92. */
  93. struct dp_debug_in {
  94. struct device *dev;
  95. struct dp_panel *panel;
  96. struct dp_hpd *hpd;
  97. struct dp_link *link;
  98. struct dp_aux *aux;
  99. struct drm_connector **connector;
  100. struct dp_catalog *catalog;
  101. struct dp_parser *parser;
  102. struct dp_ctrl *ctrl;
  103. struct dp_pll *pll;
  104. struct dp_display *display;
  105. };
  106. /**
  107. * dp_debug_get() - configure and get the DisplayPlot debug module data
  108. *
  109. * @in: input structure containing data to initialize the debug module
  110. * return: pointer to allocated debug module data
  111. *
  112. * This function sets up the debug module and provides a way
  113. * for debugfs input to be communicated with existing modules
  114. */
  115. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  116. /**
  117. * dp_debug_put()
  118. *
  119. * Cleans up dp_debug instance
  120. *
  121. * @dp_debug: instance of dp_debug
  122. */
  123. void dp_debug_put(struct dp_debug *dp_debug);
  124. #endif /* _DP_DEBUG_H_ */