| .. | .. |
|---|
| 23 | 23 | * |
|---|
| 24 | 24 | */ |
|---|
| 25 | 25 | |
|---|
| 26 | +#include <linux/slab.h> |
|---|
| 27 | + |
|---|
| 26 | 28 | #include "dm_services.h" |
|---|
| 27 | 29 | |
|---|
| 28 | 30 | #include "link_encoder.h" |
|---|
| .. | .. |
|---|
| 34 | 36 | #include "dce110/dce110_timing_generator.h" |
|---|
| 35 | 37 | |
|---|
| 36 | 38 | #include "irq/dce110/irq_service_dce110.h" |
|---|
| 37 | | - |
|---|
| 38 | 39 | #include "dce/dce_mem_input.h" |
|---|
| 39 | 40 | #include "dce/dce_transform.h" |
|---|
| 40 | 41 | #include "dce/dce_link_encoder.h" |
|---|
| .. | .. |
|---|
| 42 | 43 | #include "dce/dce_audio.h" |
|---|
| 43 | 44 | #include "dce/dce_opp.h" |
|---|
| 44 | 45 | #include "dce/dce_ipp.h" |
|---|
| 45 | | -#include "dce/dce_clocks.h" |
|---|
| 46 | 46 | #include "dce/dce_clock_source.h" |
|---|
| 47 | 47 | |
|---|
| 48 | 48 | #include "dce/dce_hwseq.h" |
|---|
| .. | .. |
|---|
| 50 | 50 | #include "dce/dce_abm.h" |
|---|
| 51 | 51 | #include "dce/dce_dmcu.h" |
|---|
| 52 | 52 | #include "dce/dce_aux.h" |
|---|
| 53 | +#include "dce/dce_i2c.h" |
|---|
| 54 | +#include "dce/dce_panel_cntl.h" |
|---|
| 53 | 55 | |
|---|
| 54 | 56 | #include "reg_helper.h" |
|---|
| 55 | 57 | |
|---|
| .. | .. |
|---|
| 75 | 77 | |
|---|
| 76 | 78 | #ifndef mmBIOS_SCRATCH_2 |
|---|
| 77 | 79 | #define mmBIOS_SCRATCH_2 0x05CB |
|---|
| 80 | + #define mmBIOS_SCRATCH_3 0x05CC |
|---|
| 78 | 81 | #define mmBIOS_SCRATCH_6 0x05CF |
|---|
| 79 | 82 | #endif |
|---|
| 80 | 83 | |
|---|
| .. | .. |
|---|
| 146 | 149 | #define SRI(reg_name, block, id)\ |
|---|
| 147 | 150 | .reg_name = mm ## block ## id ## _ ## reg_name |
|---|
| 148 | 151 | |
|---|
| 149 | | - |
|---|
| 150 | | -static const struct dccg_registers disp_clk_regs = { |
|---|
| 151 | | - CLK_COMMON_REG_LIST_DCE_BASE() |
|---|
| 152 | | -}; |
|---|
| 153 | | - |
|---|
| 154 | | -static const struct dccg_shift disp_clk_shift = { |
|---|
| 155 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) |
|---|
| 156 | | -}; |
|---|
| 157 | | - |
|---|
| 158 | | -static const struct dccg_mask disp_clk_mask = { |
|---|
| 159 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) |
|---|
| 160 | | -}; |
|---|
| 161 | | - |
|---|
| 162 | 152 | static const struct dce_dmcu_registers dmcu_regs = { |
|---|
| 163 | 153 | DMCU_DCE110_COMMON_REG_LIST() |
|---|
| 164 | 154 | }; |
|---|
| .. | .. |
|---|
| 181 | 171 | |
|---|
| 182 | 172 | static const struct dce_abm_mask abm_mask = { |
|---|
| 183 | 173 | ABM_MASK_SH_LIST_DCE110(_MASK) |
|---|
| 174 | +}; |
|---|
| 175 | + |
|---|
| 176 | +static const struct dce110_aux_registers_shift aux_shift = { |
|---|
| 177 | + DCE_AUX_MASK_SH_LIST(__SHIFT) |
|---|
| 178 | +}; |
|---|
| 179 | + |
|---|
| 180 | +static const struct dce110_aux_registers_mask aux_mask = { |
|---|
| 181 | + DCE_AUX_MASK_SH_LIST(_MASK) |
|---|
| 184 | 182 | }; |
|---|
| 185 | 183 | |
|---|
| 186 | 184 | #define ipp_regs(id)\ |
|---|
| .. | .. |
|---|
| 239 | 237 | aux_regs(3), |
|---|
| 240 | 238 | aux_regs(4), |
|---|
| 241 | 239 | aux_regs(5) |
|---|
| 240 | +}; |
|---|
| 241 | + |
|---|
| 242 | +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { |
|---|
| 243 | + { DCE_PANEL_CNTL_REG_LIST() } |
|---|
| 244 | +}; |
|---|
| 245 | + |
|---|
| 246 | +static const struct dce_panel_cntl_shift panel_cntl_shift = { |
|---|
| 247 | + DCE_PANEL_CNTL_MASK_SH_LIST(__SHIFT) |
|---|
| 248 | +}; |
|---|
| 249 | + |
|---|
| 250 | +static const struct dce_panel_cntl_mask panel_cntl_mask = { |
|---|
| 251 | + DCE_PANEL_CNTL_MASK_SH_LIST(_MASK) |
|---|
| 242 | 252 | }; |
|---|
| 243 | 253 | |
|---|
| 244 | 254 | #define hpd_regs(id)\ |
|---|
| .. | .. |
|---|
| 348 | 358 | AUD_COMMON_MASK_SH_LIST(__SHIFT) |
|---|
| 349 | 359 | }; |
|---|
| 350 | 360 | |
|---|
| 351 | | -static const struct dce_aduio_mask audio_mask = { |
|---|
| 361 | +static const struct dce_audio_mask audio_mask = { |
|---|
| 352 | 362 | AUD_COMMON_MASK_SH_LIST(_MASK) |
|---|
| 353 | 363 | }; |
|---|
| 354 | 364 | |
|---|
| .. | .. |
|---|
| 375 | 385 | }; |
|---|
| 376 | 386 | |
|---|
| 377 | 387 | static const struct bios_registers bios_regs = { |
|---|
| 388 | + .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3, |
|---|
| 378 | 389 | .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6 |
|---|
| 379 | 390 | }; |
|---|
| 380 | 391 | |
|---|
| .. | .. |
|---|
| 383 | 394 | .num_audio = 6, |
|---|
| 384 | 395 | .num_stream_encoder = 6, |
|---|
| 385 | 396 | .num_pll = 8, /* why 8? 6 combo PHY PLL + 2 regular PLLs? */ |
|---|
| 397 | + .num_ddc = 6, |
|---|
| 386 | 398 | }; |
|---|
| 387 | 399 | |
|---|
| 388 | 400 | static const struct resource_caps polaris_11_resource_cap = { |
|---|
| .. | .. |
|---|
| 390 | 402 | .num_audio = 5, |
|---|
| 391 | 403 | .num_stream_encoder = 5, |
|---|
| 392 | 404 | .num_pll = 8, /* why 8? 6 combo PHY PLL + 2 regular PLLs? */ |
|---|
| 405 | + .num_ddc = 5, |
|---|
| 406 | +}; |
|---|
| 407 | + |
|---|
| 408 | +static const struct dc_plane_cap plane_cap = { |
|---|
| 409 | + .type = DC_PLANE_TYPE_DCE_RGB, |
|---|
| 410 | + |
|---|
| 411 | + .pixel_format_support = { |
|---|
| 412 | + .argb8888 = true, |
|---|
| 413 | + .nv12 = false, |
|---|
| 414 | + .fp16 = true |
|---|
| 415 | + }, |
|---|
| 416 | + |
|---|
| 417 | + .max_upscale_factor = { |
|---|
| 418 | + .argb8888 = 16000, |
|---|
| 419 | + .nv12 = 1, |
|---|
| 420 | + .fp16 = 1 |
|---|
| 421 | + }, |
|---|
| 422 | + |
|---|
| 423 | + .max_downscale_factor = { |
|---|
| 424 | + .argb8888 = 250, |
|---|
| 425 | + .nv12 = 1, |
|---|
| 426 | + .fp16 = 1 |
|---|
| 427 | + }, |
|---|
| 428 | + 64, |
|---|
| 429 | + 64 |
|---|
| 393 | 430 | }; |
|---|
| 394 | 431 | |
|---|
| 395 | 432 | #define CTX ctx |
|---|
| .. | .. |
|---|
| 402 | 439 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700 |
|---|
| 403 | 440 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8 |
|---|
| 404 | 441 | #endif |
|---|
| 442 | + |
|---|
| 443 | +static int map_transmitter_id_to_phy_instance( |
|---|
| 444 | + enum transmitter transmitter) |
|---|
| 445 | +{ |
|---|
| 446 | + switch (transmitter) { |
|---|
| 447 | + case TRANSMITTER_UNIPHY_A: |
|---|
| 448 | + return 0; |
|---|
| 449 | + break; |
|---|
| 450 | + case TRANSMITTER_UNIPHY_B: |
|---|
| 451 | + return 1; |
|---|
| 452 | + break; |
|---|
| 453 | + case TRANSMITTER_UNIPHY_C: |
|---|
| 454 | + return 2; |
|---|
| 455 | + break; |
|---|
| 456 | + case TRANSMITTER_UNIPHY_D: |
|---|
| 457 | + return 3; |
|---|
| 458 | + break; |
|---|
| 459 | + case TRANSMITTER_UNIPHY_E: |
|---|
| 460 | + return 4; |
|---|
| 461 | + break; |
|---|
| 462 | + case TRANSMITTER_UNIPHY_F: |
|---|
| 463 | + return 5; |
|---|
| 464 | + break; |
|---|
| 465 | + case TRANSMITTER_UNIPHY_G: |
|---|
| 466 | + return 6; |
|---|
| 467 | + break; |
|---|
| 468 | + default: |
|---|
| 469 | + ASSERT(0); |
|---|
| 470 | + return 0; |
|---|
| 471 | + } |
|---|
| 472 | +} |
|---|
| 405 | 473 | |
|---|
| 406 | 474 | static void read_dce_straps( |
|---|
| 407 | 475 | struct dc_context *ctx, |
|---|
| .. | .. |
|---|
| 548 | 616 | static const struct encoder_feature_support link_enc_feature = { |
|---|
| 549 | 617 | .max_hdmi_deep_color = COLOR_DEPTH_121212, |
|---|
| 550 | 618 | .max_hdmi_pixel_clock = 600000, |
|---|
| 551 | | - .ycbcr420_supported = true, |
|---|
| 619 | + .hdmi_ycbcr420_supported = true, |
|---|
| 620 | + .dp_ycbcr420_supported = false, |
|---|
| 552 | 621 | .flags.bits.IS_HBR2_CAPABLE = true, |
|---|
| 553 | 622 | .flags.bits.IS_HBR3_CAPABLE = true, |
|---|
| 554 | 623 | .flags.bits.IS_TPS3_CAPABLE = true, |
|---|
| 555 | | - .flags.bits.IS_TPS4_CAPABLE = true, |
|---|
| 556 | | - .flags.bits.IS_YCBCR_CAPABLE = true |
|---|
| 624 | + .flags.bits.IS_TPS4_CAPABLE = true |
|---|
| 557 | 625 | }; |
|---|
| 558 | 626 | |
|---|
| 559 | 627 | struct link_encoder *dce112_link_encoder_create( |
|---|
| .. | .. |
|---|
| 561 | 629 | { |
|---|
| 562 | 630 | struct dce110_link_encoder *enc110 = |
|---|
| 563 | 631 | kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); |
|---|
| 632 | + int link_regs_id; |
|---|
| 564 | 633 | |
|---|
| 565 | 634 | if (!enc110) |
|---|
| 566 | 635 | return NULL; |
|---|
| 567 | 636 | |
|---|
| 637 | + link_regs_id = |
|---|
| 638 | + map_transmitter_id_to_phy_instance(enc_init_data->transmitter); |
|---|
| 639 | + |
|---|
| 568 | 640 | dce110_link_encoder_construct(enc110, |
|---|
| 569 | 641 | enc_init_data, |
|---|
| 570 | 642 | &link_enc_feature, |
|---|
| 571 | | - &link_enc_regs[enc_init_data->transmitter], |
|---|
| 643 | + &link_enc_regs[link_regs_id], |
|---|
| 572 | 644 | &link_enc_aux_regs[enc_init_data->channel - 1], |
|---|
| 573 | 645 | &link_enc_hpd_regs[enc_init_data->hpd_source]); |
|---|
| 574 | 646 | return &enc110->base; |
|---|
| 647 | +} |
|---|
| 648 | + |
|---|
| 649 | +static struct panel_cntl *dce112_panel_cntl_create(const struct panel_cntl_init_data *init_data) |
|---|
| 650 | +{ |
|---|
| 651 | + struct dce_panel_cntl *panel_cntl = |
|---|
| 652 | + kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); |
|---|
| 653 | + |
|---|
| 654 | + if (!panel_cntl) |
|---|
| 655 | + return NULL; |
|---|
| 656 | + |
|---|
| 657 | + dce_panel_cntl_construct(panel_cntl, |
|---|
| 658 | + init_data, |
|---|
| 659 | + &panel_cntl_regs[init_data->inst], |
|---|
| 660 | + &panel_cntl_shift, |
|---|
| 661 | + &panel_cntl_mask); |
|---|
| 662 | + |
|---|
| 663 | + return &panel_cntl->base; |
|---|
| 575 | 664 | } |
|---|
| 576 | 665 | |
|---|
| 577 | 666 | static struct input_pixel_processor *dce112_ipp_create( |
|---|
| .. | .. |
|---|
| 604 | 693 | return &opp->base; |
|---|
| 605 | 694 | } |
|---|
| 606 | 695 | |
|---|
| 607 | | -struct aux_engine *dce112_aux_engine_create( |
|---|
| 696 | +struct dce_aux *dce112_aux_engine_create( |
|---|
| 608 | 697 | struct dc_context *ctx, |
|---|
| 609 | 698 | uint32_t inst) |
|---|
| 610 | 699 | { |
|---|
| .. | .. |
|---|
| 616 | 705 | |
|---|
| 617 | 706 | dce110_aux_engine_construct(aux_engine, ctx, inst, |
|---|
| 618 | 707 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD, |
|---|
| 619 | | - &aux_engine_regs[inst]); |
|---|
| 708 | + &aux_engine_regs[inst], |
|---|
| 709 | + &aux_mask, |
|---|
| 710 | + &aux_shift, |
|---|
| 711 | + ctx->dc->caps.extended_aux_timeout_support); |
|---|
| 620 | 712 | |
|---|
| 621 | 713 | return &aux_engine->base; |
|---|
| 622 | 714 | } |
|---|
| 715 | +#define i2c_inst_regs(id) { I2C_HW_ENGINE_COMMON_REG_LIST(id) } |
|---|
| 623 | 716 | |
|---|
| 717 | +static const struct dce_i2c_registers i2c_hw_regs[] = { |
|---|
| 718 | + i2c_inst_regs(1), |
|---|
| 719 | + i2c_inst_regs(2), |
|---|
| 720 | + i2c_inst_regs(3), |
|---|
| 721 | + i2c_inst_regs(4), |
|---|
| 722 | + i2c_inst_regs(5), |
|---|
| 723 | + i2c_inst_regs(6), |
|---|
| 724 | +}; |
|---|
| 725 | + |
|---|
| 726 | +static const struct dce_i2c_shift i2c_shifts = { |
|---|
| 727 | + I2C_COMMON_MASK_SH_LIST_DCE110(__SHIFT) |
|---|
| 728 | +}; |
|---|
| 729 | + |
|---|
| 730 | +static const struct dce_i2c_mask i2c_masks = { |
|---|
| 731 | + I2C_COMMON_MASK_SH_LIST_DCE110(_MASK) |
|---|
| 732 | +}; |
|---|
| 733 | + |
|---|
| 734 | +struct dce_i2c_hw *dce112_i2c_hw_create( |
|---|
| 735 | + struct dc_context *ctx, |
|---|
| 736 | + uint32_t inst) |
|---|
| 737 | +{ |
|---|
| 738 | + struct dce_i2c_hw *dce_i2c_hw = |
|---|
| 739 | + kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); |
|---|
| 740 | + |
|---|
| 741 | + if (!dce_i2c_hw) |
|---|
| 742 | + return NULL; |
|---|
| 743 | + |
|---|
| 744 | + dce112_i2c_hw_construct(dce_i2c_hw, ctx, inst, |
|---|
| 745 | + &i2c_hw_regs[inst], &i2c_shifts, &i2c_masks); |
|---|
| 746 | + |
|---|
| 747 | + return dce_i2c_hw; |
|---|
| 748 | +} |
|---|
| 624 | 749 | struct clock_source *dce112_clock_source_create( |
|---|
| 625 | 750 | struct dc_context *ctx, |
|---|
| 626 | 751 | struct dc_bios *bios, |
|---|
| .. | .. |
|---|
| 634 | 759 | if (!clk_src) |
|---|
| 635 | 760 | return NULL; |
|---|
| 636 | 761 | |
|---|
| 637 | | - if (dce110_clk_src_construct(clk_src, ctx, bios, id, |
|---|
| 762 | + if (dce112_clk_src_construct(clk_src, ctx, bios, id, |
|---|
| 638 | 763 | regs, &cs_shift, &cs_mask)) { |
|---|
| 639 | 764 | clk_src->base.dp_clk_src = dp_clk_src; |
|---|
| 640 | 765 | return &clk_src->base; |
|---|
| 641 | 766 | } |
|---|
| 642 | 767 | |
|---|
| 768 | + kfree(clk_src); |
|---|
| 643 | 769 | BREAK_TO_DEBUGGER(); |
|---|
| 644 | 770 | return NULL; |
|---|
| 645 | 771 | } |
|---|
| .. | .. |
|---|
| 650 | 776 | *clk_src = NULL; |
|---|
| 651 | 777 | } |
|---|
| 652 | 778 | |
|---|
| 653 | | -static void destruct(struct dce110_resource_pool *pool) |
|---|
| 779 | +static void dce112_resource_destruct(struct dce110_resource_pool *pool) |
|---|
| 654 | 780 | { |
|---|
| 655 | 781 | unsigned int i; |
|---|
| 656 | 782 | |
|---|
| 657 | 783 | for (i = 0; i < pool->base.pipe_count; i++) { |
|---|
| 658 | 784 | if (pool->base.opps[i] != NULL) |
|---|
| 659 | 785 | dce110_opp_destroy(&pool->base.opps[i]); |
|---|
| 660 | | - |
|---|
| 661 | | - if (pool->base.engines[i] != NULL) |
|---|
| 662 | | - dce110_engine_destroy(&pool->base.engines[i]); |
|---|
| 663 | 786 | |
|---|
| 664 | 787 | if (pool->base.transforms[i] != NULL) |
|---|
| 665 | 788 | dce112_transform_destroy(&pool->base.transforms[i]); |
|---|
| .. | .. |
|---|
| 676 | 799 | kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i])); |
|---|
| 677 | 800 | pool->base.timing_generators[i] = NULL; |
|---|
| 678 | 801 | } |
|---|
| 802 | + } |
|---|
| 679 | 803 | |
|---|
| 804 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
|---|
| 805 | + if (pool->base.engines[i] != NULL) |
|---|
| 806 | + dce110_engine_destroy(&pool->base.engines[i]); |
|---|
| 807 | + if (pool->base.hw_i2cs[i] != NULL) { |
|---|
| 808 | + kfree(pool->base.hw_i2cs[i]); |
|---|
| 809 | + pool->base.hw_i2cs[i] = NULL; |
|---|
| 810 | + } |
|---|
| 811 | + if (pool->base.sw_i2cs[i] != NULL) { |
|---|
| 812 | + kfree(pool->base.sw_i2cs[i]); |
|---|
| 813 | + pool->base.sw_i2cs[i] = NULL; |
|---|
| 814 | + } |
|---|
| 680 | 815 | } |
|---|
| 681 | 816 | |
|---|
| 682 | 817 | for (i = 0; i < pool->base.stream_enc_count; i++) { |
|---|
| .. | .. |
|---|
| 705 | 840 | if (pool->base.dmcu != NULL) |
|---|
| 706 | 841 | dce_dmcu_destroy(&pool->base.dmcu); |
|---|
| 707 | 842 | |
|---|
| 708 | | - if (pool->base.dccg != NULL) |
|---|
| 709 | | - dce_dccg_destroy(&pool->base.dccg); |
|---|
| 710 | | - |
|---|
| 711 | 843 | if (pool->base.irqs != NULL) { |
|---|
| 712 | 844 | dal_irq_service_destroy(&pool->base.irqs); |
|---|
| 713 | 845 | } |
|---|
| .. | .. |
|---|
| 718 | 850 | const struct resource_pool *pool, |
|---|
| 719 | 851 | const struct dc_stream_state *const stream) |
|---|
| 720 | 852 | { |
|---|
| 721 | | - switch (stream->sink->link->link_enc->transmitter) { |
|---|
| 853 | + switch (stream->link->link_enc->transmitter) { |
|---|
| 722 | 854 | case TRANSMITTER_UNIPHY_A: |
|---|
| 723 | 855 | return pool->clock_sources[DCE112_CLK_SRC_PLL0]; |
|---|
| 724 | 856 | case TRANSMITTER_UNIPHY_B: |
|---|
| .. | .. |
|---|
| 757 | 889 | |
|---|
| 758 | 890 | bool dce112_validate_bandwidth( |
|---|
| 759 | 891 | struct dc *dc, |
|---|
| 760 | | - struct dc_state *context) |
|---|
| 892 | + struct dc_state *context, |
|---|
| 893 | + bool fast_validate) |
|---|
| 761 | 894 | { |
|---|
| 762 | 895 | bool result = false; |
|---|
| 763 | 896 | |
|---|
| .. | .. |
|---|
| 771 | 904 | dc->bw_vbios, |
|---|
| 772 | 905 | context->res_ctx.pipe_ctx, |
|---|
| 773 | 906 | dc->res_pool->pipe_count, |
|---|
| 774 | | - &context->bw.dce)) |
|---|
| 907 | + &context->bw_ctx.bw.dce)) |
|---|
| 775 | 908 | result = true; |
|---|
| 776 | 909 | |
|---|
| 777 | 910 | if (!result) |
|---|
| .. | .. |
|---|
| 779 | 912 | "%s: Bandwidth validation failed!", |
|---|
| 780 | 913 | __func__); |
|---|
| 781 | 914 | |
|---|
| 782 | | - if (memcmp(&dc->current_state->bw.dce, |
|---|
| 783 | | - &context->bw.dce, sizeof(context->bw.dce))) { |
|---|
| 915 | + if (memcmp(&dc->current_state->bw_ctx.bw.dce, |
|---|
| 916 | + &context->bw_ctx.bw.dce, sizeof(context->bw_ctx.bw.dce))) { |
|---|
| 784 | 917 | |
|---|
| 785 | 918 | DC_LOG_BANDWIDTH_CALCS( |
|---|
| 786 | 919 | "%s: finish,\n" |
|---|
| .. | .. |
|---|
| 794 | 927 | "sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n" |
|---|
| 795 | 928 | , |
|---|
| 796 | 929 | __func__, |
|---|
| 797 | | - context->bw.dce.nbp_state_change_wm_ns[0].b_mark, |
|---|
| 798 | | - context->bw.dce.nbp_state_change_wm_ns[0].a_mark, |
|---|
| 799 | | - context->bw.dce.urgent_wm_ns[0].b_mark, |
|---|
| 800 | | - context->bw.dce.urgent_wm_ns[0].a_mark, |
|---|
| 801 | | - context->bw.dce.stutter_exit_wm_ns[0].b_mark, |
|---|
| 802 | | - context->bw.dce.stutter_exit_wm_ns[0].a_mark, |
|---|
| 803 | | - context->bw.dce.nbp_state_change_wm_ns[1].b_mark, |
|---|
| 804 | | - context->bw.dce.nbp_state_change_wm_ns[1].a_mark, |
|---|
| 805 | | - context->bw.dce.urgent_wm_ns[1].b_mark, |
|---|
| 806 | | - context->bw.dce.urgent_wm_ns[1].a_mark, |
|---|
| 807 | | - context->bw.dce.stutter_exit_wm_ns[1].b_mark, |
|---|
| 808 | | - context->bw.dce.stutter_exit_wm_ns[1].a_mark, |
|---|
| 809 | | - context->bw.dce.nbp_state_change_wm_ns[2].b_mark, |
|---|
| 810 | | - context->bw.dce.nbp_state_change_wm_ns[2].a_mark, |
|---|
| 811 | | - context->bw.dce.urgent_wm_ns[2].b_mark, |
|---|
| 812 | | - context->bw.dce.urgent_wm_ns[2].a_mark, |
|---|
| 813 | | - context->bw.dce.stutter_exit_wm_ns[2].b_mark, |
|---|
| 814 | | - context->bw.dce.stutter_exit_wm_ns[2].a_mark, |
|---|
| 815 | | - context->bw.dce.stutter_mode_enable, |
|---|
| 816 | | - context->bw.dce.cpuc_state_change_enable, |
|---|
| 817 | | - context->bw.dce.cpup_state_change_enable, |
|---|
| 818 | | - context->bw.dce.nbp_state_change_enable, |
|---|
| 819 | | - context->bw.dce.all_displays_in_sync, |
|---|
| 820 | | - context->bw.dce.dispclk_khz, |
|---|
| 821 | | - context->bw.dce.sclk_khz, |
|---|
| 822 | | - context->bw.dce.sclk_deep_sleep_khz, |
|---|
| 823 | | - context->bw.dce.yclk_khz, |
|---|
| 824 | | - context->bw.dce.blackout_recovery_time_us); |
|---|
| 930 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].b_mark, |
|---|
| 931 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].a_mark, |
|---|
| 932 | + context->bw_ctx.bw.dce.urgent_wm_ns[0].b_mark, |
|---|
| 933 | + context->bw_ctx.bw.dce.urgent_wm_ns[0].a_mark, |
|---|
| 934 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].b_mark, |
|---|
| 935 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].a_mark, |
|---|
| 936 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].b_mark, |
|---|
| 937 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].a_mark, |
|---|
| 938 | + context->bw_ctx.bw.dce.urgent_wm_ns[1].b_mark, |
|---|
| 939 | + context->bw_ctx.bw.dce.urgent_wm_ns[1].a_mark, |
|---|
| 940 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].b_mark, |
|---|
| 941 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].a_mark, |
|---|
| 942 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].b_mark, |
|---|
| 943 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].a_mark, |
|---|
| 944 | + context->bw_ctx.bw.dce.urgent_wm_ns[2].b_mark, |
|---|
| 945 | + context->bw_ctx.bw.dce.urgent_wm_ns[2].a_mark, |
|---|
| 946 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].b_mark, |
|---|
| 947 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].a_mark, |
|---|
| 948 | + context->bw_ctx.bw.dce.stutter_mode_enable, |
|---|
| 949 | + context->bw_ctx.bw.dce.cpuc_state_change_enable, |
|---|
| 950 | + context->bw_ctx.bw.dce.cpup_state_change_enable, |
|---|
| 951 | + context->bw_ctx.bw.dce.nbp_state_change_enable, |
|---|
| 952 | + context->bw_ctx.bw.dce.all_displays_in_sync, |
|---|
| 953 | + context->bw_ctx.bw.dce.dispclk_khz, |
|---|
| 954 | + context->bw_ctx.bw.dce.sclk_khz, |
|---|
| 955 | + context->bw_ctx.bw.dce.sclk_deep_sleep_khz, |
|---|
| 956 | + context->bw_ctx.bw.dce.yclk_khz, |
|---|
| 957 | + context->bw_ctx.bw.dce.blackout_recovery_time_us); |
|---|
| 825 | 958 | } |
|---|
| 826 | 959 | return result; |
|---|
| 827 | 960 | } |
|---|
| .. | .. |
|---|
| 840 | 973 | return DC_ERROR_UNEXPECTED; |
|---|
| 841 | 974 | |
|---|
| 842 | 975 | if (dc_is_dp_signal(pipe_ctx->stream->signal) |
|---|
| 843 | | - || pipe_ctx->stream->signal == SIGNAL_TYPE_VIRTUAL) |
|---|
| 976 | + || dc_is_virtual_signal(pipe_ctx->stream->signal)) |
|---|
| 844 | 977 | pipe_ctx->clock_source = |
|---|
| 845 | 978 | dc->res_pool->dp_clock_source; |
|---|
| 846 | 979 | else |
|---|
| .. | .. |
|---|
| 884 | 1017 | struct dc_state *new_ctx, |
|---|
| 885 | 1018 | struct dc_stream_state *dc_stream) |
|---|
| 886 | 1019 | { |
|---|
| 887 | | - enum dc_status result = DC_ERROR_UNEXPECTED; |
|---|
| 1020 | + enum dc_status result; |
|---|
| 888 | 1021 | |
|---|
| 889 | 1022 | result = resource_map_pool_resources(dc, new_ctx, dc_stream); |
|---|
| 890 | 1023 | |
|---|
| .. | .. |
|---|
| 912 | 1045 | { |
|---|
| 913 | 1046 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
|---|
| 914 | 1047 | |
|---|
| 915 | | - destruct(dce110_pool); |
|---|
| 1048 | + dce112_resource_destruct(dce110_pool); |
|---|
| 916 | 1049 | kfree(dce110_pool); |
|---|
| 917 | 1050 | *pool = NULL; |
|---|
| 918 | 1051 | } |
|---|
| .. | .. |
|---|
| 920 | 1053 | static const struct resource_funcs dce112_res_pool_funcs = { |
|---|
| 921 | 1054 | .destroy = dce112_destroy_resource_pool, |
|---|
| 922 | 1055 | .link_enc_create = dce112_link_encoder_create, |
|---|
| 1056 | + .panel_cntl_create = dce112_panel_cntl_create, |
|---|
| 923 | 1057 | .validate_bandwidth = dce112_validate_bandwidth, |
|---|
| 924 | 1058 | .validate_plane = dce100_validate_plane, |
|---|
| 925 | 1059 | .add_stream_to_ctx = dce112_add_stream_to_ctx, |
|---|
| 926 | | - .validate_global = dce112_validate_global |
|---|
| 1060 | + .validate_global = dce112_validate_global, |
|---|
| 1061 | + .find_first_free_match_stream_enc_for_link = dce110_find_first_free_match_stream_enc_for_link |
|---|
| 927 | 1062 | }; |
|---|
| 928 | 1063 | |
|---|
| 929 | 1064 | static void bw_calcs_data_update_from_pplib(struct dc *dc) |
|---|
| .. | .. |
|---|
| 932 | 1067 | struct dm_pp_clock_levels_with_latency mem_clks = {0}; |
|---|
| 933 | 1068 | struct dm_pp_wm_sets_with_clock_ranges clk_ranges = {0}; |
|---|
| 934 | 1069 | struct dm_pp_clock_levels clks = {0}; |
|---|
| 1070 | + int memory_type_multiplier = MEMORY_TYPE_MULTIPLIER_CZ; |
|---|
| 1071 | + |
|---|
| 1072 | + if (dc->bw_vbios && dc->bw_vbios->memory_type == bw_def_hbm) |
|---|
| 1073 | + memory_type_multiplier = MEMORY_TYPE_HBM; |
|---|
| 935 | 1074 | |
|---|
| 936 | 1075 | /*do system clock TODO PPLIB: after PPLIB implement, |
|---|
| 937 | 1076 | * then remove old way |
|---|
| .. | .. |
|---|
| 971 | 1110 | &clks); |
|---|
| 972 | 1111 | |
|---|
| 973 | 1112 | dc->bw_vbios->low_yclk = bw_frc_to_fixed( |
|---|
| 974 | | - clks.clocks_in_khz[0] * MEMORY_TYPE_MULTIPLIER, 1000); |
|---|
| 1113 | + clks.clocks_in_khz[0] * memory_type_multiplier, 1000); |
|---|
| 975 | 1114 | dc->bw_vbios->mid_yclk = bw_frc_to_fixed( |
|---|
| 976 | | - clks.clocks_in_khz[clks.num_levels>>1] * MEMORY_TYPE_MULTIPLIER, |
|---|
| 1115 | + clks.clocks_in_khz[clks.num_levels>>1] * memory_type_multiplier, |
|---|
| 977 | 1116 | 1000); |
|---|
| 978 | 1117 | dc->bw_vbios->high_yclk = bw_frc_to_fixed( |
|---|
| 979 | | - clks.clocks_in_khz[clks.num_levels-1] * MEMORY_TYPE_MULTIPLIER, |
|---|
| 1118 | + clks.clocks_in_khz[clks.num_levels-1] * memory_type_multiplier, |
|---|
| 980 | 1119 | 1000); |
|---|
| 981 | 1120 | |
|---|
| 982 | 1121 | return; |
|---|
| .. | .. |
|---|
| 1012 | 1151 | * YCLK = UMACLK*m_memoryTypeMultiplier |
|---|
| 1013 | 1152 | */ |
|---|
| 1014 | 1153 | dc->bw_vbios->low_yclk = bw_frc_to_fixed( |
|---|
| 1015 | | - mem_clks.data[0].clocks_in_khz * MEMORY_TYPE_MULTIPLIER, 1000); |
|---|
| 1154 | + mem_clks.data[0].clocks_in_khz * memory_type_multiplier, 1000); |
|---|
| 1016 | 1155 | dc->bw_vbios->mid_yclk = bw_frc_to_fixed( |
|---|
| 1017 | | - mem_clks.data[mem_clks.num_levels>>1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER, |
|---|
| 1156 | + mem_clks.data[mem_clks.num_levels>>1].clocks_in_khz * memory_type_multiplier, |
|---|
| 1018 | 1157 | 1000); |
|---|
| 1019 | 1158 | dc->bw_vbios->high_yclk = bw_frc_to_fixed( |
|---|
| 1020 | | - mem_clks.data[mem_clks.num_levels-1].clocks_in_khz * MEMORY_TYPE_MULTIPLIER, |
|---|
| 1159 | + mem_clks.data[mem_clks.num_levels-1].clocks_in_khz * memory_type_multiplier, |
|---|
| 1021 | 1160 | 1000); |
|---|
| 1022 | 1161 | |
|---|
| 1023 | 1162 | /* Now notify PPLib/SMU about which Watermarks sets they should select |
|---|
| .. | .. |
|---|
| 1080 | 1219 | return &polaris_10_resource_cap; |
|---|
| 1081 | 1220 | } |
|---|
| 1082 | 1221 | |
|---|
| 1083 | | -static bool construct( |
|---|
| 1222 | +static bool dce112_resource_construct( |
|---|
| 1084 | 1223 | uint8_t num_virtual_links, |
|---|
| 1085 | 1224 | struct dc *dc, |
|---|
| 1086 | 1225 | struct dce110_resource_pool *pool) |
|---|
| 1087 | 1226 | { |
|---|
| 1088 | 1227 | unsigned int i; |
|---|
| 1089 | 1228 | struct dc_context *ctx = dc->ctx; |
|---|
| 1090 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
|---|
| 1091 | 1229 | |
|---|
| 1092 | 1230 | ctx->dc_bios->regs = &bios_regs; |
|---|
| 1093 | 1231 | |
|---|
| .. | .. |
|---|
| 1104 | 1242 | dc->caps.i2c_speed_in_khz = 100; |
|---|
| 1105 | 1243 | dc->caps.max_cursor_size = 128; |
|---|
| 1106 | 1244 | dc->caps.dual_link_dvi = true; |
|---|
| 1107 | | - |
|---|
| 1245 | + dc->caps.extended_aux_timeout_support = false; |
|---|
| 1108 | 1246 | |
|---|
| 1109 | 1247 | /************************************************* |
|---|
| 1110 | 1248 | * Create resources * |
|---|
| .. | .. |
|---|
| 1155 | 1293 | } |
|---|
| 1156 | 1294 | } |
|---|
| 1157 | 1295 | |
|---|
| 1158 | | - pool->base.dccg = dce112_dccg_create(ctx, |
|---|
| 1159 | | - &disp_clk_regs, |
|---|
| 1160 | | - &disp_clk_shift, |
|---|
| 1161 | | - &disp_clk_mask); |
|---|
| 1162 | | - if (pool->base.dccg == NULL) { |
|---|
| 1163 | | - dm_error("DC: failed to create display clock!\n"); |
|---|
| 1164 | | - BREAK_TO_DEBUGGER(); |
|---|
| 1165 | | - goto res_create_fail; |
|---|
| 1166 | | - } |
|---|
| 1167 | | - |
|---|
| 1168 | 1296 | pool->base.dmcu = dce_dmcu_create(ctx, |
|---|
| 1169 | 1297 | &dmcu_regs, |
|---|
| 1170 | 1298 | &dmcu_shift, |
|---|
| .. | .. |
|---|
| 1184 | 1312 | BREAK_TO_DEBUGGER(); |
|---|
| 1185 | 1313 | goto res_create_fail; |
|---|
| 1186 | 1314 | } |
|---|
| 1187 | | - |
|---|
| 1188 | | - /* get static clock information for PPLIB or firmware, save |
|---|
| 1189 | | - * max_clock_state |
|---|
| 1190 | | - */ |
|---|
| 1191 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
|---|
| 1192 | | - pool->base.dccg->max_clks_state = |
|---|
| 1193 | | - static_clk_info.max_clocks_state; |
|---|
| 1194 | 1315 | |
|---|
| 1195 | 1316 | { |
|---|
| 1196 | 1317 | struct irq_service_init_data init_data; |
|---|
| .. | .. |
|---|
| 1245 | 1366 | "DC:failed to create output pixel processor!\n"); |
|---|
| 1246 | 1367 | goto res_create_fail; |
|---|
| 1247 | 1368 | } |
|---|
| 1369 | + } |
|---|
| 1370 | + |
|---|
| 1371 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
|---|
| 1248 | 1372 | pool->base.engines[i] = dce112_aux_engine_create(ctx, i); |
|---|
| 1249 | 1373 | if (pool->base.engines[i] == NULL) { |
|---|
| 1250 | 1374 | BREAK_TO_DEBUGGER(); |
|---|
| .. | .. |
|---|
| 1252 | 1376 | "DC:failed to create aux engine!!\n"); |
|---|
| 1253 | 1377 | goto res_create_fail; |
|---|
| 1254 | 1378 | } |
|---|
| 1379 | + pool->base.hw_i2cs[i] = dce112_i2c_hw_create(ctx, i); |
|---|
| 1380 | + if (pool->base.hw_i2cs[i] == NULL) { |
|---|
| 1381 | + BREAK_TO_DEBUGGER(); |
|---|
| 1382 | + dm_error( |
|---|
| 1383 | + "DC:failed to create i2c engine!!\n"); |
|---|
| 1384 | + goto res_create_fail; |
|---|
| 1385 | + } |
|---|
| 1386 | + pool->base.sw_i2cs[i] = NULL; |
|---|
| 1255 | 1387 | } |
|---|
| 1256 | 1388 | |
|---|
| 1257 | 1389 | if (!resource_construct(num_virtual_links, dc, &pool->base, |
|---|
| .. | .. |
|---|
| 1259 | 1391 | goto res_create_fail; |
|---|
| 1260 | 1392 | |
|---|
| 1261 | 1393 | dc->caps.max_planes = pool->base.pipe_count; |
|---|
| 1394 | + |
|---|
| 1395 | + for (i = 0; i < dc->caps.max_planes; ++i) |
|---|
| 1396 | + dc->caps.planes[i] = plane_cap; |
|---|
| 1262 | 1397 | |
|---|
| 1263 | 1398 | /* Create hardware sequencer */ |
|---|
| 1264 | 1399 | dce112_hw_sequencer_construct(dc); |
|---|
| .. | .. |
|---|
| 1270 | 1405 | return true; |
|---|
| 1271 | 1406 | |
|---|
| 1272 | 1407 | res_create_fail: |
|---|
| 1273 | | - destruct(pool); |
|---|
| 1408 | + dce112_resource_destruct(pool); |
|---|
| 1274 | 1409 | return false; |
|---|
| 1275 | 1410 | } |
|---|
| 1276 | 1411 | |
|---|
| .. | .. |
|---|
| 1284 | 1419 | if (!pool) |
|---|
| 1285 | 1420 | return NULL; |
|---|
| 1286 | 1421 | |
|---|
| 1287 | | - if (construct(num_virtual_links, dc, pool)) |
|---|
| 1422 | + if (dce112_resource_construct(num_virtual_links, dc, pool)) |
|---|
| 1288 | 1423 | return &pool->base; |
|---|
| 1289 | 1424 | |
|---|
| 1290 | 1425 | kfree(pool); |
|---|