dp_debug.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 (unlikely(drm_debug & 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 (unlikely(drm_debug & 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. /**
  38. * struct dp_debug
  39. * @debug_en: specifies whether debug mode enabled
  40. * @sim_mode: specifies whether sim mode enabled
  41. * @psm_enabled: specifies whether psm enabled
  42. * @hdcp_disabled: specifies if hdcp is disabled
  43. * @hdcp_wait_sink_sync: used to wait for sink synchronization before HDCP auth
  44. * @aspect_ratio: used to filter out aspect_ratio value
  45. * @vdisplay: used to filter out vdisplay value
  46. * @hdisplay: used to filter out hdisplay value
  47. * @vrefresh: used to filter out vrefresh value
  48. * @tpg_state: specifies whether tpg feature is enabled
  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. * @dp_mst_connector_list: list containing all dp mst connectors
  54. * @mst_hpd_sim: specifies whether simulated hpd enabled
  55. * @mst_sim_add_con: specifies whether new sim connector is to be added
  56. * @mst_sim_remove_con: specifies whether sim connector is to be removed
  57. * @mst_sim_remove_con_id: specifies id of sim connector to be removed
  58. * @mst_port_cnt: number of mst ports to be added during hpd
  59. */
  60. struct dp_debug {
  61. bool debug_en;
  62. bool sim_mode;
  63. bool psm_enabled;
  64. bool hdcp_disabled;
  65. bool hdcp_wait_sink_sync;
  66. int aspect_ratio;
  67. int vdisplay;
  68. int hdisplay;
  69. int vrefresh;
  70. bool tpg_state;
  71. u32 max_pclk_khz;
  72. bool force_encryption;
  73. bool skip_uevent;
  74. char hdcp_status[SZ_128];
  75. struct dp_mst_connector dp_mst_connector_list;
  76. bool mst_hpd_sim;
  77. bool mst_sim_add_con;
  78. bool mst_sim_remove_con;
  79. int mst_sim_remove_con_id;
  80. u32 mst_port_cnt;
  81. u8 *(*get_edid)(struct dp_debug *dp_debug);
  82. void (*abort)(struct dp_debug *dp_debug);
  83. };
  84. /**
  85. * struct dp_debug_in
  86. * @dev: device instance of the caller
  87. * @panel: instance of panel module
  88. * @hpd: instance of hpd module
  89. * @link: instance of link module
  90. * @aux: instance of aux module
  91. * @connector: double pointer to display connector
  92. * @catalog: instance of catalog module
  93. * @parser: instance of parser module
  94. * @ctrl: instance of controller module
  95. * @pll: instance of pll module
  96. */
  97. struct dp_debug_in {
  98. struct device *dev;
  99. struct dp_panel *panel;
  100. struct dp_hpd *hpd;
  101. struct dp_link *link;
  102. struct dp_aux *aux;
  103. struct drm_connector **connector;
  104. struct dp_catalog *catalog;
  105. struct dp_parser *parser;
  106. struct dp_ctrl *ctrl;
  107. struct dp_pll *pll;
  108. };
  109. /**
  110. * dp_debug_get() - configure and get the DisplayPlot debug module data
  111. *
  112. * @in: input structure containing data to initialize the debug module
  113. * return: pointer to allocated debug module data
  114. *
  115. * This function sets up the debug module and provides a way
  116. * for debugfs input to be communicated with existing modules
  117. */
  118. struct dp_debug *dp_debug_get(struct dp_debug_in *in);
  119. /**
  120. * dp_debug_put()
  121. *
  122. * Cleans up dp_debug instance
  123. *
  124. * @dp_debug: instance of dp_debug
  125. */
  126. void dp_debug_put(struct dp_debug *dp_debug);
  127. #endif /* _DP_DEBUG_H_ */