Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.2-rc2 264 lines 8.1 kB view raw
1/* 2 * Copyright 2012-14 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 26#ifndef DC_LINK_H_ 27#define DC_LINK_H_ 28 29#include "dc_types.h" 30#include "grph_object_defs.h" 31 32struct dc_link_status { 33 bool link_active; 34 struct dpcd_caps *dpcd_caps; 35}; 36 37/* DP MST stream allocation (payload bandwidth number) */ 38struct link_mst_stream_allocation { 39 /* DIG front */ 40 const struct stream_encoder *stream_enc; 41 /* associate DRM payload table with DC stream encoder */ 42 uint8_t vcp_id; 43 /* number of slots required for the DP stream in transport packet */ 44 uint8_t slot_count; 45}; 46 47/* DP MST stream allocation table */ 48struct link_mst_stream_allocation_table { 49 /* number of DP video streams */ 50 int stream_count; 51 /* array of stream allocations */ 52 struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM]; 53}; 54 55struct time_stamp { 56 uint64_t edp_poweroff; 57 uint64_t edp_poweron; 58}; 59 60struct link_trace { 61 struct time_stamp time_stamp; 62}; 63/* 64 * A link contains one or more sinks and their connected status. 65 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported. 66 */ 67struct dc_link { 68 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK]; 69 unsigned int sink_count; 70 struct dc_sink *local_sink; 71 unsigned int link_index; 72 enum dc_connection_type type; 73 enum signal_type connector_signal; 74 enum dc_irq_source irq_source_hpd; 75 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */ 76 bool is_hpd_filter_disabled; 77 bool dp_ss_off; 78 79 /* caps is the same as reported_link_cap. link_traing use 80 * reported_link_cap. Will clean up. TODO 81 */ 82 struct dc_link_settings reported_link_cap; 83 struct dc_link_settings verified_link_cap; 84 struct dc_link_settings cur_link_settings; 85 struct dc_lane_settings cur_lane_setting; 86 struct dc_link_settings preferred_link_setting; 87 88 uint8_t ddc_hw_inst; 89 90 uint8_t hpd_src; 91 92 uint8_t link_enc_hw_inst; 93 94 bool test_pattern_enabled; 95 union compliance_test_state compliance_test_state; 96 97 void *priv; 98 99 struct ddc_service *ddc; 100 101 bool aux_mode; 102 103 /* Private to DC core */ 104 105 const struct dc *dc; 106 107 struct dc_context *ctx; 108 109 struct link_encoder *link_enc; 110 struct graphics_object_id link_id; 111 union ddi_channel_mapping ddi_channel_mapping; 112 struct connector_device_tag_info device_tag; 113 struct dpcd_caps dpcd_caps; 114 uint32_t dongle_max_pix_clk; 115 unsigned short chip_caps; 116 unsigned int dpcd_sink_count; 117 enum edp_revision edp_revision; 118 bool psr_enabled; 119 120 /* MST record stream using this link */ 121 struct link_flags { 122 bool dp_keep_receiver_powered; 123 bool dp_skip_DID2; 124 } wa_flags; 125 struct link_mst_stream_allocation_table mst_stream_alloc_table; 126 127 struct dc_link_status link_status; 128 129 struct link_trace link_trace; 130 struct gpio *hpd_gpio; 131}; 132 133const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link); 134 135/** 136 * dc_get_link_at_index() - Return an enumerated dc_link. 137 * 138 * dc_link order is constant and determined at 139 * boot time. They cannot be created or destroyed. 140 * Use dc_get_caps() to get number of links. 141 */ 142static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index) 143{ 144 return dc->links[link_index]; 145} 146 147/* Set backlight level of an embedded panel (eDP, LVDS). 148 * backlight_pwm_u16_16 is unsigned 32 bit with 16 bit integer 149 * and 16 bit fractional, where 1.0 is max backlight value. 150 */ 151bool dc_link_set_backlight_level(const struct dc_link *dc_link, 152 uint32_t backlight_pwm_u16_16, 153 uint32_t frame_ramp); 154 155int dc_link_get_backlight_level(const struct dc_link *dc_link); 156 157bool dc_link_set_abm_disable(const struct dc_link *dc_link); 158 159bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable, bool wait); 160 161bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state); 162 163bool dc_link_setup_psr(struct dc_link *dc_link, 164 const struct dc_stream_state *stream, struct psr_config *psr_config, 165 struct psr_context *psr_context); 166 167/* Request DC to detect if there is a Panel connected. 168 * boot - If this call is during initial boot. 169 * Return false for any type of detection failure or MST detection 170 * true otherwise. True meaning further action is required (status update 171 * and OS notification). 172 */ 173enum dc_detect_reason { 174 DETECT_REASON_BOOT, 175 DETECT_REASON_HPD, 176 DETECT_REASON_HPDRX, 177}; 178 179bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason); 180bool dc_link_get_hpd_state(struct dc_link *dc_link); 181 182/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt). 183 * Return: 184 * true - Downstream port status changed. DM should call DC to do the 185 * detection. 186 * false - no change in Downstream port status. No further action required 187 * from DM. */ 188bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link, 189 union hpd_irq_data *hpd_irq_dpcd_data, bool *out_link_loss); 190 191struct dc_sink_init_data; 192 193struct dc_sink *dc_link_add_remote_sink( 194 struct dc_link *dc_link, 195 const uint8_t *edid, 196 int len, 197 struct dc_sink_init_data *init_data); 198 199void dc_link_remove_remote_sink( 200 struct dc_link *link, 201 struct dc_sink *sink); 202 203/* Used by diagnostics for virtual link at the moment */ 204 205void dc_link_dp_set_drive_settings( 206 struct dc_link *link, 207 struct link_training_settings *lt_settings); 208 209enum link_training_result dc_link_dp_perform_link_training( 210 struct dc_link *link, 211 const struct dc_link_settings *link_setting, 212 bool skip_video_pattern); 213 214void dc_link_dp_enable_hpd(const struct dc_link *link); 215 216void dc_link_dp_disable_hpd(const struct dc_link *link); 217 218bool dc_link_dp_set_test_pattern( 219 struct dc_link *link, 220 enum dp_test_pattern test_pattern, 221 const struct link_training_settings *p_link_settings, 222 const unsigned char *p_custom_pattern, 223 unsigned int cust_pattern_size); 224 225void dc_link_enable_hpd_filter(struct dc_link *link, bool enable); 226 227bool dc_link_is_dp_sink_present(struct dc_link *link); 228 229bool dc_link_detect_sink(struct dc_link *link, enum dc_connection_type *type); 230/* 231 * DPCD access interfaces 232 */ 233 234void dc_link_set_drive_settings(struct dc *dc, 235 struct link_training_settings *lt_settings, 236 const struct dc_link *link); 237void dc_link_perform_link_training(struct dc *dc, 238 struct dc_link_settings *link_setting, 239 bool skip_video_pattern); 240void dc_link_set_preferred_link_settings(struct dc *dc, 241 struct dc_link_settings *link_setting, 242 struct dc_link *link); 243void dc_link_enable_hpd(const struct dc_link *link); 244void dc_link_disable_hpd(const struct dc_link *link); 245void dc_link_set_test_pattern(struct dc_link *link, 246 enum dp_test_pattern test_pattern, 247 const struct link_training_settings *p_link_settings, 248 const unsigned char *p_custom_pattern, 249 unsigned int cust_pattern_size); 250uint32_t dc_link_bandwidth_kbps( 251 const struct dc_link *link, 252 const struct dc_link_settings *link_setting); 253 254const struct dc_link_settings *dc_link_get_link_cap( 255 const struct dc_link *link); 256 257bool dc_submit_i2c( 258 struct dc *dc, 259 uint32_t link_index, 260 struct i2c_command *cmd); 261 262uint32_t dc_bandwidth_in_kbps_from_timing( 263 const struct dc_crtc_timing *timing); 264#endif /* DC_LINK_H_ */