1 /*
2  * Copyright 2012-15 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 #ifndef __DAL_DDC_SERVICE_TYPES_H__
26 #define __DAL_DDC_SERVICE_TYPES_H__
27 
28 /* 0010FA dongles (ST Micro) external converter chip id */
29 #define DP_BRANCH_DEVICE_ID_0010FA 0x0010FA
30 /* 0022B9 external converter chip id */
31 #define DP_BRANCH_DEVICE_ID_0022B9 0x0022B9
32 #define DP_BRANCH_DEVICE_ID_00001A 0x00001A
33 #define DP_BRANCH_DEVICE_ID_0080E1 0x0080e1
34 #define DP_BRANCH_DEVICE_ID_90CC24 0x90CC24
35 #define DP_BRANCH_DEVICE_ID_00E04C 0x00E04C
36 #define DP_BRANCH_DEVICE_ID_006037 0x006037
37 #define DP_BRANCH_DEVICE_ID_001CF8 0x001CF8
38 #define DP_BRANCH_DEVICE_ID_0060AD 0x0060AD
39 #define DP_BRANCH_HW_REV_10 0x10
40 #define DP_BRANCH_HW_REV_20 0x20
41 
42 #define DP_DEVICE_ID_38EC11 0x38EC11
43 #define DP_FORCE_PSRSU_CAPABILITY 0x40F
44 
45 #define DP_SINK_PSR_ACTIVE_VTOTAL		0x373
46 #define DP_SINK_PSR_ACTIVE_VTOTAL_CONTROL_MODE	0x375
47 #define DP_SOURCE_PSR_ACTIVE_VTOTAL		0x376
48 
49 enum ddc_result {
50 	DDC_RESULT_UNKNOWN = 0,
51 	DDC_RESULT_SUCESSFULL,
52 	DDC_RESULT_FAILED_CHANNEL_BUSY,
53 	DDC_RESULT_FAILED_TIMEOUT,
54 	DDC_RESULT_FAILED_PROTOCOL_ERROR,
55 	DDC_RESULT_FAILED_NACK,
56 	DDC_RESULT_FAILED_INCOMPLETE,
57 	DDC_RESULT_FAILED_OPERATION,
58 	DDC_RESULT_FAILED_INVALID_OPERATION,
59 	DDC_RESULT_FAILED_BUFFER_OVERFLOW,
60 	DDC_RESULT_FAILED_HPD_DISCON
61 };
62 
63 enum ddc_service_type {
64 	DDC_SERVICE_TYPE_CONNECTOR,
65 	DDC_SERVICE_TYPE_DISPLAY_PORT_MST,
66 };
67 
68 /**
69  * display sink capability
70  */
71 struct display_sink_capability {
72 	/* dongle type (DP converter, CV smart dongle) */
73 	enum display_dongle_type dongle_type;
74 	bool is_dongle_type_one;
75 
76 	/**********************************************************
77 	 capabilities going INTO SINK DEVICE (stream capabilities)
78 	 **********************************************************/
79 	/* Dongle's downstream count. */
80 	uint32_t downstrm_sink_count;
81 	/* Is dongle's downstream count info field (downstrm_sink_count)
82 	 * valid. */
83 	bool downstrm_sink_count_valid;
84 
85 	/* Maximum additional audio delay in microsecond (us) */
86 	uint32_t additional_audio_delay;
87 	/* Audio latency value in microsecond (us) */
88 	uint32_t audio_latency;
89 	/* Interlace video latency value in microsecond (us) */
90 	uint32_t video_latency_interlace;
91 	/* Progressive video latency value in microsecond (us) */
92 	uint32_t video_latency_progressive;
93 	/* Dongle caps: Maximum pixel clock supported over dongle for HDMI */
94 	uint32_t max_hdmi_pixel_clock;
95 	/* Dongle caps: Maximum deep color supported over dongle for HDMI */
96 	enum dc_color_depth max_hdmi_deep_color;
97 
98 	/************************************************************
99 	 capabilities going OUT OF SOURCE DEVICE (link capabilities)
100 	 ************************************************************/
101 	/* support for Spread Spectrum(SS) */
102 	bool ss_supported;
103 	/* DP link settings (laneCount, linkRate, Spread) */
104 	uint32_t dp_link_lane_count;
105 	uint32_t dp_link_rate;
106 	uint32_t dp_link_spead;
107 
108 	/* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
109 	indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
110 	bool is_dp_hdmi_s3d_converter;
111 	/* to check if we have queried the display capability
112 	 * for eDP panel already. */
113 	bool is_edp_sink_cap_valid;
114 
115 	enum ddc_transaction_type transaction_type;
116 	enum signal_type signal;
117 };
118 
119 struct av_sync_data {
120 	uint8_t av_granularity;/* DPCD 00023h */
121 	uint8_t aud_dec_lat1;/* DPCD 00024h */
122 	uint8_t aud_dec_lat2;/* DPCD 00025h */
123 	uint8_t aud_pp_lat1;/* DPCD 00026h */
124 	uint8_t aud_pp_lat2;/* DPCD 00027h */
125 	uint8_t vid_inter_lat;/* DPCD 00028h */
126 	uint8_t vid_prog_lat;/* DPCD 00029h */
127 	uint8_t aud_del_ins1;/* DPCD 0002Bh */
128 	uint8_t aud_del_ins2;/* DPCD 0002Ch */
129 	uint8_t aud_del_ins3;/* DPCD 0002Dh */
130 };
131 
132 static const uint8_t DP_SINK_DEVICE_STR_ID_1[] = {7, 1, 8, 7, 3};
133 static const uint8_t DP_SINK_DEVICE_STR_ID_2[] = {7, 1, 8, 7, 5};
134 
135 static const u8 DP_SINK_BRANCH_DEV_NAME_7580[] = "7580\x80u";
136 
137 /*Travis*/
138 static const uint8_t DP_VGA_LVDS_CONVERTER_ID_2[] = "sivarT";
139 /*Nutmeg*/
140 static const uint8_t DP_VGA_LVDS_CONVERTER_ID_3[] = "dnomlA";
141 
142 /*MST Dock*/
143 static const uint8_t SYNAPTICS_DEVICE_ID[] = "SYNA";
144 
145 #endif /* __DAL_DDC_SERVICE_TYPES_H__ */
146