1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2012-15 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  * Authors: AMD
23*b843c749SSergey Zigachev  *
24*b843c749SSergey Zigachev  */
25*b843c749SSergey Zigachev 
26*b843c749SSergey Zigachev #ifndef __DAL_LINK_SERVICE_TYPES_H__
27*b843c749SSergey Zigachev #define __DAL_LINK_SERVICE_TYPES_H__
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #include "grph_object_id.h"
30*b843c749SSergey Zigachev #include "dal_types.h"
31*b843c749SSergey Zigachev #include "irq_types.h"
32*b843c749SSergey Zigachev 
33*b843c749SSergey Zigachev /*struct mst_mgr_callback_object;*/
34*b843c749SSergey Zigachev struct ddc;
35*b843c749SSergey Zigachev struct irq_manager;
36*b843c749SSergey Zigachev 
37*b843c749SSergey Zigachev enum {
38*b843c749SSergey Zigachev 	MAX_CONTROLLER_NUM = 6
39*b843c749SSergey Zigachev };
40*b843c749SSergey Zigachev 
41*b843c749SSergey Zigachev enum dp_power_state {
42*b843c749SSergey Zigachev 	DP_POWER_STATE_D0 = 1,
43*b843c749SSergey Zigachev 	DP_POWER_STATE_D3
44*b843c749SSergey Zigachev };
45*b843c749SSergey Zigachev 
46*b843c749SSergey Zigachev enum edp_revision {
47*b843c749SSergey Zigachev 	/* eDP version 1.1 or lower */
48*b843c749SSergey Zigachev 	EDP_REVISION_11 = 0x00,
49*b843c749SSergey Zigachev 	/* eDP version 1.2 */
50*b843c749SSergey Zigachev 	EDP_REVISION_12 = 0x01,
51*b843c749SSergey Zigachev 	/* eDP version 1.3 */
52*b843c749SSergey Zigachev 	EDP_REVISION_13 = 0x02
53*b843c749SSergey Zigachev };
54*b843c749SSergey Zigachev 
55*b843c749SSergey Zigachev enum {
56*b843c749SSergey Zigachev 	LINK_RATE_REF_FREQ_IN_KHZ = 27000 /*27MHz*/
57*b843c749SSergey Zigachev };
58*b843c749SSergey Zigachev 
59*b843c749SSergey Zigachev enum link_training_result {
60*b843c749SSergey Zigachev 	LINK_TRAINING_SUCCESS,
61*b843c749SSergey Zigachev 	LINK_TRAINING_CR_FAIL_LANE0,
62*b843c749SSergey Zigachev 	LINK_TRAINING_CR_FAIL_LANE1,
63*b843c749SSergey Zigachev 	LINK_TRAINING_CR_FAIL_LANE23,
64*b843c749SSergey Zigachev 	/* CR DONE bit is cleared during EQ step */
65*b843c749SSergey Zigachev 	LINK_TRAINING_EQ_FAIL_CR,
66*b843c749SSergey Zigachev 	/* other failure during EQ step */
67*b843c749SSergey Zigachev 	LINK_TRAINING_EQ_FAIL_EQ,
68*b843c749SSergey Zigachev 	LINK_TRAINING_LQA_FAIL,
69*b843c749SSergey Zigachev };
70*b843c749SSergey Zigachev 
71*b843c749SSergey Zigachev struct link_training_settings {
72*b843c749SSergey Zigachev 	struct dc_link_settings link_settings;
73*b843c749SSergey Zigachev 	struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX];
74*b843c749SSergey Zigachev 	bool allow_invalid_msa_timing_param;
75*b843c749SSergey Zigachev };
76*b843c749SSergey Zigachev 
77*b843c749SSergey Zigachev enum hw_dp_training_pattern {
78*b843c749SSergey Zigachev 	HW_DP_TRAINING_PATTERN_1 = 0,
79*b843c749SSergey Zigachev 	HW_DP_TRAINING_PATTERN_2,
80*b843c749SSergey Zigachev 	HW_DP_TRAINING_PATTERN_3,
81*b843c749SSergey Zigachev 	HW_DP_TRAINING_PATTERN_4
82*b843c749SSergey Zigachev };
83*b843c749SSergey Zigachev 
84*b843c749SSergey Zigachev /*TODO: Move this enum test harness*/
85*b843c749SSergey Zigachev /* Test patterns*/
86*b843c749SSergey Zigachev enum dp_test_pattern {
87*b843c749SSergey Zigachev 	/* Input data is pass through Scrambler
88*b843c749SSergey Zigachev 	 * and 8b10b Encoder straight to output*/
89*b843c749SSergey Zigachev 	DP_TEST_PATTERN_VIDEO_MODE = 0,
90*b843c749SSergey Zigachev 
91*b843c749SSergey Zigachev 	/* phy test patterns*/
92*b843c749SSergey Zigachev 	DP_TEST_PATTERN_PHY_PATTERN_BEGIN,
93*b843c749SSergey Zigachev 	DP_TEST_PATTERN_D102 = DP_TEST_PATTERN_PHY_PATTERN_BEGIN,
94*b843c749SSergey Zigachev 	DP_TEST_PATTERN_SYMBOL_ERROR,
95*b843c749SSergey Zigachev 	DP_TEST_PATTERN_PRBS7,
96*b843c749SSergey Zigachev 	DP_TEST_PATTERN_80BIT_CUSTOM,
97*b843c749SSergey Zigachev 	DP_TEST_PATTERN_CP2520_1,
98*b843c749SSergey Zigachev 	DP_TEST_PATTERN_CP2520_2,
99*b843c749SSergey Zigachev 	DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE = DP_TEST_PATTERN_CP2520_2,
100*b843c749SSergey Zigachev 	DP_TEST_PATTERN_CP2520_3,
101*b843c749SSergey Zigachev 
102*b843c749SSergey Zigachev 	/* Link Training Patterns */
103*b843c749SSergey Zigachev 	DP_TEST_PATTERN_TRAINING_PATTERN1,
104*b843c749SSergey Zigachev 	DP_TEST_PATTERN_TRAINING_PATTERN2,
105*b843c749SSergey Zigachev 	DP_TEST_PATTERN_TRAINING_PATTERN3,
106*b843c749SSergey Zigachev 	DP_TEST_PATTERN_TRAINING_PATTERN4,
107*b843c749SSergey Zigachev 	DP_TEST_PATTERN_PHY_PATTERN_END = DP_TEST_PATTERN_TRAINING_PATTERN4,
108*b843c749SSergey Zigachev 
109*b843c749SSergey Zigachev 	/* link test patterns*/
110*b843c749SSergey Zigachev 	DP_TEST_PATTERN_COLOR_SQUARES,
111*b843c749SSergey Zigachev 	DP_TEST_PATTERN_COLOR_SQUARES_CEA,
112*b843c749SSergey Zigachev 	DP_TEST_PATTERN_VERTICAL_BARS,
113*b843c749SSergey Zigachev 	DP_TEST_PATTERN_HORIZONTAL_BARS,
114*b843c749SSergey Zigachev 	DP_TEST_PATTERN_COLOR_RAMP,
115*b843c749SSergey Zigachev 
116*b843c749SSergey Zigachev 	/* audio test patterns*/
117*b843c749SSergey Zigachev 	DP_TEST_PATTERN_AUDIO_OPERATOR_DEFINED,
118*b843c749SSergey Zigachev 	DP_TEST_PATTERN_AUDIO_SAWTOOTH,
119*b843c749SSergey Zigachev 
120*b843c749SSergey Zigachev 	DP_TEST_PATTERN_UNSUPPORTED
121*b843c749SSergey Zigachev };
122*b843c749SSergey Zigachev 
123*b843c749SSergey Zigachev enum dp_panel_mode {
124*b843c749SSergey Zigachev 	/* not required */
125*b843c749SSergey Zigachev 	DP_PANEL_MODE_DEFAULT,
126*b843c749SSergey Zigachev 	/* standard mode for eDP */
127*b843c749SSergey Zigachev 	DP_PANEL_MODE_EDP,
128*b843c749SSergey Zigachev 	/* external chips specific settings */
129*b843c749SSergey Zigachev 	DP_PANEL_MODE_SPECIAL
130*b843c749SSergey Zigachev };
131*b843c749SSergey Zigachev 
132*b843c749SSergey Zigachev /* DPCD_ADDR_TRAINING_LANEx_SET registers value */
133*b843c749SSergey Zigachev union dpcd_training_lane_set {
134*b843c749SSergey Zigachev 	struct {
135*b843c749SSergey Zigachev #if defined(LITTLEENDIAN_CPU)
136*b843c749SSergey Zigachev 		uint8_t VOLTAGE_SWING_SET:2;
137*b843c749SSergey Zigachev 		uint8_t MAX_SWING_REACHED:1;
138*b843c749SSergey Zigachev 		uint8_t PRE_EMPHASIS_SET:2;
139*b843c749SSergey Zigachev 		uint8_t MAX_PRE_EMPHASIS_REACHED:1;
140*b843c749SSergey Zigachev 		/* following is reserved in DP 1.1 */
141*b843c749SSergey Zigachev 		uint8_t POST_CURSOR2_SET:2;
142*b843c749SSergey Zigachev #elif defined(BIGENDIAN_CPU)
143*b843c749SSergey Zigachev 		uint8_t POST_CURSOR2_SET:2;
144*b843c749SSergey Zigachev 		uint8_t MAX_PRE_EMPHASIS_REACHED:1;
145*b843c749SSergey Zigachev 		uint8_t PRE_EMPHASIS_SET:2;
146*b843c749SSergey Zigachev 		uint8_t MAX_SWING_REACHED:1;
147*b843c749SSergey Zigachev 		uint8_t VOLTAGE_SWING_SET:2;
148*b843c749SSergey Zigachev #else
149*b843c749SSergey Zigachev 	#error ARCH not defined!
150*b843c749SSergey Zigachev #endif
151*b843c749SSergey Zigachev 	} bits;
152*b843c749SSergey Zigachev 
153*b843c749SSergey Zigachev 	uint8_t raw;
154*b843c749SSergey Zigachev };
155*b843c749SSergey Zigachev 
156*b843c749SSergey Zigachev 
157*b843c749SSergey Zigachev /* DP MST stream allocation (payload bandwidth number) */
158*b843c749SSergey Zigachev struct dp_mst_stream_allocation {
159*b843c749SSergey Zigachev 	uint8_t vcp_id;
160*b843c749SSergey Zigachev 	/* number of slots required for the DP stream in
161*b843c749SSergey Zigachev 	 * transport packet */
162*b843c749SSergey Zigachev 	uint8_t slot_count;
163*b843c749SSergey Zigachev };
164*b843c749SSergey Zigachev 
165*b843c749SSergey Zigachev /* DP MST stream allocation table */
166*b843c749SSergey Zigachev struct dp_mst_stream_allocation_table {
167*b843c749SSergey Zigachev 	/* number of DP video streams */
168*b843c749SSergey Zigachev 	int stream_count;
169*b843c749SSergey Zigachev 	/* array of stream allocations */
170*b843c749SSergey Zigachev 	struct dp_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
171*b843c749SSergey Zigachev };
172*b843c749SSergey Zigachev 
173*b843c749SSergey Zigachev #endif /*__DAL_LINK_SERVICE_TYPES_H__*/
174