| .. | .. |
|---|
| 22 | 22 | * Authors: AMD |
|---|
| 23 | 23 | * |
|---|
| 24 | 24 | */ |
|---|
| 25 | + |
|---|
| 26 | +#include <linux/slab.h> |
|---|
| 27 | + |
|---|
| 25 | 28 | #include "dm_services.h" |
|---|
| 26 | 29 | |
|---|
| 27 | 30 | #include "link_encoder.h" |
|---|
| .. | .. |
|---|
| 35 | 38 | #include "irq/dce110/irq_service_dce110.h" |
|---|
| 36 | 39 | #include "dce/dce_link_encoder.h" |
|---|
| 37 | 40 | #include "dce/dce_stream_encoder.h" |
|---|
| 38 | | - |
|---|
| 39 | 41 | #include "dce/dce_mem_input.h" |
|---|
| 40 | 42 | #include "dce/dce_ipp.h" |
|---|
| 41 | 43 | #include "dce/dce_transform.h" |
|---|
| 42 | 44 | #include "dce/dce_opp.h" |
|---|
| 43 | | -#include "dce/dce_clocks.h" |
|---|
| 44 | 45 | #include "dce/dce_clock_source.h" |
|---|
| 45 | 46 | #include "dce/dce_audio.h" |
|---|
| 46 | 47 | #include "dce/dce_hwseq.h" |
|---|
| 47 | 48 | #include "dce100/dce100_hw_sequencer.h" |
|---|
| 49 | +#include "dce/dce_panel_cntl.h" |
|---|
| 48 | 50 | |
|---|
| 49 | 51 | #include "reg_helper.h" |
|---|
| 50 | 52 | |
|---|
| .. | .. |
|---|
| 54 | 56 | #include "dce/dce_dmcu.h" |
|---|
| 55 | 57 | #include "dce/dce_aux.h" |
|---|
| 56 | 58 | #include "dce/dce_abm.h" |
|---|
| 59 | +#include "dce/dce_i2c.h" |
|---|
| 57 | 60 | |
|---|
| 58 | 61 | #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT |
|---|
| 59 | 62 | #include "gmc/gmc_8_2_d.h" |
|---|
| .. | .. |
|---|
| 75 | 78 | |
|---|
| 76 | 79 | #ifndef mmBIOS_SCRATCH_2 |
|---|
| 77 | 80 | #define mmBIOS_SCRATCH_2 0x05CB |
|---|
| 81 | + #define mmBIOS_SCRATCH_3 0x05CC |
|---|
| 78 | 82 | #define mmBIOS_SCRATCH_6 0x05CF |
|---|
| 79 | 83 | #endif |
|---|
| 80 | 84 | |
|---|
| .. | .. |
|---|
| 134 | 138 | /* set register offset with instance */ |
|---|
| 135 | 139 | #define SRI(reg_name, block, id)\ |
|---|
| 136 | 140 | .reg_name = mm ## block ## id ## _ ## reg_name |
|---|
| 137 | | - |
|---|
| 138 | | - |
|---|
| 139 | | -static const struct dccg_registers disp_clk_regs = { |
|---|
| 140 | | - CLK_COMMON_REG_LIST_DCE_BASE() |
|---|
| 141 | | -}; |
|---|
| 142 | | - |
|---|
| 143 | | -static const struct dccg_shift disp_clk_shift = { |
|---|
| 144 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) |
|---|
| 145 | | -}; |
|---|
| 146 | | - |
|---|
| 147 | | -static const struct dccg_mask disp_clk_mask = { |
|---|
| 148 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) |
|---|
| 149 | | -}; |
|---|
| 150 | 141 | |
|---|
| 151 | 142 | #define ipp_regs(id)\ |
|---|
| 152 | 143 | [id] = {\ |
|---|
| .. | .. |
|---|
| 259 | 250 | SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK) |
|---|
| 260 | 251 | }; |
|---|
| 261 | 252 | |
|---|
| 253 | +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { |
|---|
| 254 | + { DCE_PANEL_CNTL_REG_LIST() } |
|---|
| 255 | +}; |
|---|
| 256 | + |
|---|
| 257 | +static const struct dce_panel_cntl_shift panel_cntl_shift = { |
|---|
| 258 | + DCE_PANEL_CNTL_MASK_SH_LIST(__SHIFT) |
|---|
| 259 | +}; |
|---|
| 260 | + |
|---|
| 261 | +static const struct dce_panel_cntl_mask panel_cntl_mask = { |
|---|
| 262 | + DCE_PANEL_CNTL_MASK_SH_LIST(_MASK) |
|---|
| 263 | +}; |
|---|
| 264 | + |
|---|
| 262 | 265 | #define opp_regs(id)\ |
|---|
| 263 | 266 | [id] = {\ |
|---|
| 264 | 267 | OPP_DCE_100_REG_LIST(id),\ |
|---|
| .. | .. |
|---|
| 314 | 317 | AUD_COMMON_MASK_SH_LIST(__SHIFT) |
|---|
| 315 | 318 | }; |
|---|
| 316 | 319 | |
|---|
| 317 | | -static const struct dce_aduio_mask audio_mask = { |
|---|
| 320 | +static const struct dce_audio_mask audio_mask = { |
|---|
| 318 | 321 | AUD_COMMON_MASK_SH_LIST(_MASK) |
|---|
| 319 | 322 | }; |
|---|
| 320 | 323 | |
|---|
| .. | .. |
|---|
| 364 | 367 | #define DCFE_MEM_PWR_CTRL_REG_BASE 0x1b03 |
|---|
| 365 | 368 | |
|---|
| 366 | 369 | static const struct bios_registers bios_regs = { |
|---|
| 370 | + .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3, |
|---|
| 367 | 371 | .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6 |
|---|
| 368 | 372 | }; |
|---|
| 369 | 373 | |
|---|
| .. | .. |
|---|
| 371 | 375 | .num_timing_generator = 6, |
|---|
| 372 | 376 | .num_audio = 6, |
|---|
| 373 | 377 | .num_stream_encoder = 6, |
|---|
| 374 | | - .num_pll = 3 |
|---|
| 378 | + .num_pll = 3, |
|---|
| 379 | + .num_ddc = 6, |
|---|
| 380 | +}; |
|---|
| 381 | + |
|---|
| 382 | +static const struct dc_plane_cap plane_cap = { |
|---|
| 383 | + .type = DC_PLANE_TYPE_DCE_RGB, |
|---|
| 384 | + |
|---|
| 385 | + .pixel_format_support = { |
|---|
| 386 | + .argb8888 = true, |
|---|
| 387 | + .nv12 = false, |
|---|
| 388 | + .fp16 = false |
|---|
| 389 | + }, |
|---|
| 390 | + |
|---|
| 391 | + .max_upscale_factor = { |
|---|
| 392 | + .argb8888 = 16000, |
|---|
| 393 | + .nv12 = 1, |
|---|
| 394 | + .fp16 = 1 |
|---|
| 395 | + }, |
|---|
| 396 | + |
|---|
| 397 | + .max_downscale_factor = { |
|---|
| 398 | + .argb8888 = 250, |
|---|
| 399 | + .nv12 = 1, |
|---|
| 400 | + .fp16 = 1 |
|---|
| 401 | + } |
|---|
| 375 | 402 | }; |
|---|
| 376 | 403 | |
|---|
| 377 | 404 | #define CTX ctx |
|---|
| .. | .. |
|---|
| 384 | 411 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700 |
|---|
| 385 | 412 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8 |
|---|
| 386 | 413 | #endif |
|---|
| 414 | + |
|---|
| 415 | +static int map_transmitter_id_to_phy_instance( |
|---|
| 416 | + enum transmitter transmitter) |
|---|
| 417 | +{ |
|---|
| 418 | + switch (transmitter) { |
|---|
| 419 | + case TRANSMITTER_UNIPHY_A: |
|---|
| 420 | + return 0; |
|---|
| 421 | + break; |
|---|
| 422 | + case TRANSMITTER_UNIPHY_B: |
|---|
| 423 | + return 1; |
|---|
| 424 | + break; |
|---|
| 425 | + case TRANSMITTER_UNIPHY_C: |
|---|
| 426 | + return 2; |
|---|
| 427 | + break; |
|---|
| 428 | + case TRANSMITTER_UNIPHY_D: |
|---|
| 429 | + return 3; |
|---|
| 430 | + break; |
|---|
| 431 | + case TRANSMITTER_UNIPHY_E: |
|---|
| 432 | + return 4; |
|---|
| 433 | + break; |
|---|
| 434 | + case TRANSMITTER_UNIPHY_F: |
|---|
| 435 | + return 5; |
|---|
| 436 | + break; |
|---|
| 437 | + case TRANSMITTER_UNIPHY_G: |
|---|
| 438 | + return 6; |
|---|
| 439 | + break; |
|---|
| 440 | + default: |
|---|
| 441 | + ASSERT(0); |
|---|
| 442 | + return 0; |
|---|
| 443 | + } |
|---|
| 444 | +} |
|---|
| 387 | 445 | |
|---|
| 388 | 446 | static void read_dce_straps( |
|---|
| 389 | 447 | struct dc_context *ctx, |
|---|
| .. | .. |
|---|
| 492 | 550 | .ENABLE = MC_HUB_RDREQ_DMIF_LIMIT__ENABLE_MASK |
|---|
| 493 | 551 | }; |
|---|
| 494 | 552 | |
|---|
| 553 | +static const struct dce110_aux_registers_shift aux_shift = { |
|---|
| 554 | + DCE10_AUX_MASK_SH_LIST(__SHIFT) |
|---|
| 555 | +}; |
|---|
| 556 | + |
|---|
| 557 | +static const struct dce110_aux_registers_mask aux_mask = { |
|---|
| 558 | + DCE10_AUX_MASK_SH_LIST(_MASK) |
|---|
| 559 | +}; |
|---|
| 560 | + |
|---|
| 495 | 561 | static struct mem_input *dce100_mem_input_create( |
|---|
| 496 | 562 | struct dc_context *ctx, |
|---|
| 497 | 563 | uint32_t inst) |
|---|
| .. | .. |
|---|
| 549 | 615 | .max_hdmi_deep_color = COLOR_DEPTH_121212, |
|---|
| 550 | 616 | .max_hdmi_pixel_clock = 300000, |
|---|
| 551 | 617 | .flags.bits.IS_HBR2_CAPABLE = true, |
|---|
| 552 | | - .flags.bits.IS_TPS3_CAPABLE = true, |
|---|
| 553 | | - .flags.bits.IS_YCBCR_CAPABLE = true |
|---|
| 618 | + .flags.bits.IS_TPS3_CAPABLE = true |
|---|
| 554 | 619 | }; |
|---|
| 555 | 620 | |
|---|
| 556 | 621 | struct link_encoder *dce100_link_encoder_create( |
|---|
| .. | .. |
|---|
| 558 | 623 | { |
|---|
| 559 | 624 | struct dce110_link_encoder *enc110 = |
|---|
| 560 | 625 | kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); |
|---|
| 626 | + int link_regs_id; |
|---|
| 561 | 627 | |
|---|
| 562 | 628 | if (!enc110) |
|---|
| 563 | 629 | return NULL; |
|---|
| 564 | 630 | |
|---|
| 631 | + link_regs_id = |
|---|
| 632 | + map_transmitter_id_to_phy_instance(enc_init_data->transmitter); |
|---|
| 633 | + |
|---|
| 565 | 634 | dce110_link_encoder_construct(enc110, |
|---|
| 566 | 635 | enc_init_data, |
|---|
| 567 | 636 | &link_enc_feature, |
|---|
| 568 | | - &link_enc_regs[enc_init_data->transmitter], |
|---|
| 637 | + &link_enc_regs[link_regs_id], |
|---|
| 569 | 638 | &link_enc_aux_regs[enc_init_data->channel - 1], |
|---|
| 570 | 639 | &link_enc_hpd_regs[enc_init_data->hpd_source]); |
|---|
| 571 | 640 | return &enc110->base; |
|---|
| 641 | +} |
|---|
| 642 | + |
|---|
| 643 | +static struct panel_cntl *dce100_panel_cntl_create(const struct panel_cntl_init_data *init_data) |
|---|
| 644 | +{ |
|---|
| 645 | + struct dce_panel_cntl *panel_cntl = |
|---|
| 646 | + kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); |
|---|
| 647 | + |
|---|
| 648 | + if (!panel_cntl) |
|---|
| 649 | + return NULL; |
|---|
| 650 | + |
|---|
| 651 | + dce_panel_cntl_construct(panel_cntl, |
|---|
| 652 | + init_data, |
|---|
| 653 | + &panel_cntl_regs[init_data->inst], |
|---|
| 654 | + &panel_cntl_shift, |
|---|
| 655 | + &panel_cntl_mask); |
|---|
| 656 | + |
|---|
| 657 | + return &panel_cntl->base; |
|---|
| 572 | 658 | } |
|---|
| 573 | 659 | |
|---|
| 574 | 660 | struct output_pixel_processor *dce100_opp_create( |
|---|
| .. | .. |
|---|
| 586 | 672 | return &opp->base; |
|---|
| 587 | 673 | } |
|---|
| 588 | 674 | |
|---|
| 589 | | -struct aux_engine *dce100_aux_engine_create( |
|---|
| 675 | +struct dce_aux *dce100_aux_engine_create( |
|---|
| 590 | 676 | struct dc_context *ctx, |
|---|
| 591 | 677 | uint32_t inst) |
|---|
| 592 | 678 | { |
|---|
| .. | .. |
|---|
| 598 | 684 | |
|---|
| 599 | 685 | dce110_aux_engine_construct(aux_engine, ctx, inst, |
|---|
| 600 | 686 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD, |
|---|
| 601 | | - &aux_engine_regs[inst]); |
|---|
| 687 | + &aux_engine_regs[inst], |
|---|
| 688 | + &aux_mask, |
|---|
| 689 | + &aux_shift, |
|---|
| 690 | + ctx->dc->caps.extended_aux_timeout_support); |
|---|
| 602 | 691 | |
|---|
| 603 | 692 | return &aux_engine->base; |
|---|
| 604 | 693 | } |
|---|
| 694 | +#define i2c_inst_regs(id) { I2C_HW_ENGINE_COMMON_REG_LIST(id) } |
|---|
| 605 | 695 | |
|---|
| 696 | +static const struct dce_i2c_registers i2c_hw_regs[] = { |
|---|
| 697 | + i2c_inst_regs(1), |
|---|
| 698 | + i2c_inst_regs(2), |
|---|
| 699 | + i2c_inst_regs(3), |
|---|
| 700 | + i2c_inst_regs(4), |
|---|
| 701 | + i2c_inst_regs(5), |
|---|
| 702 | + i2c_inst_regs(6), |
|---|
| 703 | +}; |
|---|
| 704 | + |
|---|
| 705 | +static const struct dce_i2c_shift i2c_shifts = { |
|---|
| 706 | + I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) |
|---|
| 707 | +}; |
|---|
| 708 | + |
|---|
| 709 | +static const struct dce_i2c_mask i2c_masks = { |
|---|
| 710 | + I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) |
|---|
| 711 | +}; |
|---|
| 712 | + |
|---|
| 713 | +struct dce_i2c_hw *dce100_i2c_hw_create( |
|---|
| 714 | + struct dc_context *ctx, |
|---|
| 715 | + uint32_t inst) |
|---|
| 716 | +{ |
|---|
| 717 | + struct dce_i2c_hw *dce_i2c_hw = |
|---|
| 718 | + kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); |
|---|
| 719 | + |
|---|
| 720 | + if (!dce_i2c_hw) |
|---|
| 721 | + return NULL; |
|---|
| 722 | + |
|---|
| 723 | + dce100_i2c_hw_construct(dce_i2c_hw, ctx, inst, |
|---|
| 724 | + &i2c_hw_regs[inst], &i2c_shifts, &i2c_masks); |
|---|
| 725 | + |
|---|
| 726 | + return dce_i2c_hw; |
|---|
| 727 | +} |
|---|
| 606 | 728 | struct clock_source *dce100_clock_source_create( |
|---|
| 607 | 729 | struct dc_context *ctx, |
|---|
| 608 | 730 | struct dc_bios *bios, |
|---|
| .. | .. |
|---|
| 622 | 744 | return &clk_src->base; |
|---|
| 623 | 745 | } |
|---|
| 624 | 746 | |
|---|
| 747 | + kfree(clk_src); |
|---|
| 625 | 748 | BREAK_TO_DEBUGGER(); |
|---|
| 626 | 749 | return NULL; |
|---|
| 627 | 750 | } |
|---|
| .. | .. |
|---|
| 632 | 755 | *clk_src = NULL; |
|---|
| 633 | 756 | } |
|---|
| 634 | 757 | |
|---|
| 635 | | -static void destruct(struct dce110_resource_pool *pool) |
|---|
| 758 | +static void dce100_resource_destruct(struct dce110_resource_pool *pool) |
|---|
| 636 | 759 | { |
|---|
| 637 | 760 | unsigned int i; |
|---|
| 638 | 761 | |
|---|
| .. | .. |
|---|
| 655 | 778 | kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i])); |
|---|
| 656 | 779 | pool->base.timing_generators[i] = NULL; |
|---|
| 657 | 780 | } |
|---|
| 781 | + } |
|---|
| 658 | 782 | |
|---|
| 783 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
|---|
| 659 | 784 | if (pool->base.engines[i] != NULL) |
|---|
| 660 | 785 | dce110_engine_destroy(&pool->base.engines[i]); |
|---|
| 661 | | - |
|---|
| 786 | + if (pool->base.hw_i2cs[i] != NULL) { |
|---|
| 787 | + kfree(pool->base.hw_i2cs[i]); |
|---|
| 788 | + pool->base.hw_i2cs[i] = NULL; |
|---|
| 789 | + } |
|---|
| 790 | + if (pool->base.sw_i2cs[i] != NULL) { |
|---|
| 791 | + kfree(pool->base.sw_i2cs[i]); |
|---|
| 792 | + pool->base.sw_i2cs[i] = NULL; |
|---|
| 793 | + } |
|---|
| 662 | 794 | } |
|---|
| 663 | 795 | |
|---|
| 664 | 796 | for (i = 0; i < pool->base.stream_enc_count; i++) { |
|---|
| .. | .. |
|---|
| 678 | 810 | if (pool->base.audios[i] != NULL) |
|---|
| 679 | 811 | dce_aud_destroy(&pool->base.audios[i]); |
|---|
| 680 | 812 | } |
|---|
| 681 | | - |
|---|
| 682 | | - if (pool->base.dccg != NULL) |
|---|
| 683 | | - dce_dccg_destroy(&pool->base.dccg); |
|---|
| 684 | 813 | |
|---|
| 685 | 814 | if (pool->base.abm != NULL) |
|---|
| 686 | 815 | dce_abm_destroy(&pool->base.abm); |
|---|
| .. | .. |
|---|
| 711 | 840 | |
|---|
| 712 | 841 | bool dce100_validate_bandwidth( |
|---|
| 713 | 842 | struct dc *dc, |
|---|
| 714 | | - struct dc_state *context) |
|---|
| 843 | + struct dc_state *context, |
|---|
| 844 | + bool fast_validate) |
|---|
| 715 | 845 | { |
|---|
| 716 | 846 | int i; |
|---|
| 717 | 847 | bool at_least_one_pipe = false; |
|---|
| .. | .. |
|---|
| 723 | 853 | |
|---|
| 724 | 854 | if (at_least_one_pipe) { |
|---|
| 725 | 855 | /* TODO implement when needed but for now hardcode max value*/ |
|---|
| 726 | | - context->bw.dce.dispclk_khz = 681000; |
|---|
| 727 | | - context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER; |
|---|
| 856 | + context->bw_ctx.bw.dce.dispclk_khz = 681000; |
|---|
| 857 | + context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; |
|---|
| 728 | 858 | } else { |
|---|
| 729 | | - context->bw.dce.dispclk_khz = 0; |
|---|
| 730 | | - context->bw.dce.yclk_khz = 0; |
|---|
| 859 | + context->bw_ctx.bw.dce.dispclk_khz = 0; |
|---|
| 860 | + context->bw_ctx.bw.dce.yclk_khz = 0; |
|---|
| 731 | 861 | } |
|---|
| 732 | 862 | |
|---|
| 733 | 863 | return true; |
|---|
| .. | .. |
|---|
| 785 | 915 | { |
|---|
| 786 | 916 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
|---|
| 787 | 917 | |
|---|
| 788 | | - destruct(dce110_pool); |
|---|
| 918 | + dce100_resource_destruct(dce110_pool); |
|---|
| 789 | 919 | kfree(dce110_pool); |
|---|
| 790 | 920 | *pool = NULL; |
|---|
| 791 | 921 | } |
|---|
| .. | .. |
|---|
| 799 | 929 | return DC_FAIL_SURFACE_VALIDATE; |
|---|
| 800 | 930 | } |
|---|
| 801 | 931 | |
|---|
| 932 | +struct stream_encoder *dce100_find_first_free_match_stream_enc_for_link( |
|---|
| 933 | + struct resource_context *res_ctx, |
|---|
| 934 | + const struct resource_pool *pool, |
|---|
| 935 | + struct dc_stream_state *stream) |
|---|
| 936 | +{ |
|---|
| 937 | + int i; |
|---|
| 938 | + int j = -1; |
|---|
| 939 | + struct dc_link *link = stream->link; |
|---|
| 940 | + |
|---|
| 941 | + for (i = 0; i < pool->stream_enc_count; i++) { |
|---|
| 942 | + if (!res_ctx->is_stream_enc_acquired[i] && |
|---|
| 943 | + pool->stream_enc[i]) { |
|---|
| 944 | + /* Store first available for MST second display |
|---|
| 945 | + * in daisy chain use case |
|---|
| 946 | + */ |
|---|
| 947 | + j = i; |
|---|
| 948 | + if (pool->stream_enc[i]->id == |
|---|
| 949 | + link->link_enc->preferred_engine) |
|---|
| 950 | + return pool->stream_enc[i]; |
|---|
| 951 | + } |
|---|
| 952 | + } |
|---|
| 953 | + |
|---|
| 954 | + /* |
|---|
| 955 | + * below can happen in cases when stream encoder is acquired: |
|---|
| 956 | + * 1) for second MST display in chain, so preferred engine already |
|---|
| 957 | + * acquired; |
|---|
| 958 | + * 2) for another link, which preferred engine already acquired by any |
|---|
| 959 | + * MST configuration. |
|---|
| 960 | + * |
|---|
| 961 | + * If signal is of DP type and preferred engine not found, return last available |
|---|
| 962 | + * |
|---|
| 963 | + * TODO - This is just a patch up and a generic solution is |
|---|
| 964 | + * required for non DP connectors. |
|---|
| 965 | + */ |
|---|
| 966 | + |
|---|
| 967 | + if (j >= 0 && link->connector_signal == SIGNAL_TYPE_DISPLAY_PORT) |
|---|
| 968 | + return pool->stream_enc[j]; |
|---|
| 969 | + |
|---|
| 970 | + return NULL; |
|---|
| 971 | +} |
|---|
| 972 | + |
|---|
| 802 | 973 | static const struct resource_funcs dce100_res_pool_funcs = { |
|---|
| 803 | 974 | .destroy = dce100_destroy_resource_pool, |
|---|
| 804 | 975 | .link_enc_create = dce100_link_encoder_create, |
|---|
| 976 | + .panel_cntl_create = dce100_panel_cntl_create, |
|---|
| 805 | 977 | .validate_bandwidth = dce100_validate_bandwidth, |
|---|
| 806 | 978 | .validate_plane = dce100_validate_plane, |
|---|
| 807 | 979 | .add_stream_to_ctx = dce100_add_stream_to_ctx, |
|---|
| 808 | | - .validate_global = dce100_validate_global |
|---|
| 980 | + .validate_global = dce100_validate_global, |
|---|
| 981 | + .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link |
|---|
| 809 | 982 | }; |
|---|
| 810 | 983 | |
|---|
| 811 | | -static bool construct( |
|---|
| 984 | +static bool dce100_resource_construct( |
|---|
| 812 | 985 | uint8_t num_virtual_links, |
|---|
| 813 | 986 | struct dc *dc, |
|---|
| 814 | 987 | struct dce110_resource_pool *pool) |
|---|
| 815 | 988 | { |
|---|
| 816 | 989 | unsigned int i; |
|---|
| 817 | 990 | struct dc_context *ctx = dc->ctx; |
|---|
| 818 | | - struct dc_firmware_info info; |
|---|
| 819 | 991 | struct dc_bios *bp; |
|---|
| 820 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
|---|
| 821 | 992 | |
|---|
| 822 | 993 | ctx->dc_bios->regs = &bios_regs; |
|---|
| 823 | 994 | |
|---|
| .. | .. |
|---|
| 827 | 998 | |
|---|
| 828 | 999 | bp = ctx->dc_bios; |
|---|
| 829 | 1000 | |
|---|
| 830 | | - if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) && |
|---|
| 831 | | - info.external_clock_source_frequency_for_dp != 0) { |
|---|
| 1001 | + if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { |
|---|
| 832 | 1002 | pool->base.dp_clock_source = |
|---|
| 833 | 1003 | dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); |
|---|
| 834 | 1004 | |
|---|
| .. | .. |
|---|
| 865 | 1035 | } |
|---|
| 866 | 1036 | } |
|---|
| 867 | 1037 | |
|---|
| 868 | | - pool->base.dccg = dce_dccg_create(ctx, |
|---|
| 869 | | - &disp_clk_regs, |
|---|
| 870 | | - &disp_clk_shift, |
|---|
| 871 | | - &disp_clk_mask); |
|---|
| 872 | | - if (pool->base.dccg == NULL) { |
|---|
| 873 | | - dm_error("DC: failed to create display clock!\n"); |
|---|
| 874 | | - BREAK_TO_DEBUGGER(); |
|---|
| 875 | | - goto res_create_fail; |
|---|
| 876 | | - } |
|---|
| 877 | | - |
|---|
| 878 | 1038 | pool->base.dmcu = dce_dmcu_create(ctx, |
|---|
| 879 | 1039 | &dmcu_regs, |
|---|
| 880 | 1040 | &dmcu_shift, |
|---|
| .. | .. |
|---|
| 895 | 1055 | goto res_create_fail; |
|---|
| 896 | 1056 | } |
|---|
| 897 | 1057 | |
|---|
| 898 | | - /* get static clock information for PPLIB or firmware, save |
|---|
| 899 | | - * max_clock_state |
|---|
| 900 | | - */ |
|---|
| 901 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
|---|
| 902 | | - pool->base.dccg->max_clks_state = |
|---|
| 903 | | - static_clk_info.max_clocks_state; |
|---|
| 904 | 1058 | { |
|---|
| 905 | 1059 | struct irq_service_init_data init_data; |
|---|
| 906 | 1060 | init_data.ctx = dc->ctx; |
|---|
| .. | .. |
|---|
| 920 | 1074 | dc->caps.max_cursor_size = 128; |
|---|
| 921 | 1075 | dc->caps.dual_link_dvi = true; |
|---|
| 922 | 1076 | dc->caps.disable_dp_clk_share = true; |
|---|
| 1077 | + dc->caps.extended_aux_timeout_support = false; |
|---|
| 1078 | + |
|---|
| 923 | 1079 | for (i = 0; i < pool->base.pipe_count; i++) { |
|---|
| 924 | 1080 | pool->base.timing_generators[i] = |
|---|
| 925 | 1081 | dce100_timing_generator_create( |
|---|
| .. | .. |
|---|
| 963 | 1119 | "DC: failed to create output pixel processor!\n"); |
|---|
| 964 | 1120 | goto res_create_fail; |
|---|
| 965 | 1121 | } |
|---|
| 1122 | + } |
|---|
| 1123 | + |
|---|
| 1124 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
|---|
| 966 | 1125 | pool->base.engines[i] = dce100_aux_engine_create(ctx, i); |
|---|
| 967 | 1126 | if (pool->base.engines[i] == NULL) { |
|---|
| 968 | 1127 | BREAK_TO_DEBUGGER(); |
|---|
| .. | .. |
|---|
| 970 | 1129 | "DC:failed to create aux engine!!\n"); |
|---|
| 971 | 1130 | goto res_create_fail; |
|---|
| 972 | 1131 | } |
|---|
| 1132 | + pool->base.hw_i2cs[i] = dce100_i2c_hw_create(ctx, i); |
|---|
| 1133 | + if (pool->base.hw_i2cs[i] == NULL) { |
|---|
| 1134 | + BREAK_TO_DEBUGGER(); |
|---|
| 1135 | + dm_error( |
|---|
| 1136 | + "DC:failed to create i2c engine!!\n"); |
|---|
| 1137 | + goto res_create_fail; |
|---|
| 1138 | + } |
|---|
| 1139 | + pool->base.sw_i2cs[i] = NULL; |
|---|
| 973 | 1140 | } |
|---|
| 974 | 1141 | |
|---|
| 975 | 1142 | dc->caps.max_planes = pool->base.pipe_count; |
|---|
| 1143 | + |
|---|
| 1144 | + for (i = 0; i < dc->caps.max_planes; ++i) |
|---|
| 1145 | + dc->caps.planes[i] = plane_cap; |
|---|
| 976 | 1146 | |
|---|
| 977 | 1147 | if (!resource_construct(num_virtual_links, dc, &pool->base, |
|---|
| 978 | 1148 | &res_create_funcs)) |
|---|
| .. | .. |
|---|
| 983 | 1153 | return true; |
|---|
| 984 | 1154 | |
|---|
| 985 | 1155 | res_create_fail: |
|---|
| 986 | | - destruct(pool); |
|---|
| 1156 | + dce100_resource_destruct(pool); |
|---|
| 987 | 1157 | |
|---|
| 988 | 1158 | return false; |
|---|
| 989 | 1159 | } |
|---|
| .. | .. |
|---|
| 998 | 1168 | if (!pool) |
|---|
| 999 | 1169 | return NULL; |
|---|
| 1000 | 1170 | |
|---|
| 1001 | | - if (construct(num_virtual_links, dc, pool)) |
|---|
| 1171 | + if (dce100_resource_construct(num_virtual_links, dc, pool)) |
|---|
| 1002 | 1172 | return &pool->base; |
|---|
| 1003 | 1173 | |
|---|
| 1004 | 1174 | kfree(pool); |
|---|