1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
11 #define DS_PORT_STATUS_CHANGED 0x200
12 #define DP_TEST_BIT_DEPTH_UNKNOWN 0xFFFFFFFF
13 #define DP_LINK_CAP_ENHANCED_FRAMING (1 << 0)
16 unsigned char revision;
18 unsigned int num_lanes;
19 unsigned long capabilities;
22 enum dp_link_voltage_level {
23 DP_TRAIN_VOLTAGE_SWING_LVL_0 = 0,
24 DP_TRAIN_VOLTAGE_SWING_LVL_1 = 1,
25 DP_TRAIN_VOLTAGE_SWING_LVL_2 = 2,
26 DP_TRAIN_VOLTAGE_SWING_MAX = DP_TRAIN_VOLTAGE_SWING_LVL_2,
29 enum dp_link_preemaphasis_level {
30 DP_TRAIN_PRE_EMPHASIS_LVL_0 = 0,
31 DP_TRAIN_PRE_EMPHASIS_LVL_1 = 1,
32 DP_TRAIN_PRE_EMPHASIS_LVL_2 = 2,
33 DP_TRAIN_PRE_EMPHASIS_MAX = DP_TRAIN_PRE_EMPHASIS_LVL_2,
36 struct dp_link_test_video {
37 u32 test_video_pattern;
54 struct dp_link_test_audio {
55 u32 test_audio_sampling_rate;
56 u32 test_audio_channel_count;
57 u32 test_audio_pattern_type;
58 u32 test_audio_period_ch_1;
59 u32 test_audio_period_ch_2;
60 u32 test_audio_period_ch_3;
61 u32 test_audio_period_ch_4;
62 u32 test_audio_period_ch_5;
63 u32 test_audio_period_ch_6;
64 u32 test_audio_period_ch_7;
65 u32 test_audio_period_ch_8;
68 struct dp_link_phy_params {
69 u32 phy_test_pattern_sel;
80 struct dp_link_test_video test_video;
81 struct dp_link_test_audio test_audio;
82 struct dp_link_phy_params phy_params;
83 struct dp_link_info link_params;
87 * mdss_dp_test_bit_depth_to_bpp() - convert test bit depth to bpp
88 * @tbd: test bit depth
90 * Returns the bits per pixel (bpp) to be used corresponding to the
91 * git bit depth value. This function assumes that bit depth has
92 * already been validated.
94 static inline u32 dp_link_bit_depth_to_bpp(u32 tbd)
97 * Few simplistic rules and assumptions made here:
98 * 1. Bit depth is per color component
99 * 2. If bit depth is unknown return 0
100 * 3. Assume 3 color components
103 case DP_TEST_BIT_DEPTH_6:
105 case DP_TEST_BIT_DEPTH_8:
107 case DP_TEST_BIT_DEPTH_10:
109 case DP_TEST_BIT_DEPTH_UNKNOWN:
116 * dp_test_bit_depth_to_bpc() - convert test bit depth to bpc
117 * @tbd: test bit depth
119 * Returns the bits per comp (bpc) to be used corresponding to the
120 * bit depth value. This function assumes that bit depth has
121 * already been validated.
123 static inline u32 dp_link_bit_depth_to_bpc(u32 tbd)
126 case DP_TEST_BIT_DEPTH_6:
128 case DP_TEST_BIT_DEPTH_8:
130 case DP_TEST_BIT_DEPTH_10:
132 case DP_TEST_BIT_DEPTH_UNKNOWN:
138 void dp_link_reset_phy_params_vx_px(struct dp_link *dp_link);
139 u32 dp_link_get_test_bits_depth(struct dp_link *dp_link, u32 bpp);
140 int dp_link_process_request(struct dp_link *dp_link);
141 int dp_link_get_colorimetry_config(struct dp_link *dp_link);
142 int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status);
143 bool dp_link_send_test_response(struct dp_link *dp_link);
144 int dp_link_psm_config(struct dp_link *dp_link,
145 struct dp_link_info *link_info, bool enable);
146 bool dp_link_send_edid_checksum(struct dp_link *dp_link, u8 checksum);
149 * dp_link_get() - get the functionalities of dp test module
152 * return: a pointer to dp_link struct
154 struct dp_link *dp_link_get(struct device *dev, struct drm_dp_aux *aux);
156 #endif /* _DP_LINK_H_ */