2 * Copyright 2012-14 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
30 #include "grph_object_defs.h"
32 struct dc_link_status {
33 struct dpcd_caps *dpcd_caps;
36 /* DP MST stream allocation (payload bandwidth number) */
37 struct link_mst_stream_allocation {
39 const struct stream_encoder *stream_enc;
40 /* associate DRM payload table with DC stream encoder */
42 /* number of slots required for the DP stream in transport packet */
46 /* DP MST stream allocation table */
47 struct link_mst_stream_allocation_table {
48 /* number of DP video streams */
50 /* array of stream allocations */
51 struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
55 uint64_t edp_poweroff;
60 struct time_stamp time_stamp;
63 * A link contains one or more sinks and their connected status.
64 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
67 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
68 unsigned int sink_count;
69 struct dc_sink *local_sink;
70 unsigned int link_index;
71 enum dc_connection_type type;
72 enum signal_type connector_signal;
73 enum dc_irq_source irq_source_hpd;
74 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
75 bool is_hpd_filter_disabled;
77 /* caps is the same as reported_link_cap. link_traing use
78 * reported_link_cap. Will clean up. TODO
80 struct dc_link_settings reported_link_cap;
81 struct dc_link_settings verified_link_cap;
82 struct dc_link_settings cur_link_settings;
83 struct dc_lane_settings cur_lane_setting;
84 struct dc_link_settings preferred_link_setting;
90 uint8_t link_enc_hw_inst;
92 bool test_pattern_enabled;
93 union compliance_test_state compliance_test_state;
97 struct ddc_service *ddc;
101 /* Private to DC core */
105 struct dc_context *ctx;
107 struct link_encoder *link_enc;
108 struct graphics_object_id link_id;
109 union ddi_channel_mapping ddi_channel_mapping;
110 struct connector_device_tag_info device_tag;
111 struct dpcd_caps dpcd_caps;
112 unsigned short chip_caps;
113 unsigned int dpcd_sink_count;
114 enum edp_revision edp_revision;
117 /* MST record stream using this link */
119 bool dp_keep_receiver_powered;
121 struct link_mst_stream_allocation_table mst_stream_alloc_table;
123 struct dc_link_status link_status;
125 struct link_trace link_trace;
128 const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
131 * Return an enumerated dc_link. dc_link order is constant and determined at
132 * boot time. They cannot be created or destroyed.
133 * Use dc_get_caps() to get number of links.
135 static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index)
137 return dc->links[link_index];
140 /* Set backlight level of an embedded panel (eDP, LVDS). */
141 bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
142 uint32_t frame_ramp, const struct dc_stream_state *stream);
144 bool dc_link_set_abm_disable(const struct dc_link *dc_link);
146 bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable, bool wait);
148 bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state);
150 bool dc_link_setup_psr(struct dc_link *dc_link,
151 const struct dc_stream_state *stream, struct psr_config *psr_config,
152 struct psr_context *psr_context);
154 /* Request DC to detect if there is a Panel connected.
155 * boot - If this call is during initial boot.
156 * Return false for any type of detection failure or MST detection
157 * true otherwise. True meaning further action is required (status update
158 * and OS notification).
160 enum dc_detect_reason {
166 bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason);
168 /* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
170 * true - Downstream port status changed. DM should call DC to do the
172 * false - no change in Downstream port status. No further action required
174 bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
175 union hpd_irq_data *hpd_irq_dpcd_data);
177 struct dc_sink_init_data;
179 struct dc_sink *dc_link_add_remote_sink(
180 struct dc_link *dc_link,
183 struct dc_sink_init_data *init_data);
185 void dc_link_remove_remote_sink(
186 struct dc_link *link,
187 struct dc_sink *sink);
189 /* Used by diagnostics for virtual link at the moment */
191 void dc_link_dp_set_drive_settings(
192 struct dc_link *link,
193 struct link_training_settings *lt_settings);
195 enum link_training_result dc_link_dp_perform_link_training(
196 struct dc_link *link,
197 const struct dc_link_settings *link_setting,
198 bool skip_video_pattern);
200 void dc_link_dp_enable_hpd(const struct dc_link *link);
202 void dc_link_dp_disable_hpd(const struct dc_link *link);
204 bool dc_link_dp_set_test_pattern(
205 struct dc_link *link,
206 enum dp_test_pattern test_pattern,
207 const struct link_training_settings *p_link_settings,
208 const unsigned char *p_custom_pattern,
209 unsigned int cust_pattern_size);
211 void dc_link_enable_hpd_filter(struct dc_link *link, bool enable);
214 * DPCD access interfaces
220 struct i2c_command *cmd);
222 #endif /* DC_LINK_H_ */