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

drm/amd/display: move public dc link function implementation to dc_link_exports

[why]
Link is a subcomponent in dc. DM should be aware of dc link structure
as one of the abstracted objects maintained by dc. However it should
have no idea of the existence of a link component in dc dedicated to
maintain the states of dc link structure. As such we are moving link interfaces
out of dc_link.h and directly added to dc.h. We are grandually fading out
the explicit inclusion of dc_link header and eventually delete it.

On dc side, since link is a subcomponent behind dc interfaces, it is not
a good idea to implement dc interfaces in each individual subcomponent
of link which is already a subcomponent of dc. So we are decoupling it
by implementing a dc_link_exports in dc. This file will be a thin
translation layer that breaks the dependency so link is able to make
interface changes without breaking DM.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wenjing Liu and committed by
Alex Deucher
5ca38a18 9b0f51e8

+447 -274
+1 -1
drivers/gpu/drm/amd/display/dc/Makefile
··· 65 65 include $(AMD_DC) 66 66 67 67 DISPLAY_CORE = dc.o dc_stat.o dc_resource.o dc_hw_sequencer.o dc_sink.o \ 68 - dc_surface.o dc_debug.o dc_stream.o dc_link_enc_cfg.o 68 + dc_surface.o dc_debug.o dc_stream.o dc_link_enc_cfg.o dc_link_exports.o 69 69 70 70 DISPLAY_CORE += dc_vm_helper.o 71 71
+118 -100
drivers/gpu/drm/amd/display/dc/dc.h
··· 52 52 #define MAX_SURFACES 3 53 53 #define MAX_PLANES 6 54 54 #define MAX_STREAMS 6 55 - #define MAX_SINKS_PER_LINK 4 56 55 #define MIN_VIEWPORT_SIZE 12 57 56 #define MAX_NUM_EDP 2 58 57 ··· 1371 1372 void dc_retain_state(struct dc_state *context); 1372 1373 void dc_release_state(struct dc_state *context); 1373 1374 1374 - /* Link Interfaces */ 1375 + struct dc_plane_state *dc_get_surface_for_mpcc(struct dc *dc, 1376 + struct dc_stream_state *stream, 1377 + int mpcc_inst); 1375 1378 1376 - struct dpcd_caps { 1377 - union dpcd_rev dpcd_rev; 1378 - union max_lane_count max_ln_count; 1379 - union max_down_spread max_down_spread; 1380 - union dprx_feature dprx_feature; 1381 - 1382 - /* valid only for eDP v1.4 or higher*/ 1383 - uint8_t edp_supported_link_rates_count; 1384 - enum dc_link_rate edp_supported_link_rates[8]; 1385 - 1386 - /* dongle type (DP converter, CV smart dongle) */ 1387 - enum display_dongle_type dongle_type; 1388 - bool is_dongle_type_one; 1389 - /* branch device or sink device */ 1390 - bool is_branch_dev; 1391 - /* Dongle's downstream count. */ 1392 - union sink_count sink_count; 1393 - bool is_mst_capable; 1394 - /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 1395 - indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 1396 - struct dc_dongle_caps dongle_caps; 1397 - 1398 - uint32_t sink_dev_id; 1399 - int8_t sink_dev_id_str[6]; 1400 - int8_t sink_hw_revision; 1401 - int8_t sink_fw_revision[2]; 1402 - 1403 - uint32_t branch_dev_id; 1404 - int8_t branch_dev_name[6]; 1405 - int8_t branch_hw_revision; 1406 - int8_t branch_fw_revision[2]; 1407 - 1408 - bool allow_invalid_MSA_timing_param; 1409 - bool panel_mode_edp; 1410 - bool dpcd_display_control_capable; 1411 - bool ext_receiver_cap_field_present; 1412 - bool set_power_state_capable_edp; 1413 - bool dynamic_backlight_capable_edp; 1414 - union dpcd_fec_capability fec_cap; 1415 - struct dpcd_dsc_capabilities dsc_caps; 1416 - struct dc_lttpr_caps lttpr_caps; 1417 - struct adaptive_sync_caps adaptive_sync_caps; 1418 - struct dpcd_usb4_dp_tunneling_info usb4_dp_tun_info; 1419 - 1420 - union dp_128b_132b_supported_link_rates dp_128b_132b_supported_link_rates; 1421 - union dp_main_line_channel_coding_cap channel_coding_cap; 1422 - union dp_sink_video_fallback_formats fallback_formats; 1423 - union dp_fec_capability1 fec_cap1; 1424 - union dp_cable_id cable_id; 1425 - uint8_t edp_rev; 1426 - union edp_alpm_caps alpm_caps; 1427 - struct edp_psr_info psr_info; 1428 - }; 1429 - 1430 - union dpcd_sink_ext_caps { 1431 - struct { 1432 - /* 0 - Sink supports backlight adjust via PWM during SDR/HDR mode 1433 - * 1 - Sink supports backlight adjust via AUX during SDR/HDR mode. 1434 - */ 1435 - uint8_t sdr_aux_backlight_control : 1; 1436 - uint8_t hdr_aux_backlight_control : 1; 1437 - uint8_t reserved_1 : 2; 1438 - uint8_t oled : 1; 1439 - uint8_t reserved : 3; 1440 - } bits; 1441 - uint8_t raw; 1442 - }; 1443 - 1444 - #if defined(CONFIG_DRM_AMD_DC_HDCP) 1445 - union hdcp_rx_caps { 1446 - struct { 1447 - uint8_t version; 1448 - uint8_t reserved; 1449 - struct { 1450 - uint8_t repeater : 1; 1451 - uint8_t hdcp_capable : 1; 1452 - uint8_t reserved : 6; 1453 - } byte0; 1454 - } fields; 1455 - uint8_t raw[3]; 1456 - }; 1457 - 1458 - union hdcp_bcaps { 1459 - struct { 1460 - uint8_t HDCP_CAPABLE:1; 1461 - uint8_t REPEATER:1; 1462 - uint8_t RESERVED:6; 1463 - } bits; 1464 - uint8_t raw; 1465 - }; 1466 - 1467 - struct hdcp_caps { 1468 - union hdcp_rx_caps rx_caps; 1469 - union hdcp_bcaps bcaps; 1470 - }; 1471 - #endif 1472 - 1473 - #include "dc_link.h" 1474 1379 1475 1380 uint32_t dc_get_opp_for_plane(struct dc *dc, struct dc_plane_state *plane); 1476 1381 1382 + /* Link Interfaces */ 1383 + /* TODO: remove this after resolving external dependencies */ 1384 + #include "dc_link.h" 1385 + 1386 + /* The function initiates detection handshake over the given link. It first 1387 + * determines if there are display connections over the link. If so it initiates 1388 + * detection protocols supported by the connected receiver device. The function 1389 + * contains protocol specific handshake sequences which are sometimes mandatory 1390 + * to establish a proper connection between TX and RX. So it is always 1391 + * recommended to call this function as the first link operation upon HPD event 1392 + * or power up event. Upon completion, the function will update link structure 1393 + * in place based on latest RX capabilities. The function may also cause dpms 1394 + * to be reset to off for all currently enabled streams to the link. It is DM's 1395 + * responsibility to serialize detection and DPMS updates. 1396 + * 1397 + * @reason - Indicate which event triggers this detection. dc may customize 1398 + * detection flow depending on the triggering events. 1399 + * return false - if detection is not fully completed. This could happen when 1400 + * there is an unrecoverable error during detection or detection is partially 1401 + * completed (detection has been delegated to dm mst manager ie. 1402 + * link->connection_type == dc_connection_mst_branch when returning false). 1403 + * return true - detection is completed, link has been fully updated with latest 1404 + * detection result. 1405 + */ 1406 + bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason); 1407 + 1408 + /* determine if there is a sink connected to the link 1409 + * 1410 + * @type - dc_connection_single if connected, dc_connection_none otherwise. 1411 + * return - false if an unexpected error occurs, true otherwise. 1412 + * 1413 + * NOTE: This function doesn't detect downstream sink connections i.e 1414 + * dc_connection_mst_branch, dc_connection_sst_branch. In this case, it will 1415 + * return dc_connection_single if the branch device is connected despite of 1416 + * downstream sink's connection status. 1417 + */ 1418 + bool dc_link_detect_connection_type(struct dc_link *link, 1419 + enum dc_connection_type *type); 1420 + 1421 + /* Getter for cached link status from given link */ 1422 + const struct dc_link_status *dc_link_get_status(const struct dc_link *link); 1423 + 1424 + #ifdef CONFIG_DRM_AMD_DC_HDCP 1425 + /* return true if the connected receiver supports the hdcp version */ 1426 + bool dc_link_is_hdcp14(struct dc_link *link, enum signal_type signal); 1427 + bool dc_link_is_hdcp22(struct dc_link *link, enum signal_type signal); 1428 + #endif 1429 + 1430 + /* The function clears recorded DP RX states in the link. DM should call this 1431 + * function when it is resuming from S3 power state to previously connected links. 1432 + * 1433 + * TODO - in the future we should consider to expand link resume interface to 1434 + * support clearing previous rx states. So we don't have to rely on dm to call 1435 + * this interface explicitly. 1436 + */ 1437 + void dc_link_clear_dprx_states(struct dc_link *link); 1438 + 1439 + /* Destruct the mst topology of the link and reset the allocated payload table 1440 + * 1441 + * NOTE: this should only be called if DM chooses not to call dc_link_detect but 1442 + * still wants to reset MST topology on an unplug event */ 1443 + bool dc_link_reset_cur_dp_mst_topology(struct dc_link *link); 1444 + 1445 + /* The function calculates effective DP link bandwidth when a given link is 1446 + * using the given link settings. 1447 + * 1448 + * return - total effective link bandwidth in kbps. 1449 + */ 1450 + uint32_t dc_link_bandwidth_kbps( 1451 + const struct dc_link *link, 1452 + const struct dc_link_settings *link_setting); 1453 + 1454 + /* The function returns minimum bandwidth required to drive a given timing 1455 + * return - minimum required timing bandwidth in kbps. 1456 + */ 1457 + uint32_t dc_bandwidth_in_kbps_from_timing( 1458 + const struct dc_crtc_timing *timing); 1459 + 1460 + /* The function takes a snapshot of current link resource allocation state 1461 + * @dc: pointer to dc of the dm calling this 1462 + * @map: a dc link resource snapshot defined internally to dc. 1463 + * 1464 + * DM needs to capture a snapshot of current link resource allocation mapping 1465 + * and store it in its persistent storage. 1466 + * 1467 + * Some of the link resource is using first come first serve policy. 1468 + * The allocation mapping depends on original hotplug order. This information 1469 + * is lost after driver is loaded next time. The snapshot is used in order to 1470 + * restore link resource to its previous state so user will get consistent 1471 + * link capability allocation across reboot. 1472 + * 1473 + */ 1474 + void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map); 1475 + 1476 + /* This function restores link resource allocation state from a snapshot 1477 + * @dc: pointer to dc of the dm calling this 1478 + * @map: a dc link resource snapshot defined internally to dc. 1479 + * 1480 + * DM needs to call this function after initial link detection on boot and 1481 + * before first commit streams to restore link resource allocation state 1482 + * from previous boot session. 1483 + * 1484 + * Some of the link resource is using first come first serve policy. 1485 + * The allocation mapping depends on original hotplug order. This information 1486 + * is lost after driver is loaded next time. The snapshot is used in order to 1487 + * restore link resource to its previous state so user will get consistent 1488 + * link capability allocation across reboot. 1489 + * 1490 + */ 1491 + void dc_restore_link_res_map(const struct dc *dc, uint32_t *map); 1492 + 1493 + /* TODO: this is not meant to be exposed to DM. Should switch to stream update 1494 + * interface i.e stream_update->dsc_config 1495 + */ 1496 + bool dc_link_update_dsc_config(struct pipe_ctx *pipe_ctx); 1477 1497 /* Sink Interfaces - A sink corresponds to a display output device */ 1478 1498 1479 1499 struct dc_container_id {
+3
drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
··· 178 178 DISPLAY_DONGLE_DP_HDMI_MISMATCHED_DONGLE, 179 179 }; 180 180 181 + #define DC_MAX_EDID_BUFFER_SIZE 2048 182 + #define DC_EDID_BLOCK_SIZE 128 183 + 181 184 struct ddc_service { 182 185 struct ddc *ddc_pin; 183 186 struct ddc_flags flags;
+136
drivers/gpu/drm/amd/display/dc/dc_dp_types.h
··· 27 27 #define DC_DP_TYPES_H 28 28 29 29 #include "os_types.h" 30 + #include "dc_ddc_types.h" 30 31 31 32 enum dc_lane_count { 32 33 LANE_COUNT_UNKNOWN = 0, ··· 1126 1125 uint8_t force_psrsu_cap; 1127 1126 }; 1128 1127 1128 + struct dprx_states { 1129 + bool cable_id_written; 1130 + }; 1131 + 1132 + enum dpcd_downstream_port_max_bpc { 1133 + DOWN_STREAM_MAX_8BPC = 0, 1134 + DOWN_STREAM_MAX_10BPC, 1135 + DOWN_STREAM_MAX_12BPC, 1136 + DOWN_STREAM_MAX_16BPC 1137 + }; 1138 + 1139 + enum link_training_offset { 1140 + DPRX = 0, 1141 + LTTPR_PHY_REPEATER1 = 1, 1142 + LTTPR_PHY_REPEATER2 = 2, 1143 + LTTPR_PHY_REPEATER3 = 3, 1144 + LTTPR_PHY_REPEATER4 = 4, 1145 + LTTPR_PHY_REPEATER5 = 5, 1146 + LTTPR_PHY_REPEATER6 = 6, 1147 + LTTPR_PHY_REPEATER7 = 7, 1148 + LTTPR_PHY_REPEATER8 = 8 1149 + }; 1150 + 1151 + #define MAX_REPEATER_CNT 8 1152 + 1153 + struct dc_lttpr_caps { 1154 + union dpcd_rev revision; 1155 + uint8_t mode; 1156 + uint8_t max_lane_count; 1157 + uint8_t max_link_rate; 1158 + uint8_t phy_repeater_cnt; 1159 + uint8_t max_ext_timeout; 1160 + union dp_main_link_channel_coding_lttpr_cap main_link_channel_coding; 1161 + union dp_128b_132b_supported_lttpr_link_rates supported_128b_132b_rates; 1162 + uint8_t aux_rd_interval[MAX_REPEATER_CNT - 1]; 1163 + }; 1164 + 1165 + struct dc_dongle_dfp_cap_ext { 1166 + bool supported; 1167 + uint16_t max_pixel_rate_in_mps; 1168 + uint16_t max_video_h_active_width; 1169 + uint16_t max_video_v_active_height; 1170 + struct dp_encoding_format_caps encoding_format_caps; 1171 + struct dp_color_depth_caps rgb_color_depth_caps; 1172 + struct dp_color_depth_caps ycbcr444_color_depth_caps; 1173 + struct dp_color_depth_caps ycbcr422_color_depth_caps; 1174 + struct dp_color_depth_caps ycbcr420_color_depth_caps; 1175 + }; 1176 + 1177 + struct dc_dongle_caps { 1178 + /* dongle type (DP converter, CV smart dongle) */ 1179 + enum display_dongle_type dongle_type; 1180 + bool extendedCapValid; 1181 + /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 1182 + indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 1183 + bool is_dp_hdmi_s3d_converter; 1184 + bool is_dp_hdmi_ycbcr422_pass_through; 1185 + bool is_dp_hdmi_ycbcr420_pass_through; 1186 + bool is_dp_hdmi_ycbcr422_converter; 1187 + bool is_dp_hdmi_ycbcr420_converter; 1188 + uint32_t dp_hdmi_max_bpc; 1189 + uint32_t dp_hdmi_max_pixel_clk_in_khz; 1190 + uint32_t dp_hdmi_frl_max_link_bw_in_kbps; 1191 + struct dc_dongle_dfp_cap_ext dfp_cap_ext; 1192 + }; 1193 + 1194 + struct dpcd_caps { 1195 + union dpcd_rev dpcd_rev; 1196 + union max_lane_count max_ln_count; 1197 + union max_down_spread max_down_spread; 1198 + union dprx_feature dprx_feature; 1199 + 1200 + /* valid only for eDP v1.4 or higher*/ 1201 + uint8_t edp_supported_link_rates_count; 1202 + enum dc_link_rate edp_supported_link_rates[8]; 1203 + 1204 + /* dongle type (DP converter, CV smart dongle) */ 1205 + enum display_dongle_type dongle_type; 1206 + bool is_dongle_type_one; 1207 + /* branch device or sink device */ 1208 + bool is_branch_dev; 1209 + /* Dongle's downstream count. */ 1210 + union sink_count sink_count; 1211 + bool is_mst_capable; 1212 + /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 1213 + indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 1214 + struct dc_dongle_caps dongle_caps; 1215 + 1216 + uint32_t sink_dev_id; 1217 + int8_t sink_dev_id_str[6]; 1218 + int8_t sink_hw_revision; 1219 + int8_t sink_fw_revision[2]; 1220 + 1221 + uint32_t branch_dev_id; 1222 + int8_t branch_dev_name[6]; 1223 + int8_t branch_hw_revision; 1224 + int8_t branch_fw_revision[2]; 1225 + 1226 + bool allow_invalid_MSA_timing_param; 1227 + bool panel_mode_edp; 1228 + bool dpcd_display_control_capable; 1229 + bool ext_receiver_cap_field_present; 1230 + bool set_power_state_capable_edp; 1231 + bool dynamic_backlight_capable_edp; 1232 + union dpcd_fec_capability fec_cap; 1233 + struct dpcd_dsc_capabilities dsc_caps; 1234 + struct dc_lttpr_caps lttpr_caps; 1235 + struct adaptive_sync_caps adaptive_sync_caps; 1236 + struct dpcd_usb4_dp_tunneling_info usb4_dp_tun_info; 1237 + 1238 + union dp_128b_132b_supported_link_rates dp_128b_132b_supported_link_rates; 1239 + union dp_main_line_channel_coding_cap channel_coding_cap; 1240 + union dp_sink_video_fallback_formats fallback_formats; 1241 + union dp_fec_capability1 fec_cap1; 1242 + union dp_cable_id cable_id; 1243 + uint8_t edp_rev; 1244 + union edp_alpm_caps alpm_caps; 1245 + struct edp_psr_info psr_info; 1246 + }; 1247 + 1248 + union dpcd_sink_ext_caps { 1249 + struct { 1250 + /* 0 - Sink supports backlight adjust via PWM during SDR/HDR mode 1251 + * 1 - Sink supports backlight adjust via AUX during SDR/HDR mode. 1252 + */ 1253 + uint8_t sdr_aux_backlight_control : 1; 1254 + uint8_t hdr_aux_backlight_control : 1; 1255 + uint8_t reserved_1 : 2; 1256 + uint8_t oled : 1; 1257 + uint8_t reserved_2 : 1; 1258 + uint8_t miniled : 1; 1259 + uint8_t reserved : 1; 1260 + } bits; 1261 + uint8_t raw; 1262 + }; 1129 1263 #endif /* DC_DP_TYPES_H */
+2 -45
drivers/gpu/drm/amd/display/dc/dc_link.h
··· 39 39 dc_link_fec_enabled 40 40 }; 41 41 42 - struct dc_link_status { 43 - bool link_active; 44 - struct dpcd_caps *dpcd_caps; 45 - }; 46 - 47 - struct dprx_states { 48 - bool cable_id_written; 49 - }; 50 - 51 42 /* DP MST stream allocation (payload bandwidth number) */ 52 43 struct link_mst_stream_allocation { 53 44 /* DIG front */ ··· 157 166 bool bw_alloc_enabled; // The BW Alloc Mode Support is turned ON for all 3: DP-Tx & Dpia & CM 158 167 bool response_ready; // Response ready from the CM side 159 168 }; 169 + 170 + #define MAX_SINKS_PER_LINK 4 160 171 161 172 /* 162 173 * A link contains one or more sinks and their connected status. ··· 295 302 struct phy_state phy_state; 296 303 }; 297 304 298 - const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link); 299 305 300 306 /** 301 307 * dc_get_link_at_index() - Return an enumerated dc_link. ··· 377 385 const struct dc_stream_state *stream, struct psr_config *psr_config, 378 386 struct psr_context *psr_context); 379 387 380 - /* Request DC to detect if there is a Panel connected. 381 - * boot - If this call is during initial boot. 382 - * Return false for any type of detection failure or MST detection 383 - * true otherwise. True meaning further action is required (status update 384 - * and OS notification). 385 - */ 386 - enum dc_detect_reason { 387 - DETECT_REASON_BOOT, 388 - DETECT_REASON_RESUMEFROMS3S4, 389 - DETECT_REASON_HPD, 390 - DETECT_REASON_HPDRX, 391 - DETECT_REASON_FALLBACK, 392 - DETECT_REASON_RETRAIN, 393 - DETECT_REASON_TDR, 394 - }; 395 - 396 - bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason); 397 388 bool dc_link_get_hpd_state(struct dc_link *dc_link); 398 389 399 390 /* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt). ··· 446 471 void dc_link_enable_hpd_filter(struct dc_link *link, bool enable); 447 472 448 473 bool dc_link_is_dp_sink_present(struct dc_link *link); 449 - 450 - bool dc_link_detect_connection_type(struct dc_link *link, enum dc_connection_type *type); 451 474 /* 452 475 * DPCD access interfaces 453 476 */ 454 477 455 - #ifdef CONFIG_DRM_AMD_DC_HDCP 456 - bool dc_link_is_hdcp14(struct dc_link *link, enum signal_type signal); 457 - bool dc_link_is_hdcp22(struct dc_link *link, enum signal_type signal); 458 - #endif 459 478 void dc_link_set_drive_settings(struct dc *dc, 460 479 struct link_training_settings *lt_settings, 461 480 const struct dc_link *link); ··· 469 500 const struct link_training_settings *p_link_settings, 470 501 const unsigned char *p_custom_pattern, 471 502 unsigned int cust_pattern_size); 472 - uint32_t dc_link_bandwidth_kbps( 473 - const struct dc_link *link, 474 - const struct dc_link_settings *link_setting); 475 503 476 504 const struct dc_link_settings *dc_link_get_link_cap( 477 505 const struct dc_link *link); ··· 490 524 struct dc *dc, 491 525 struct i2c_command *cmd); 492 526 493 - uint32_t dc_bandwidth_in_kbps_from_timing( 494 - const struct dc_crtc_timing *timing); 495 - 496 527 bool dc_link_is_fec_supported(const struct dc_link *link); 497 528 bool dc_link_should_enable_fec(const struct dc_link *link); 498 529 499 530 uint32_t dc_link_bw_kbps_from_raw_frl_link_rate_data(uint8_t bw); 500 531 enum dp_link_encoding dc_link_dp_mst_decide_link_encoding_format(const struct dc_link *link); 501 532 502 - void dc_link_get_cur_link_res(const struct dc_link *link, 503 - struct link_resource *link_res); 504 533 /* take a snapshot of current link resource allocation state */ 505 534 void dc_get_cur_link_res_map(const struct dc *dc, uint32_t *map); 506 535 /* restore link resource allocation state from a snapshot */ 507 536 void dc_restore_link_res_map(const struct dc *dc, uint32_t *map); 508 - void dc_link_clear_dprx_states(struct dc_link *link); 509 537 void dp_trace_reset(struct dc_link *link); 510 538 bool dc_dp_trace_is_initialized(struct dc_link *link); 511 539 unsigned long long dc_dp_trace_get_lt_end_timestamp(struct dc_link *link, ··· 512 552 struct dp_trace_lt_counts *dc_dp_trace_get_lt_counts(struct dc_link *link, 513 553 bool in_detection); 514 554 unsigned int dc_dp_trace_get_link_loss_count(struct dc_link *link); 515 - 516 - /* Destruct the mst topology of the link and reset the allocated payload table */ 517 - bool dc_link_reset_cur_dp_mst_topology(struct dc_link *link); 518 555 519 556 /* Attempt to transfer the given aux payload. This function does not perform 520 557 * retries or handle error states. The reply is returned in the payload->reply
+44 -65
drivers/gpu/drm/amd/display/dc/dc_types.h
··· 32 32 #include "os_types.h" 33 33 #include "fixed31_32.h" 34 34 #include "irq_types.h" 35 + #include "dc_ddc_types.h" 35 36 #include "dc_dp_types.h" 36 37 #include "dc_hdmi_types.h" 37 38 #include "dc_hw_types.h" ··· 84 83 unsigned long last_entry_write; 85 84 }; 86 85 87 - #define DC_MAX_EDID_BUFFER_SIZE 2048 88 - #define DC_EDID_BLOCK_SIZE 128 89 86 #define MAX_SURFACE_NUM 4 90 87 #define NUM_PIXEL_FORMATS 10 91 - #define MAX_REPEATER_CNT 8 92 - 93 - #include "dc_ddc_types.h" 94 88 95 89 enum tiling_mode { 96 90 TILING_MODE_INVALID, ··· 371 375 struct fixed31_32 hue; 372 376 }; 373 377 374 - enum dpcd_downstream_port_max_bpc { 375 - DOWN_STREAM_MAX_8BPC = 0, 376 - DOWN_STREAM_MAX_10BPC, 377 - DOWN_STREAM_MAX_12BPC, 378 - DOWN_STREAM_MAX_16BPC 379 - }; 380 - 381 - 382 - enum link_training_offset { 383 - DPRX = 0, 384 - LTTPR_PHY_REPEATER1 = 1, 385 - LTTPR_PHY_REPEATER2 = 2, 386 - LTTPR_PHY_REPEATER3 = 3, 387 - LTTPR_PHY_REPEATER4 = 4, 388 - LTTPR_PHY_REPEATER5 = 5, 389 - LTTPR_PHY_REPEATER6 = 6, 390 - LTTPR_PHY_REPEATER7 = 7, 391 - LTTPR_PHY_REPEATER8 = 8 392 - }; 393 - 394 - struct dc_lttpr_caps { 395 - union dpcd_rev revision; 396 - uint8_t mode; 397 - uint8_t max_lane_count; 398 - uint8_t max_link_rate; 399 - uint8_t phy_repeater_cnt; 400 - uint8_t max_ext_timeout; 401 - union dp_main_link_channel_coding_lttpr_cap main_link_channel_coding; 402 - union dp_128b_132b_supported_lttpr_link_rates supported_128b_132b_rates; 403 - uint8_t aux_rd_interval[MAX_REPEATER_CNT - 1]; 404 - }; 405 - 406 - struct dc_dongle_dfp_cap_ext { 407 - bool supported; 408 - uint16_t max_pixel_rate_in_mps; 409 - uint16_t max_video_h_active_width; 410 - uint16_t max_video_v_active_height; 411 - struct dp_encoding_format_caps encoding_format_caps; 412 - struct dp_color_depth_caps rgb_color_depth_caps; 413 - struct dp_color_depth_caps ycbcr444_color_depth_caps; 414 - struct dp_color_depth_caps ycbcr422_color_depth_caps; 415 - struct dp_color_depth_caps ycbcr420_color_depth_caps; 416 - }; 417 - 418 - struct dc_dongle_caps { 419 - /* dongle type (DP converter, CV smart dongle) */ 420 - enum display_dongle_type dongle_type; 421 - bool extendedCapValid; 422 - /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER, 423 - indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/ 424 - bool is_dp_hdmi_s3d_converter; 425 - bool is_dp_hdmi_ycbcr422_pass_through; 426 - bool is_dp_hdmi_ycbcr420_pass_through; 427 - bool is_dp_hdmi_ycbcr422_converter; 428 - bool is_dp_hdmi_ycbcr420_converter; 429 - uint32_t dp_hdmi_max_bpc; 430 - uint32_t dp_hdmi_max_pixel_clk_in_khz; 431 - uint32_t dp_hdmi_frl_max_link_bw_in_kbps; 432 - struct dc_dongle_dfp_cap_ext dfp_cap_ext; 433 - }; 434 378 /* Scaling format */ 435 379 enum scaling_transformation { 436 380 SCALING_TRANSFORMATION_UNINITIALIZED, ··· 939 1003 }; 940 1004 #endif 941 1005 1006 + enum dc_detect_reason { 1007 + DETECT_REASON_BOOT, 1008 + DETECT_REASON_RESUMEFROMS3S4, 1009 + DETECT_REASON_HPD, 1010 + DETECT_REASON_HPDRX, 1011 + DETECT_REASON_FALLBACK, 1012 + DETECT_REASON_RETRAIN, 1013 + DETECT_REASON_TDR, 1014 + }; 1015 + 1016 + struct dc_link_status { 1017 + bool link_active; 1018 + struct dpcd_caps *dpcd_caps; 1019 + }; 1020 + 1021 + #if defined(CONFIG_DRM_AMD_DC_HDCP) 1022 + union hdcp_rx_caps { 1023 + struct { 1024 + uint8_t version; 1025 + uint8_t reserved; 1026 + struct { 1027 + uint8_t repeater : 1; 1028 + uint8_t hdcp_capable : 1; 1029 + uint8_t reserved : 6; 1030 + } byte0; 1031 + } fields; 1032 + uint8_t raw[3]; 1033 + }; 1034 + 1035 + union hdcp_bcaps { 1036 + struct { 1037 + uint8_t HDCP_CAPABLE:1; 1038 + uint8_t REPEATER:1; 1039 + uint8_t RESERVED:6; 1040 + } bits; 1041 + uint8_t raw; 1042 + }; 1043 + 1044 + struct hdcp_caps { 1045 + union hdcp_rx_caps rx_caps; 1046 + union hdcp_bcaps bcaps; 1047 + }; 1048 + #endif 942 1049 #endif /* DC_TYPES_H_ */
+18
drivers/gpu/drm/amd/display/dc/inc/link.h
··· 136 136 const struct dc_stream_state *stream, 137 137 struct dc_link *link, 138 138 const struct dc_crtc_timing *timing); 139 + bool link_detect(struct dc_link *link, enum dc_detect_reason reason); 140 + bool link_detect_connection_type(struct dc_link *link, 141 + enum dc_connection_type *type); 142 + const struct dc_link_status *link_get_status(const struct dc_link *link); 143 + #ifdef CONFIG_DRM_AMD_DC_HDCP 144 + /* return true if the connected receiver supports the hdcp version */ 145 + bool link_is_hdcp14(struct dc_link *link, enum signal_type signal); 146 + bool link_is_hdcp22(struct dc_link *link, enum signal_type signal); 147 + #endif 148 + void link_clear_dprx_states(struct dc_link *link); 149 + bool link_reset_cur_dp_mst_topology(struct dc_link *link); 150 + uint32_t dp_link_bandwidth_kbps( 151 + const struct dc_link *link, 152 + const struct dc_link_settings *link_settings); 153 + uint32_t link_timing_bandwidth_kbps(const struct dc_crtc_timing *timing); 154 + void link_get_cur_res_map(const struct dc *dc, uint32_t *map); 155 + void link_restore_res_map(const struct dc *dc, uint32_t *map); 156 + 139 157 #endif /* __DC_LINK_HPD_H__ */