| .. | .. |
|---|
| 23 | 23 | * |
|---|
| 24 | 24 | */ |
|---|
| 25 | 25 | |
|---|
| 26 | +#include <linux/delay.h> |
|---|
| 27 | + |
|---|
| 26 | 28 | #include "dc_bios_types.h" |
|---|
| 27 | 29 | #include "dce_stream_encoder.h" |
|---|
| 28 | 30 | #include "reg_helper.h" |
|---|
| .. | .. |
|---|
| 135 | 137 | AFMT_GENERIC0_UPDATE, (packet_index == 0), |
|---|
| 136 | 138 | AFMT_GENERIC2_UPDATE, (packet_index == 2)); |
|---|
| 137 | 139 | } |
|---|
| 138 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 140 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 139 | 141 | if (REG(AFMT_VBI_PACKET_CONTROL1)) { |
|---|
| 140 | 142 | switch (packet_index) { |
|---|
| 141 | 143 | case 0: |
|---|
| .. | .. |
|---|
| 229 | 231 | HDMI_GENERIC1_SEND, send, |
|---|
| 230 | 232 | HDMI_GENERIC1_LINE, line); |
|---|
| 231 | 233 | break; |
|---|
| 232 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 234 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 233 | 235 | case 4: |
|---|
| 234 | 236 | if (REG(HDMI_GENERIC_PACKET_CONTROL2)) |
|---|
| 235 | 237 | REG_UPDATE_3(HDMI_GENERIC_PACKET_CONTROL2, |
|---|
| .. | .. |
|---|
| 272 | 274 | static void dce110_stream_encoder_dp_set_stream_attribute( |
|---|
| 273 | 275 | struct stream_encoder *enc, |
|---|
| 274 | 276 | struct dc_crtc_timing *crtc_timing, |
|---|
| 275 | | - enum dc_color_space output_color_space) |
|---|
| 277 | + enum dc_color_space output_color_space, |
|---|
| 278 | + bool use_vsc_sdp_for_colorimetry, |
|---|
| 279 | + uint32_t enable_sdp_splitting) |
|---|
| 276 | 280 | { |
|---|
| 277 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 281 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 278 | 282 | uint32_t h_active_start; |
|---|
| 279 | 283 | uint32_t v_active_start; |
|---|
| 280 | 284 | uint32_t misc0 = 0; |
|---|
| .. | .. |
|---|
| 288 | 292 | #endif |
|---|
| 289 | 293 | |
|---|
| 290 | 294 | struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 291 | | - |
|---|
| 295 | + struct dc_crtc_timing hw_crtc_timing = *crtc_timing; |
|---|
| 296 | + if (hw_crtc_timing.flags.INTERLACE) { |
|---|
| 297 | + /*the input timing is in VESA spec format with Interlace flag =1*/ |
|---|
| 298 | + hw_crtc_timing.v_total /= 2; |
|---|
| 299 | + hw_crtc_timing.v_border_top /= 2; |
|---|
| 300 | + hw_crtc_timing.v_addressable /= 2; |
|---|
| 301 | + hw_crtc_timing.v_border_bottom /= 2; |
|---|
| 302 | + hw_crtc_timing.v_front_porch /= 2; |
|---|
| 303 | + hw_crtc_timing.v_sync_width /= 2; |
|---|
| 304 | + } |
|---|
| 292 | 305 | /* set pixel encoding */ |
|---|
| 293 | | - switch (crtc_timing->pixel_encoding) { |
|---|
| 306 | + switch (hw_crtc_timing.pixel_encoding) { |
|---|
| 294 | 307 | case PIXEL_ENCODING_YCBCR422: |
|---|
| 295 | 308 | REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, |
|---|
| 296 | 309 | DP_PIXEL_ENCODING_TYPE_YCBCR422); |
|---|
| .. | .. |
|---|
| 299 | 312 | REG_UPDATE(DP_PIXEL_FORMAT, DP_PIXEL_ENCODING, |
|---|
| 300 | 313 | DP_PIXEL_ENCODING_TYPE_YCBCR444); |
|---|
| 301 | 314 | |
|---|
| 302 | | - if (crtc_timing->flags.Y_ONLY) |
|---|
| 303 | | - if (crtc_timing->display_color_depth != COLOR_DEPTH_666) |
|---|
| 315 | + if (hw_crtc_timing.flags.Y_ONLY) |
|---|
| 316 | + if (hw_crtc_timing.display_color_depth != COLOR_DEPTH_666) |
|---|
| 304 | 317 | /* HW testing only, no use case yet. |
|---|
| 305 | 318 | * Color depth of Y-only could be |
|---|
| 306 | 319 | * 8, 10, 12, 16 bits */ |
|---|
| .. | .. |
|---|
| 317 | 330 | if (enc110->se_mask->DP_VID_M_DOUBLE_VALUE_EN) |
|---|
| 318 | 331 | REG_UPDATE(DP_VID_TIMING, DP_VID_M_DOUBLE_VALUE_EN, 1); |
|---|
| 319 | 332 | |
|---|
| 320 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 333 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 321 | 334 | if (enc110->se_mask->DP_VID_N_MUL) |
|---|
| 322 | 335 | REG_UPDATE(DP_VID_TIMING, DP_VID_N_MUL, 1); |
|---|
| 323 | 336 | #endif |
|---|
| .. | .. |
|---|
| 328 | 341 | break; |
|---|
| 329 | 342 | } |
|---|
| 330 | 343 | |
|---|
| 331 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 344 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 332 | 345 | if (REG(DP_MSA_MISC)) |
|---|
| 333 | 346 | misc1 = REG_READ(DP_MSA_MISC); |
|---|
| 334 | 347 | #endif |
|---|
| 335 | 348 | |
|---|
| 336 | 349 | /* set color depth */ |
|---|
| 337 | 350 | |
|---|
| 338 | | - switch (crtc_timing->display_color_depth) { |
|---|
| 351 | + switch (hw_crtc_timing.display_color_depth) { |
|---|
| 339 | 352 | case COLOR_DEPTH_666: |
|---|
| 340 | 353 | REG_UPDATE(DP_PIXEL_FORMAT, DP_COMPONENT_DEPTH, |
|---|
| 341 | 354 | 0); |
|---|
| .. | .. |
|---|
| 362 | 375 | /* set dynamic range and YCbCr range */ |
|---|
| 363 | 376 | |
|---|
| 364 | 377 | |
|---|
| 365 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 366 | | - switch (crtc_timing->display_color_depth) { |
|---|
| 378 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 379 | + switch (hw_crtc_timing.display_color_depth) { |
|---|
| 367 | 380 | case COLOR_DEPTH_666: |
|---|
| 368 | 381 | colorimetry_bpc = 0; |
|---|
| 369 | 382 | break; |
|---|
| .. | .. |
|---|
| 401 | 414 | misc0 = misc0 | 0x8; /* bit3=1, bit4=0 */ |
|---|
| 402 | 415 | misc1 = misc1 & ~0x80; /* bit7 = 0*/ |
|---|
| 403 | 416 | dynamic_range_ycbcr = 0; /*bt601*/ |
|---|
| 404 | | - if (crtc_timing->pixel_encoding == PIXEL_ENCODING_YCBCR422) |
|---|
| 417 | + if (hw_crtc_timing.pixel_encoding == PIXEL_ENCODING_YCBCR422) |
|---|
| 405 | 418 | misc0 = misc0 | 0x2; /* bit2=0, bit1=1 */ |
|---|
| 406 | | - else if (crtc_timing->pixel_encoding == PIXEL_ENCODING_YCBCR444) |
|---|
| 419 | + else if (hw_crtc_timing.pixel_encoding == PIXEL_ENCODING_YCBCR444) |
|---|
| 407 | 420 | misc0 = misc0 | 0x4; /* bit2=1, bit1=0 */ |
|---|
| 408 | 421 | break; |
|---|
| 409 | 422 | case COLOR_SPACE_YCBCR709: |
|---|
| 410 | 423 | case COLOR_SPACE_YCBCR709_LIMITED: |
|---|
| 424 | + case COLOR_SPACE_YCBCR709_BLACK: |
|---|
| 411 | 425 | misc0 = misc0 | 0x18; /* bit3=1, bit4=1 */ |
|---|
| 412 | 426 | misc1 = misc1 & ~0x80; /* bit7 = 0*/ |
|---|
| 413 | 427 | dynamic_range_ycbcr = 1; /*bt709*/ |
|---|
| 414 | | - if (crtc_timing->pixel_encoding == PIXEL_ENCODING_YCBCR422) |
|---|
| 428 | + if (hw_crtc_timing.pixel_encoding == PIXEL_ENCODING_YCBCR422) |
|---|
| 415 | 429 | misc0 = misc0 | 0x2; /* bit2=0, bit1=1 */ |
|---|
| 416 | | - else if (crtc_timing->pixel_encoding == PIXEL_ENCODING_YCBCR444) |
|---|
| 430 | + else if (hw_crtc_timing.pixel_encoding == PIXEL_ENCODING_YCBCR444) |
|---|
| 417 | 431 | misc0 = misc0 | 0x4; /* bit2=1, bit1=0 */ |
|---|
| 418 | 432 | break; |
|---|
| 419 | 433 | case COLOR_SPACE_2020_RGB_LIMITEDRANGE: |
|---|
| .. | .. |
|---|
| 441 | 455 | DP_DYN_RANGE, dynamic_range_rgb, |
|---|
| 442 | 456 | DP_YCBCR_RANGE, dynamic_range_ycbcr); |
|---|
| 443 | 457 | |
|---|
| 444 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 458 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 445 | 459 | if (REG(DP_MSA_COLORIMETRY)) |
|---|
| 446 | 460 | REG_SET(DP_MSA_COLORIMETRY, 0, DP_MSA_MISC0, misc0); |
|---|
| 447 | 461 | |
|---|
| .. | .. |
|---|
| 453 | 467 | */ |
|---|
| 454 | 468 | if (REG(DP_MSA_TIMING_PARAM1)) |
|---|
| 455 | 469 | REG_SET_2(DP_MSA_TIMING_PARAM1, 0, |
|---|
| 456 | | - DP_MSA_HTOTAL, crtc_timing->h_total, |
|---|
| 457 | | - DP_MSA_VTOTAL, crtc_timing->v_total); |
|---|
| 470 | + DP_MSA_HTOTAL, hw_crtc_timing.h_total, |
|---|
| 471 | + DP_MSA_VTOTAL, hw_crtc_timing.v_total); |
|---|
| 458 | 472 | #endif |
|---|
| 459 | 473 | |
|---|
| 460 | 474 | /* calcuate from vesa timing parameters |
|---|
| 461 | 475 | * h_active_start related to leading edge of sync |
|---|
| 462 | 476 | */ |
|---|
| 463 | 477 | |
|---|
| 464 | | - h_blank = crtc_timing->h_total - crtc_timing->h_border_left - |
|---|
| 465 | | - crtc_timing->h_addressable - crtc_timing->h_border_right; |
|---|
| 478 | + h_blank = hw_crtc_timing.h_total - hw_crtc_timing.h_border_left - |
|---|
| 479 | + hw_crtc_timing.h_addressable - hw_crtc_timing.h_border_right; |
|---|
| 466 | 480 | |
|---|
| 467 | | - h_back_porch = h_blank - crtc_timing->h_front_porch - |
|---|
| 468 | | - crtc_timing->h_sync_width; |
|---|
| 481 | + h_back_porch = h_blank - hw_crtc_timing.h_front_porch - |
|---|
| 482 | + hw_crtc_timing.h_sync_width; |
|---|
| 469 | 483 | |
|---|
| 470 | 484 | /* start at begining of left border */ |
|---|
| 471 | | - h_active_start = crtc_timing->h_sync_width + h_back_porch; |
|---|
| 485 | + h_active_start = hw_crtc_timing.h_sync_width + h_back_porch; |
|---|
| 472 | 486 | |
|---|
| 473 | 487 | |
|---|
| 474 | | - v_active_start = crtc_timing->v_total - crtc_timing->v_border_top - |
|---|
| 475 | | - crtc_timing->v_addressable - crtc_timing->v_border_bottom - |
|---|
| 476 | | - crtc_timing->v_front_porch; |
|---|
| 488 | + v_active_start = hw_crtc_timing.v_total - hw_crtc_timing.v_border_top - |
|---|
| 489 | + hw_crtc_timing.v_addressable - hw_crtc_timing.v_border_bottom - |
|---|
| 490 | + hw_crtc_timing.v_front_porch; |
|---|
| 477 | 491 | |
|---|
| 478 | 492 | |
|---|
| 479 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 493 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 480 | 494 | /* start at begining of left border */ |
|---|
| 481 | 495 | if (REG(DP_MSA_TIMING_PARAM2)) |
|---|
| 482 | 496 | REG_SET_2(DP_MSA_TIMING_PARAM2, 0, |
|---|
| .. | .. |
|---|
| 486 | 500 | if (REG(DP_MSA_TIMING_PARAM3)) |
|---|
| 487 | 501 | REG_SET_4(DP_MSA_TIMING_PARAM3, 0, |
|---|
| 488 | 502 | DP_MSA_HSYNCWIDTH, |
|---|
| 489 | | - crtc_timing->h_sync_width, |
|---|
| 503 | + hw_crtc_timing.h_sync_width, |
|---|
| 490 | 504 | DP_MSA_HSYNCPOLARITY, |
|---|
| 491 | | - !crtc_timing->flags.HSYNC_POSITIVE_POLARITY, |
|---|
| 505 | + !hw_crtc_timing.flags.HSYNC_POSITIVE_POLARITY, |
|---|
| 492 | 506 | DP_MSA_VSYNCWIDTH, |
|---|
| 493 | | - crtc_timing->v_sync_width, |
|---|
| 507 | + hw_crtc_timing.v_sync_width, |
|---|
| 494 | 508 | DP_MSA_VSYNCPOLARITY, |
|---|
| 495 | | - !crtc_timing->flags.VSYNC_POSITIVE_POLARITY); |
|---|
| 509 | + !hw_crtc_timing.flags.VSYNC_POSITIVE_POLARITY); |
|---|
| 496 | 510 | |
|---|
| 497 | 511 | /* HWDITH include border or overscan */ |
|---|
| 498 | 512 | if (REG(DP_MSA_TIMING_PARAM4)) |
|---|
| 499 | 513 | REG_SET_2(DP_MSA_TIMING_PARAM4, 0, |
|---|
| 500 | | - DP_MSA_HWIDTH, crtc_timing->h_border_left + |
|---|
| 501 | | - crtc_timing->h_addressable + crtc_timing->h_border_right, |
|---|
| 502 | | - DP_MSA_VHEIGHT, crtc_timing->v_border_top + |
|---|
| 503 | | - crtc_timing->v_addressable + crtc_timing->v_border_bottom); |
|---|
| 514 | + DP_MSA_HWIDTH, hw_crtc_timing.h_border_left + |
|---|
| 515 | + hw_crtc_timing.h_addressable + hw_crtc_timing.h_border_right, |
|---|
| 516 | + DP_MSA_VHEIGHT, hw_crtc_timing.v_border_top + |
|---|
| 517 | + hw_crtc_timing.v_addressable + hw_crtc_timing.v_border_bottom); |
|---|
| 504 | 518 | #endif |
|---|
| 505 | 519 | } |
|---|
| 506 | 520 | #endif |
|---|
| .. | .. |
|---|
| 550 | 564 | cntl.enable_dp_audio = enable_audio; |
|---|
| 551 | 565 | cntl.pixel_clock = actual_pix_clk_khz; |
|---|
| 552 | 566 | cntl.lanes_number = LANE_COUNT_FOUR; |
|---|
| 567 | + cntl.color_depth = crtc_timing->display_color_depth; |
|---|
| 553 | 568 | |
|---|
| 554 | 569 | if (enc110->base.bp->funcs->encoder_control( |
|---|
| 555 | 570 | enc110->base.bp, &cntl) != BP_RESULT_OK) |
|---|
| .. | .. |
|---|
| 662 | 677 | cntl.signal = is_dual_link ? |
|---|
| 663 | 678 | SIGNAL_TYPE_DVI_DUAL_LINK : SIGNAL_TYPE_DVI_SINGLE_LINK; |
|---|
| 664 | 679 | cntl.enable_dp_audio = false; |
|---|
| 665 | | - cntl.pixel_clock = crtc_timing->pix_clk_khz; |
|---|
| 680 | + cntl.pixel_clock = crtc_timing->pix_clk_100hz / 10; |
|---|
| 666 | 681 | cntl.lanes_number = (is_dual_link) ? LANE_COUNT_EIGHT : LANE_COUNT_FOUR; |
|---|
| 667 | 682 | |
|---|
| 668 | 683 | if (enc110->base.bp->funcs->encoder_control( |
|---|
| .. | .. |
|---|
| 674 | 689 | dce110_stream_encoder_set_stream_attribute_helper(enc110, crtc_timing); |
|---|
| 675 | 690 | } |
|---|
| 676 | 691 | |
|---|
| 677 | | -static void dce110_stream_encoder_set_mst_bandwidth( |
|---|
| 692 | +/* setup stream encoder in LVDS mode */ |
|---|
| 693 | +static void dce110_stream_encoder_lvds_set_stream_attribute( |
|---|
| 694 | + struct stream_encoder *enc, |
|---|
| 695 | + struct dc_crtc_timing *crtc_timing) |
|---|
| 696 | +{ |
|---|
| 697 | + struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 698 | + struct bp_encoder_control cntl = {0}; |
|---|
| 699 | + |
|---|
| 700 | + cntl.action = ENCODER_CONTROL_SETUP; |
|---|
| 701 | + cntl.engine_id = enc110->base.id; |
|---|
| 702 | + cntl.signal = SIGNAL_TYPE_LVDS; |
|---|
| 703 | + cntl.enable_dp_audio = false; |
|---|
| 704 | + cntl.pixel_clock = crtc_timing->pix_clk_100hz / 10; |
|---|
| 705 | + cntl.lanes_number = LANE_COUNT_FOUR; |
|---|
| 706 | + |
|---|
| 707 | + if (enc110->base.bp->funcs->encoder_control( |
|---|
| 708 | + enc110->base.bp, &cntl) != BP_RESULT_OK) |
|---|
| 709 | + return; |
|---|
| 710 | + |
|---|
| 711 | + ASSERT(crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB); |
|---|
| 712 | +} |
|---|
| 713 | + |
|---|
| 714 | +static void dce110_stream_encoder_set_throttled_vcp_size( |
|---|
| 678 | 715 | struct stream_encoder *enc, |
|---|
| 679 | 716 | struct fixed31_32 avg_time_slots_per_mtp) |
|---|
| 680 | 717 | { |
|---|
| .. | .. |
|---|
| 751 | 788 | dce110_update_hdmi_info_packet(enc110, 3, &info_frame->hdrsmd); |
|---|
| 752 | 789 | } |
|---|
| 753 | 790 | |
|---|
| 754 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 791 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 755 | 792 | if (enc110->se_mask->HDMI_DB_DISABLE) { |
|---|
| 756 | 793 | /* for bring up, disable dp double TODO */ |
|---|
| 757 | 794 | if (REG(HDMI_DB_CONTROL)) |
|---|
| .. | .. |
|---|
| 789 | 826 | HDMI_GENERIC1_LINE, 0, |
|---|
| 790 | 827 | HDMI_GENERIC1_SEND, 0); |
|---|
| 791 | 828 | |
|---|
| 792 | | -#if defined(CONFIG_DRM_AMD_DC_DCN1_0) |
|---|
| 829 | +#if defined(CONFIG_DRM_AMD_DC_DCN) |
|---|
| 793 | 830 | /* stop generic packets 2 & 3 on HDMI */ |
|---|
| 794 | 831 | if (REG(HDMI_GENERIC_PACKET_CONTROL2)) |
|---|
| 795 | 832 | REG_SET_6(HDMI_GENERIC_PACKET_CONTROL2, 0, |
|---|
| .. | .. |
|---|
| 886 | 923 | struct stream_encoder *enc) |
|---|
| 887 | 924 | { |
|---|
| 888 | 925 | struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 889 | | - uint32_t retries = 0; |
|---|
| 890 | 926 | uint32_t reg1 = 0; |
|---|
| 891 | 927 | uint32_t max_retries = DP_BLANK_MAX_RETRY * 10; |
|---|
| 892 | 928 | |
|---|
| .. | .. |
|---|
| 904 | 940 | * (2 = start of the next vertical blank) */ |
|---|
| 905 | 941 | REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_DIS_DEFER, 2); |
|---|
| 906 | 942 | /* Larger delay to wait until VBLANK - use max retry of |
|---|
| 907 | | - * 10us*3000=30ms. This covers 16.6ms of typical 60 Hz mode + |
|---|
| 908 | | - * a little more because we may not trust delay accuracy. |
|---|
| 909 | | - */ |
|---|
| 943 | + * 10us*3000=30ms. This covers 16.6ms of typical 60 Hz mode + |
|---|
| 944 | + * a little more because we may not trust delay accuracy. |
|---|
| 945 | + */ |
|---|
| 910 | 946 | max_retries = DP_BLANK_MAX_RETRY * 150; |
|---|
| 911 | 947 | |
|---|
| 912 | 948 | /* disable DP stream */ |
|---|
| 913 | 949 | REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, 0); |
|---|
| 914 | 950 | |
|---|
| 915 | 951 | /* the encoder stops sending the video stream |
|---|
| 916 | | - * at the start of the vertical blanking. |
|---|
| 917 | | - * Poll for DP_VID_STREAM_STATUS == 0 |
|---|
| 918 | | - */ |
|---|
| 952 | + * at the start of the vertical blanking. |
|---|
| 953 | + * Poll for DP_VID_STREAM_STATUS == 0 |
|---|
| 954 | + */ |
|---|
| 919 | 955 | |
|---|
| 920 | 956 | REG_WAIT(DP_VID_STREAM_CNTL, DP_VID_STREAM_STATUS, |
|---|
| 921 | 957 | 0, |
|---|
| 922 | 958 | 10, max_retries); |
|---|
| 923 | 959 | |
|---|
| 924 | | - ASSERT(retries <= max_retries); |
|---|
| 925 | | - |
|---|
| 926 | 960 | /* Tell the DP encoder to ignore timing from CRTC, must be done after |
|---|
| 927 | | - * the polling. If we set DP_STEER_FIFO_RESET before DP stream blank is |
|---|
| 928 | | - * complete, stream status will be stuck in video stream enabled state, |
|---|
| 929 | | - * i.e. DP_VID_STREAM_STATUS stuck at 1. |
|---|
| 930 | | - */ |
|---|
| 961 | + * the polling. If we set DP_STEER_FIFO_RESET before DP stream blank is |
|---|
| 962 | + * complete, stream status will be stuck in video stream enabled state, |
|---|
| 963 | + * i.e. DP_VID_STREAM_STATUS stuck at 1. |
|---|
| 964 | + */ |
|---|
| 931 | 965 | |
|---|
| 932 | 966 | REG_UPDATE(DP_STEER_FIFO, DP_STEER_FIFO_RESET, true); |
|---|
| 933 | 967 | } |
|---|
| .. | .. |
|---|
| 949 | 983 | |
|---|
| 950 | 984 | uint64_t m_vid_l = n_vid; |
|---|
| 951 | 985 | |
|---|
| 952 | | - m_vid_l *= param->pixel_clk_khz; |
|---|
| 986 | + m_vid_l *= param->timing.pix_clk_100hz / 10; |
|---|
| 953 | 987 | m_vid_l = div_u64(m_vid_l, |
|---|
| 954 | 988 | param->link_settings.link_rate |
|---|
| 955 | 989 | * LINK_RATE_REF_FREQ_IN_KHZ); |
|---|
| .. | .. |
|---|
| 1005 | 1039 | REG_UPDATE(HDMI_GC, HDMI_GC_AVMUTE, value); |
|---|
| 1006 | 1040 | } |
|---|
| 1007 | 1041 | |
|---|
| 1042 | + |
|---|
| 1043 | +static void dce110_reset_hdmi_stream_attribute( |
|---|
| 1044 | + struct stream_encoder *enc) |
|---|
| 1045 | +{ |
|---|
| 1046 | + struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 1047 | + if (enc110->se_mask->HDMI_DATA_SCRAMBLE_EN) |
|---|
| 1048 | + REG_UPDATE_5(HDMI_CONTROL, |
|---|
| 1049 | + HDMI_PACKET_GEN_VERSION, 1, |
|---|
| 1050 | + HDMI_KEEPOUT_MODE, 1, |
|---|
| 1051 | + HDMI_DEEP_COLOR_ENABLE, 0, |
|---|
| 1052 | + HDMI_DATA_SCRAMBLE_EN, 0, |
|---|
| 1053 | + HDMI_CLOCK_CHANNEL_RATE, 0); |
|---|
| 1054 | + else |
|---|
| 1055 | + REG_UPDATE_3(HDMI_CONTROL, |
|---|
| 1056 | + HDMI_PACKET_GEN_VERSION, 1, |
|---|
| 1057 | + HDMI_KEEPOUT_MODE, 1, |
|---|
| 1058 | + HDMI_DEEP_COLOR_ENABLE, 0); |
|---|
| 1059 | +} |
|---|
| 1008 | 1060 | |
|---|
| 1009 | 1061 | #define DP_SEC_AUD_N__DP_SEC_AUD_N__DEFAULT 0x8000 |
|---|
| 1010 | 1062 | #define DP_SEC_TIMESTAMP__DP_SEC_TIMESTAMP_MODE__AUTO_CALC 1 |
|---|
| .. | .. |
|---|
| 1092 | 1144 | uint32_t RC_RLC_FLC:1; |
|---|
| 1093 | 1145 | uint32_t RRC_FRC:1; |
|---|
| 1094 | 1146 | } channels; |
|---|
| 1095 | | -}; |
|---|
| 1096 | | - |
|---|
| 1097 | | -struct audio_clock_info { |
|---|
| 1098 | | - /* pixel clock frequency*/ |
|---|
| 1099 | | - uint32_t pixel_clock_in_10khz; |
|---|
| 1100 | | - /* N - 32KHz audio */ |
|---|
| 1101 | | - uint32_t n_32khz; |
|---|
| 1102 | | - /* CTS - 32KHz audio*/ |
|---|
| 1103 | | - uint32_t cts_32khz; |
|---|
| 1104 | | - uint32_t n_44khz; |
|---|
| 1105 | | - uint32_t cts_44khz; |
|---|
| 1106 | | - uint32_t n_48khz; |
|---|
| 1107 | | - uint32_t cts_48khz; |
|---|
| 1108 | 1147 | }; |
|---|
| 1109 | 1148 | |
|---|
| 1110 | 1149 | /* 25.2MHz/1.001*/ |
|---|
| .. | .. |
|---|
| 1232 | 1271 | |
|---|
| 1233 | 1272 | static void get_audio_clock_info( |
|---|
| 1234 | 1273 | enum dc_color_depth color_depth, |
|---|
| 1235 | | - uint32_t crtc_pixel_clock_in_khz, |
|---|
| 1236 | | - uint32_t actual_pixel_clock_in_khz, |
|---|
| 1274 | + uint32_t crtc_pixel_clock_100Hz, |
|---|
| 1275 | + uint32_t actual_pixel_clock_100Hz, |
|---|
| 1237 | 1276 | struct audio_clock_info *audio_clock_info) |
|---|
| 1238 | 1277 | { |
|---|
| 1239 | 1278 | const struct audio_clock_info *clock_info; |
|---|
| 1240 | 1279 | uint32_t index; |
|---|
| 1241 | | - uint32_t crtc_pixel_clock_in_10khz = crtc_pixel_clock_in_khz / 10; |
|---|
| 1280 | + uint32_t crtc_pixel_clock_in_10khz = crtc_pixel_clock_100Hz / 100; |
|---|
| 1242 | 1281 | uint32_t audio_array_size; |
|---|
| 1243 | 1282 | |
|---|
| 1244 | 1283 | switch (color_depth) { |
|---|
| .. | .. |
|---|
| 1275 | 1314 | } |
|---|
| 1276 | 1315 | |
|---|
| 1277 | 1316 | /* not found */ |
|---|
| 1278 | | - if (actual_pixel_clock_in_khz == 0) |
|---|
| 1279 | | - actual_pixel_clock_in_khz = crtc_pixel_clock_in_khz; |
|---|
| 1317 | + if (actual_pixel_clock_100Hz == 0) |
|---|
| 1318 | + actual_pixel_clock_100Hz = crtc_pixel_clock_100Hz; |
|---|
| 1280 | 1319 | |
|---|
| 1281 | 1320 | /* See HDMI spec the table entry under |
|---|
| 1282 | 1321 | * pixel clock of "Other". */ |
|---|
| 1283 | 1322 | audio_clock_info->pixel_clock_in_10khz = |
|---|
| 1284 | | - actual_pixel_clock_in_khz / 10; |
|---|
| 1285 | | - audio_clock_info->cts_32khz = actual_pixel_clock_in_khz; |
|---|
| 1286 | | - audio_clock_info->cts_44khz = actual_pixel_clock_in_khz; |
|---|
| 1287 | | - audio_clock_info->cts_48khz = actual_pixel_clock_in_khz; |
|---|
| 1323 | + actual_pixel_clock_100Hz / 100; |
|---|
| 1324 | + audio_clock_info->cts_32khz = actual_pixel_clock_100Hz / 10; |
|---|
| 1325 | + audio_clock_info->cts_44khz = actual_pixel_clock_100Hz / 10; |
|---|
| 1326 | + audio_clock_info->cts_48khz = actual_pixel_clock_100Hz / 10; |
|---|
| 1288 | 1327 | |
|---|
| 1289 | 1328 | audio_clock_info->n_32khz = 4096; |
|---|
| 1290 | 1329 | audio_clock_info->n_44khz = 6272; |
|---|
| .. | .. |
|---|
| 1298 | 1337 | { |
|---|
| 1299 | 1338 | struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 1300 | 1339 | |
|---|
| 1301 | | - uint32_t speakers = 0; |
|---|
| 1302 | 1340 | uint32_t channels = 0; |
|---|
| 1303 | 1341 | |
|---|
| 1304 | 1342 | ASSERT(audio_info); |
|---|
| .. | .. |
|---|
| 1306 | 1344 | /* This should not happen.it does so we don't get BSOD*/ |
|---|
| 1307 | 1345 | return; |
|---|
| 1308 | 1346 | |
|---|
| 1309 | | - speakers = audio_info->flags.info.ALLSPEAKERS; |
|---|
| 1310 | 1347 | channels = speakers_to_channels(audio_info->flags.speaker_flags).all; |
|---|
| 1311 | 1348 | |
|---|
| 1312 | 1349 | /* setup the audio stream source select (audio -> dig mapping) */ |
|---|
| .. | .. |
|---|
| 1350 | 1387 | |
|---|
| 1351 | 1388 | /* Program audio clock sample/regeneration parameters */ |
|---|
| 1352 | 1389 | get_audio_clock_info(crtc_info->color_depth, |
|---|
| 1353 | | - crtc_info->requested_pixel_clock, |
|---|
| 1354 | | - crtc_info->calculated_pixel_clock, |
|---|
| 1390 | + crtc_info->requested_pixel_clock_100Hz, |
|---|
| 1391 | + crtc_info->calculated_pixel_clock_100Hz, |
|---|
| 1355 | 1392 | &audio_clock_info); |
|---|
| 1356 | 1393 | DC_LOG_HW_AUDIO( |
|---|
| 1357 | | - "\n%s:Input::requested_pixel_clock = %d" \ |
|---|
| 1358 | | - "calculated_pixel_clock = %d \n", __func__, \ |
|---|
| 1359 | | - crtc_info->requested_pixel_clock, \ |
|---|
| 1360 | | - crtc_info->calculated_pixel_clock); |
|---|
| 1394 | + "\n%s:Input::requested_pixel_clock_100Hz = %d" \ |
|---|
| 1395 | + "calculated_pixel_clock_100Hz = %d \n", __func__, \ |
|---|
| 1396 | + crtc_info->requested_pixel_clock_100Hz, \ |
|---|
| 1397 | + crtc_info->calculated_pixel_clock_100Hz); |
|---|
| 1361 | 1398 | |
|---|
| 1362 | 1399 | /* HDMI_ACR_32_0__HDMI_ACR_CTS_32_MASK */ |
|---|
| 1363 | 1400 | REG_UPDATE(HDMI_ACR_32_0, HDMI_ACR_CTS_32, audio_clock_info.cts_32khz); |
|---|
| .. | .. |
|---|
| 1556 | 1593 | REG_UPDATE(DIG_FE_CNTL, DIG_STEREOSYNC_GATE_EN, !enable); |
|---|
| 1557 | 1594 | } |
|---|
| 1558 | 1595 | |
|---|
| 1596 | +static void dig_connect_to_otg( |
|---|
| 1597 | + struct stream_encoder *enc, |
|---|
| 1598 | + int tg_inst) |
|---|
| 1599 | +{ |
|---|
| 1600 | + struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 1601 | + |
|---|
| 1602 | + REG_UPDATE(DIG_FE_CNTL, DIG_SOURCE_SELECT, tg_inst); |
|---|
| 1603 | +} |
|---|
| 1604 | + |
|---|
| 1605 | +static unsigned int dig_source_otg( |
|---|
| 1606 | + struct stream_encoder *enc) |
|---|
| 1607 | +{ |
|---|
| 1608 | + uint32_t tg_inst = 0; |
|---|
| 1609 | + struct dce110_stream_encoder *enc110 = DCE110STRENC_FROM_STRENC(enc); |
|---|
| 1610 | + |
|---|
| 1611 | + REG_GET(DIG_FE_CNTL, DIG_SOURCE_SELECT, &tg_inst); |
|---|
| 1612 | + |
|---|
| 1613 | + return tg_inst; |
|---|
| 1614 | +} |
|---|
| 1559 | 1615 | |
|---|
| 1560 | 1616 | static const struct stream_encoder_funcs dce110_str_enc_funcs = { |
|---|
| 1561 | 1617 | .dp_set_stream_attribute = |
|---|
| .. | .. |
|---|
| 1564 | 1620 | dce110_stream_encoder_hdmi_set_stream_attribute, |
|---|
| 1565 | 1621 | .dvi_set_stream_attribute = |
|---|
| 1566 | 1622 | dce110_stream_encoder_dvi_set_stream_attribute, |
|---|
| 1567 | | - .set_mst_bandwidth = |
|---|
| 1568 | | - dce110_stream_encoder_set_mst_bandwidth, |
|---|
| 1623 | + .lvds_set_stream_attribute = |
|---|
| 1624 | + dce110_stream_encoder_lvds_set_stream_attribute, |
|---|
| 1625 | + .set_throttled_vcp_size = |
|---|
| 1626 | + dce110_stream_encoder_set_throttled_vcp_size, |
|---|
| 1569 | 1627 | .update_hdmi_info_packets = |
|---|
| 1570 | 1628 | dce110_stream_encoder_update_hdmi_info_packets, |
|---|
| 1571 | 1629 | .stop_hdmi_info_packets = |
|---|
| .. | .. |
|---|
| 1588 | 1646 | .hdmi_audio_disable = dce110_se_hdmi_audio_disable, |
|---|
| 1589 | 1647 | .setup_stereo_sync = setup_stereo_sync, |
|---|
| 1590 | 1648 | .set_avmute = dce110_stream_encoder_set_avmute, |
|---|
| 1591 | | - |
|---|
| 1649 | + .dig_connect_to_otg = dig_connect_to_otg, |
|---|
| 1650 | + .hdmi_reset_stream_attribute = dce110_reset_hdmi_stream_attribute, |
|---|
| 1651 | + .dig_source_otg = dig_source_otg, |
|---|
| 1592 | 1652 | }; |
|---|
| 1593 | 1653 | |
|---|
| 1594 | 1654 | void dce110_stream_encoder_construct( |
|---|