dp_link.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _DP_LINK_H_
  6. #define _DP_LINK_H_
  7. #include "dp_aux.h"
  8. #define DS_PORT_STATUS_CHANGED 0x200
  9. #define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF
  10. #define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
  11. struct dp_link_info {
  12. unsigned char revision;
  13. unsigned int rate;
  14. unsigned int num_lanes;
  15. unsigned long capabilities;
  16. };
  17. #define DP_TRAIN_LEVEL_MAX 3
  18. struct dp_link_test_video {
  19. u32 test_video_pattern;
  20. u32 test_bit_depth;
  21. u32 test_dyn_range;
  22. u32 test_h_total;
  23. u32 test_v_total;
  24. u32 test_h_start;
  25. u32 test_v_start;
  26. u32 test_hsync_pol;
  27. u32 test_hsync_width;
  28. u32 test_vsync_pol;
  29. u32 test_vsync_width;
  30. u32 test_h_width;
  31. u32 test_v_height;
  32. u32 test_rr_d;
  33. u32 test_rr_n;
  34. };
  35. struct dp_link_test_audio {
  36. u32 test_audio_sampling_rate;
  37. u32 test_audio_channel_count;
  38. u32 test_audio_pattern_type;
  39. u32 test_audio_period_ch_1;
  40. u32 test_audio_period_ch_2;
  41. u32 test_audio_period_ch_3;
  42. u32 test_audio_period_ch_4;
  43. u32 test_audio_period_ch_5;
  44. u32 test_audio_period_ch_6;
  45. u32 test_audio_period_ch_7;
  46. u32 test_audio_period_ch_8;
  47. };
  48. struct dp_link_phy_params {
  49. u32 phy_test_pattern_sel;
  50. u8 v_level;
  51. u8 p_level;
  52. };
  53. struct dp_link {
  54. u32 sink_request;
  55. u32 test_response;
  56. u8 sink_count;
  57. struct dp_link_test_video test_video;
  58. struct dp_link_test_audio test_audio;
  59. struct dp_link_phy_params phy_params;
  60. struct dp_link_info link_params;
  61. };
  62. /**
  63. * mdss_dp_test_bit_depth_to_bpp() - convert test bit depth to bpp
  64. * @tbd: test bit depth
  65. *
  66. * Returns the bits per pixel (bpp) to be used corresponding to the
  67. * git bit depth value. This function assumes that bit depth has
  68. * already been validated.
  69. */
  70. static inline u32 dp_link_bit_depth_to_bpp(u32 tbd)
  71. {
  72. /*
  73. * Few simplistic rules and assumptions made here:
  74. * 1. Bit depth is per color component
  75. * 2. If bit depth is unknown return 0
  76. * 3. Assume 3 color components
  77. */
  78. switch (tbd) {
  79. case DP_TEST_BIT_DEPTH_6:
  80. return 18;
  81. case DP_TEST_BIT_DEPTH_8:
  82. return 24;
  83. case DP_TEST_BIT_DEPTH_10:
  84. return 30;
  85. case DP_TEST_BIT_DEPTH_UNKNOWN:
  86. default:
  87. return 0;
  88. }
  89. }
  90. void dp_link_reset_phy_params_vx_px(struct dp_link *dp_link);
  91. u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp);
  92. int dp_link_process_request(struct dp_link *dp_link);
  93. int dp_link_get_colorimetry_config(struct dp_link *dp_link);
  94. int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status);
  95. bool dp_link_send_test_response(struct dp_link *dp_link);
  96. int dp_link_psm_config(struct dp_link *dp_link,
  97. struct dp_link_info *link_info, bool enable);
  98. bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum);
  99. /**
  100. * dp_link_get() - get the functionalities of dp test module
  101. *
  102. *
  103. * return: a pointer to dp_link struct
  104. */
  105. struct dp_link *dp_link_get(struct device *dev, struct drm_dp_aux *aux);
  106. #endif /* _DP_LINK_H_ */