dp_debug.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2021, 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. * @sim_mode: specifies whether sim mode enabled
  44. * @psm_enabled: specifies whether psm enabled
  45. * @hdcp_disabled: specifies if hdcp is disabled
  46. * @hdcp_wait_sink_sync: used to wait for sink synchronization before HDCP auth
  47. * @tpg_state: specifies whether tpg feature is enabled
  48. * @max_pclk_khz: max pclk supported
  49. * @force_encryption: enable/disable forced encryption for HDCP 2.2
  50. * @skip_uevent: skip hotplug uevent to the user space
  51. * @hdcp_status: string holding hdcp status information
  52. * @mst_sim_add_con: specifies whether new sim connector is to be added
  53. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  54. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  55. * @connect_notification_delay_ms: time (in ms) to wait for any attention
  56. * messages before sending the connect notification uevent
  57. * @disconnect_delay_ms: time (in ms) to wait before turning off the mainlink
  58. * in response to HPD low of cable disconnect event
  59. */
  60. struct dp_debug {
  61. bool sim_mode;
  62. bool psm_enabled;
  63. bool hdcp_disabled;
  64. bool hdcp_wait_sink_sync;
  65. bool tpg_state;
  66. u32 max_pclk_khz;
  67. bool force_encryption;
  68. bool skip_uevent;
  69. char hdcp_status[SZ_128];
  70. bool mst_sim_add_con;
  71. bool mst_sim_remove_con;
  72. int mst_sim_remove_con_id;
  73. unsigned long connect_notification_delay_ms;
  74. u32 disconnect_delay_ms;
  75. void (*abort)(struct dp_debug *dp_debug);
  76. void (*set_mst_con)(struct dp_debug *dp_debug, int con_id);
  77. };
  78. /**
  79. * struct dp_debug_in
  80. * @dev: device instance of the caller
  81. * @panel: instance of panel module
  82. * @hpd: instance of hpd module
  83. * @link: instance of link module
  84. * @aux: instance of aux module
  85. * @connector: double pointer to display connector
  86. * @catalog: instance of catalog module
  87. * @parser: instance of parser module
  88. * @ctrl: instance of controller module
  89. * @pll: instance of pll module
  90. * @display: instance of display module
  91. */
  92. struct dp_debug_in {
  93. struct device *dev;
  94. struct dp_panel *panel;
  95. struct dp_hpd *hpd;
  96. struct dp_link *link;
  97. struct dp_aux *aux;
  98. struct drm_connector **connector;
  99. struct dp_catalog *catalog;
  100. struct dp_parser *parser;
  101. struct dp_ctrl *ctrl;
  102. struct dp_pll *pll;
  103. struct dp_display *display;
  104. };
  105. /**
  106. * dp_debug_get() - configure and get the DisplayPlot debug module data
  107. *
  108. * @in: input structure containing data to initialize the debug module
  109. * return: pointer to allocated debug module data
  110. *
  111. * This function sets up the debug module and provides a way
  112. * for debugfs input to be communicated with existing modules
  113. */
  114. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  115. /**
  116. * dp_debug_put()
  117. *
  118. * Cleans up dp_debug instance
  119. *
  120. * @dp_debug: instance of dp_debug
  121. */
  122. void dp_debug_put(struct dp_debug *dp_debug);
  123. #endif /* _DP_DEBUG_H_ */