.. | .. |
---|
23 | 23 | * |
---|
24 | 24 | */ |
---|
25 | 25 | |
---|
| 26 | +#include <linux/slab.h> |
---|
| 27 | + |
---|
26 | 28 | #include "dce/dce_8_0_d.h" |
---|
27 | 29 | #include "dce/dce_8_0_sh_mask.h" |
---|
28 | 30 | |
---|
.. | .. |
---|
40 | 42 | #include "dce/dce_mem_input.h" |
---|
41 | 43 | #include "dce/dce_link_encoder.h" |
---|
42 | 44 | #include "dce/dce_stream_encoder.h" |
---|
43 | | -#include "dce/dce_mem_input.h" |
---|
44 | 45 | #include "dce/dce_ipp.h" |
---|
45 | 46 | #include "dce/dce_transform.h" |
---|
46 | 47 | #include "dce/dce_opp.h" |
---|
47 | | -#include "dce/dce_clocks.h" |
---|
48 | 48 | #include "dce/dce_clock_source.h" |
---|
49 | 49 | #include "dce/dce_audio.h" |
---|
50 | 50 | #include "dce/dce_hwseq.h" |
---|
51 | 51 | #include "dce80/dce80_hw_sequencer.h" |
---|
52 | 52 | #include "dce100/dce100_resource.h" |
---|
| 53 | +#include "dce/dce_panel_cntl.h" |
---|
53 | 54 | |
---|
54 | 55 | #include "reg_helper.h" |
---|
55 | 56 | |
---|
56 | 57 | #include "dce/dce_dmcu.h" |
---|
57 | 58 | #include "dce/dce_aux.h" |
---|
58 | 59 | #include "dce/dce_abm.h" |
---|
| 60 | +#include "dce/dce_i2c.h" |
---|
59 | 61 | /* TODO remove this include */ |
---|
60 | 62 | |
---|
61 | 63 | #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT |
---|
.. | .. |
---|
77 | 79 | |
---|
78 | 80 | #ifndef mmBIOS_SCRATCH_2 |
---|
79 | 81 | #define mmBIOS_SCRATCH_2 0x05CB |
---|
| 82 | + #define mmBIOS_SCRATCH_3 0x05CC |
---|
80 | 83 | #define mmBIOS_SCRATCH_6 0x05CF |
---|
81 | 84 | #endif |
---|
82 | 85 | |
---|
.. | .. |
---|
152 | 155 | /* set register offset with instance */ |
---|
153 | 156 | #define SRI(reg_name, block, id)\ |
---|
154 | 157 | .reg_name = mm ## block ## id ## _ ## reg_name |
---|
155 | | - |
---|
156 | | - |
---|
157 | | -static const struct dccg_registers disp_clk_regs = { |
---|
158 | | - CLK_COMMON_REG_LIST_DCE_BASE() |
---|
159 | | -}; |
---|
160 | | - |
---|
161 | | -static const struct dccg_shift disp_clk_shift = { |
---|
162 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) |
---|
163 | | -}; |
---|
164 | | - |
---|
165 | | -static const struct dccg_mask disp_clk_mask = { |
---|
166 | | - CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) |
---|
167 | | -}; |
---|
168 | 158 | |
---|
169 | 159 | #define ipp_regs(id)\ |
---|
170 | 160 | [id] = {\ |
---|
.. | .. |
---|
277 | 267 | SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK) |
---|
278 | 268 | }; |
---|
279 | 269 | |
---|
| 270 | +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { |
---|
| 271 | + { DCE_PANEL_CNTL_REG_LIST() } |
---|
| 272 | +}; |
---|
| 273 | + |
---|
| 274 | +static const struct dce_panel_cntl_shift panel_cntl_shift = { |
---|
| 275 | + DCE_PANEL_CNTL_MASK_SH_LIST(__SHIFT) |
---|
| 276 | +}; |
---|
| 277 | + |
---|
| 278 | +static const struct dce_panel_cntl_mask panel_cntl_mask = { |
---|
| 279 | + DCE_PANEL_CNTL_MASK_SH_LIST(_MASK) |
---|
| 280 | +}; |
---|
| 281 | + |
---|
280 | 282 | #define opp_regs(id)\ |
---|
281 | 283 | [id] = {\ |
---|
282 | 284 | OPP_DCE_80_REG_LIST(id),\ |
---|
.. | .. |
---|
297 | 299 | |
---|
298 | 300 | static const struct dce_opp_mask opp_mask = { |
---|
299 | 301 | OPP_COMMON_MASK_SH_LIST_DCE_80(_MASK) |
---|
| 302 | +}; |
---|
| 303 | + |
---|
| 304 | +static const struct dce110_aux_registers_shift aux_shift = { |
---|
| 305 | + DCE10_AUX_MASK_SH_LIST(__SHIFT) |
---|
| 306 | +}; |
---|
| 307 | + |
---|
| 308 | +static const struct dce110_aux_registers_mask aux_mask = { |
---|
| 309 | + DCE10_AUX_MASK_SH_LIST(_MASK) |
---|
300 | 310 | }; |
---|
301 | 311 | |
---|
302 | 312 | #define aux_engine_regs(id)\ |
---|
.. | .. |
---|
333 | 343 | AUD_COMMON_MASK_SH_LIST(__SHIFT) |
---|
334 | 344 | }; |
---|
335 | 345 | |
---|
336 | | -static const struct dce_aduio_mask audio_mask = { |
---|
| 346 | +static const struct dce_audio_mask audio_mask = { |
---|
337 | 347 | AUD_COMMON_MASK_SH_LIST(_MASK) |
---|
338 | 348 | }; |
---|
339 | 349 | |
---|
.. | .. |
---|
358 | 368 | }; |
---|
359 | 369 | |
---|
360 | 370 | static const struct bios_registers bios_regs = { |
---|
| 371 | + .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3, |
---|
361 | 372 | .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6 |
---|
362 | 373 | }; |
---|
363 | 374 | |
---|
.. | .. |
---|
366 | 377 | .num_audio = 6, |
---|
367 | 378 | .num_stream_encoder = 6, |
---|
368 | 379 | .num_pll = 3, |
---|
| 380 | + .num_ddc = 6, |
---|
369 | 381 | }; |
---|
370 | 382 | |
---|
371 | 383 | static const struct resource_caps res_cap_81 = { |
---|
.. | .. |
---|
373 | 385 | .num_audio = 7, |
---|
374 | 386 | .num_stream_encoder = 7, |
---|
375 | 387 | .num_pll = 3, |
---|
| 388 | + .num_ddc = 6, |
---|
376 | 389 | }; |
---|
377 | 390 | |
---|
378 | 391 | static const struct resource_caps res_cap_83 = { |
---|
.. | .. |
---|
380 | 393 | .num_audio = 6, |
---|
381 | 394 | .num_stream_encoder = 6, |
---|
382 | 395 | .num_pll = 2, |
---|
| 396 | + .num_ddc = 2, |
---|
| 397 | +}; |
---|
| 398 | + |
---|
| 399 | +static const struct dc_plane_cap plane_cap = { |
---|
| 400 | + .type = DC_PLANE_TYPE_DCE_RGB, |
---|
| 401 | + |
---|
| 402 | + .pixel_format_support = { |
---|
| 403 | + .argb8888 = true, |
---|
| 404 | + .nv12 = false, |
---|
| 405 | + .fp16 = false |
---|
| 406 | + }, |
---|
| 407 | + |
---|
| 408 | + .max_upscale_factor = { |
---|
| 409 | + .argb8888 = 16000, |
---|
| 410 | + .nv12 = 1, |
---|
| 411 | + .fp16 = 1 |
---|
| 412 | + }, |
---|
| 413 | + |
---|
| 414 | + .max_downscale_factor = { |
---|
| 415 | + .argb8888 = 250, |
---|
| 416 | + .nv12 = 1, |
---|
| 417 | + .fp16 = 1 |
---|
| 418 | + } |
---|
383 | 419 | }; |
---|
384 | 420 | |
---|
385 | 421 | static const struct dce_dmcu_registers dmcu_regs = { |
---|
.. | .. |
---|
415 | 451 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700 |
---|
416 | 452 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8 |
---|
417 | 453 | #endif |
---|
| 454 | + |
---|
| 455 | +static int map_transmitter_id_to_phy_instance( |
---|
| 456 | + enum transmitter transmitter) |
---|
| 457 | +{ |
---|
| 458 | + switch (transmitter) { |
---|
| 459 | + case TRANSMITTER_UNIPHY_A: |
---|
| 460 | + return 0; |
---|
| 461 | + break; |
---|
| 462 | + case TRANSMITTER_UNIPHY_B: |
---|
| 463 | + return 1; |
---|
| 464 | + break; |
---|
| 465 | + case TRANSMITTER_UNIPHY_C: |
---|
| 466 | + return 2; |
---|
| 467 | + break; |
---|
| 468 | + case TRANSMITTER_UNIPHY_D: |
---|
| 469 | + return 3; |
---|
| 470 | + break; |
---|
| 471 | + case TRANSMITTER_UNIPHY_E: |
---|
| 472 | + return 4; |
---|
| 473 | + break; |
---|
| 474 | + case TRANSMITTER_UNIPHY_F: |
---|
| 475 | + return 5; |
---|
| 476 | + break; |
---|
| 477 | + case TRANSMITTER_UNIPHY_G: |
---|
| 478 | + return 6; |
---|
| 479 | + break; |
---|
| 480 | + default: |
---|
| 481 | + ASSERT(0); |
---|
| 482 | + return 0; |
---|
| 483 | + } |
---|
| 484 | +} |
---|
418 | 485 | |
---|
419 | 486 | static void read_dce_straps( |
---|
420 | 487 | struct dc_context *ctx, |
---|
.. | .. |
---|
464 | 531 | return &opp->base; |
---|
465 | 532 | } |
---|
466 | 533 | |
---|
467 | | -struct aux_engine *dce80_aux_engine_create( |
---|
| 534 | +struct dce_aux *dce80_aux_engine_create( |
---|
468 | 535 | struct dc_context *ctx, |
---|
469 | 536 | uint32_t inst) |
---|
470 | 537 | { |
---|
.. | .. |
---|
476 | 543 | |
---|
477 | 544 | dce110_aux_engine_construct(aux_engine, ctx, inst, |
---|
478 | 545 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD, |
---|
479 | | - &aux_engine_regs[inst]); |
---|
| 546 | + &aux_engine_regs[inst], |
---|
| 547 | + &aux_mask, |
---|
| 548 | + &aux_shift, |
---|
| 549 | + ctx->dc->caps.extended_aux_timeout_support); |
---|
480 | 550 | |
---|
481 | 551 | return &aux_engine->base; |
---|
482 | 552 | } |
---|
| 553 | +#define i2c_inst_regs(id) { I2C_HW_ENGINE_COMMON_REG_LIST(id) } |
---|
483 | 554 | |
---|
| 555 | +static const struct dce_i2c_registers i2c_hw_regs[] = { |
---|
| 556 | + i2c_inst_regs(1), |
---|
| 557 | + i2c_inst_regs(2), |
---|
| 558 | + i2c_inst_regs(3), |
---|
| 559 | + i2c_inst_regs(4), |
---|
| 560 | + i2c_inst_regs(5), |
---|
| 561 | + i2c_inst_regs(6), |
---|
| 562 | +}; |
---|
| 563 | + |
---|
| 564 | +static const struct dce_i2c_shift i2c_shifts = { |
---|
| 565 | + I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) |
---|
| 566 | +}; |
---|
| 567 | + |
---|
| 568 | +static const struct dce_i2c_mask i2c_masks = { |
---|
| 569 | + I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) |
---|
| 570 | +}; |
---|
| 571 | + |
---|
| 572 | +struct dce_i2c_hw *dce80_i2c_hw_create( |
---|
| 573 | + struct dc_context *ctx, |
---|
| 574 | + uint32_t inst) |
---|
| 575 | +{ |
---|
| 576 | + struct dce_i2c_hw *dce_i2c_hw = |
---|
| 577 | + kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); |
---|
| 578 | + |
---|
| 579 | + if (!dce_i2c_hw) |
---|
| 580 | + return NULL; |
---|
| 581 | + |
---|
| 582 | + dce_i2c_hw_construct(dce_i2c_hw, ctx, inst, |
---|
| 583 | + &i2c_hw_regs[inst], &i2c_shifts, &i2c_masks); |
---|
| 584 | + |
---|
| 585 | + return dce_i2c_hw; |
---|
| 586 | +} |
---|
| 587 | + |
---|
| 588 | +struct dce_i2c_sw *dce80_i2c_sw_create( |
---|
| 589 | + struct dc_context *ctx) |
---|
| 590 | +{ |
---|
| 591 | + struct dce_i2c_sw *dce_i2c_sw = |
---|
| 592 | + kzalloc(sizeof(struct dce_i2c_sw), GFP_KERNEL); |
---|
| 593 | + |
---|
| 594 | + if (!dce_i2c_sw) |
---|
| 595 | + return NULL; |
---|
| 596 | + |
---|
| 597 | + dce_i2c_sw_construct(dce_i2c_sw, ctx); |
---|
| 598 | + |
---|
| 599 | + return dce_i2c_sw; |
---|
| 600 | +} |
---|
484 | 601 | static struct stream_encoder *dce80_stream_encoder_create( |
---|
485 | 602 | enum engine_id eng_id, |
---|
486 | 603 | struct dc_context *ctx) |
---|
.. | .. |
---|
599 | 716 | .max_hdmi_deep_color = COLOR_DEPTH_121212, |
---|
600 | 717 | .max_hdmi_pixel_clock = 297000, |
---|
601 | 718 | .flags.bits.IS_HBR2_CAPABLE = true, |
---|
602 | | - .flags.bits.IS_TPS3_CAPABLE = true, |
---|
603 | | - .flags.bits.IS_YCBCR_CAPABLE = true |
---|
| 719 | + .flags.bits.IS_TPS3_CAPABLE = true |
---|
604 | 720 | }; |
---|
605 | 721 | |
---|
606 | 722 | struct link_encoder *dce80_link_encoder_create( |
---|
.. | .. |
---|
608 | 724 | { |
---|
609 | 725 | struct dce110_link_encoder *enc110 = |
---|
610 | 726 | kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); |
---|
| 727 | + int link_regs_id; |
---|
611 | 728 | |
---|
612 | 729 | if (!enc110) |
---|
613 | 730 | return NULL; |
---|
614 | 731 | |
---|
| 732 | + link_regs_id = |
---|
| 733 | + map_transmitter_id_to_phy_instance(enc_init_data->transmitter); |
---|
| 734 | + |
---|
615 | 735 | dce110_link_encoder_construct(enc110, |
---|
616 | 736 | enc_init_data, |
---|
617 | 737 | &link_enc_feature, |
---|
618 | | - &link_enc_regs[enc_init_data->transmitter], |
---|
| 738 | + &link_enc_regs[link_regs_id], |
---|
619 | 739 | &link_enc_aux_regs[enc_init_data->channel - 1], |
---|
620 | 740 | &link_enc_hpd_regs[enc_init_data->hpd_source]); |
---|
621 | 741 | return &enc110->base; |
---|
| 742 | +} |
---|
| 743 | + |
---|
| 744 | +static struct panel_cntl *dce80_panel_cntl_create(const struct panel_cntl_init_data *init_data) |
---|
| 745 | +{ |
---|
| 746 | + struct dce_panel_cntl *panel_cntl = |
---|
| 747 | + kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); |
---|
| 748 | + |
---|
| 749 | + if (!panel_cntl) |
---|
| 750 | + return NULL; |
---|
| 751 | + |
---|
| 752 | + dce_panel_cntl_construct(panel_cntl, |
---|
| 753 | + init_data, |
---|
| 754 | + &panel_cntl_regs[init_data->inst], |
---|
| 755 | + &panel_cntl_shift, |
---|
| 756 | + &panel_cntl_mask); |
---|
| 757 | + |
---|
| 758 | + return &panel_cntl->base; |
---|
622 | 759 | } |
---|
623 | 760 | |
---|
624 | 761 | struct clock_source *dce80_clock_source_create( |
---|
.. | .. |
---|
640 | 777 | return &clk_src->base; |
---|
641 | 778 | } |
---|
642 | 779 | |
---|
| 780 | + kfree(clk_src); |
---|
643 | 781 | BREAK_TO_DEBUGGER(); |
---|
644 | 782 | return NULL; |
---|
645 | 783 | } |
---|
.. | .. |
---|
665 | 803 | return &ipp->base; |
---|
666 | 804 | } |
---|
667 | 805 | |
---|
668 | | -static void destruct(struct dce110_resource_pool *pool) |
---|
| 806 | +static void dce80_resource_destruct(struct dce110_resource_pool *pool) |
---|
669 | 807 | { |
---|
670 | 808 | unsigned int i; |
---|
671 | 809 | |
---|
.. | .. |
---|
688 | 826 | kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i])); |
---|
689 | 827 | pool->base.timing_generators[i] = NULL; |
---|
690 | 828 | } |
---|
| 829 | + } |
---|
691 | 830 | |
---|
| 831 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
692 | 832 | if (pool->base.engines[i] != NULL) |
---|
693 | 833 | dce110_engine_destroy(&pool->base.engines[i]); |
---|
| 834 | + if (pool->base.hw_i2cs[i] != NULL) { |
---|
| 835 | + kfree(pool->base.hw_i2cs[i]); |
---|
| 836 | + pool->base.hw_i2cs[i] = NULL; |
---|
| 837 | + } |
---|
| 838 | + if (pool->base.sw_i2cs[i] != NULL) { |
---|
| 839 | + kfree(pool->base.sw_i2cs[i]); |
---|
| 840 | + pool->base.sw_i2cs[i] = NULL; |
---|
| 841 | + } |
---|
694 | 842 | } |
---|
695 | 843 | |
---|
696 | 844 | for (i = 0; i < pool->base.stream_enc_count; i++) { |
---|
.. | .. |
---|
719 | 867 | } |
---|
720 | 868 | } |
---|
721 | 869 | |
---|
722 | | - if (pool->base.dccg != NULL) |
---|
723 | | - dce_dccg_destroy(&pool->base.dccg); |
---|
724 | | - |
---|
725 | 870 | if (pool->base.irqs != NULL) { |
---|
726 | 871 | dal_irq_service_destroy(&pool->base.irqs); |
---|
727 | 872 | } |
---|
.. | .. |
---|
729 | 874 | |
---|
730 | 875 | bool dce80_validate_bandwidth( |
---|
731 | 876 | struct dc *dc, |
---|
732 | | - struct dc_state *context) |
---|
| 877 | + struct dc_state *context, |
---|
| 878 | + bool fast_validate) |
---|
733 | 879 | { |
---|
734 | | - /* TODO implement when needed but for now hardcode max value*/ |
---|
735 | | - context->bw.dce.dispclk_khz = 681000; |
---|
736 | | - context->bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER; |
---|
| 880 | + int i; |
---|
| 881 | + bool at_least_one_pipe = false; |
---|
| 882 | + |
---|
| 883 | + for (i = 0; i < dc->res_pool->pipe_count; i++) { |
---|
| 884 | + if (context->res_ctx.pipe_ctx[i].stream) |
---|
| 885 | + at_least_one_pipe = true; |
---|
| 886 | + } |
---|
| 887 | + |
---|
| 888 | + if (at_least_one_pipe) { |
---|
| 889 | + /* TODO implement when needed but for now hardcode max value*/ |
---|
| 890 | + context->bw_ctx.bw.dce.dispclk_khz = 681000; |
---|
| 891 | + context->bw_ctx.bw.dce.yclk_khz = 250000 * MEMORY_TYPE_MULTIPLIER_CZ; |
---|
| 892 | + } else { |
---|
| 893 | + context->bw_ctx.bw.dce.dispclk_khz = 0; |
---|
| 894 | + context->bw_ctx.bw.dce.yclk_khz = 0; |
---|
| 895 | + } |
---|
737 | 896 | |
---|
738 | 897 | return true; |
---|
739 | 898 | } |
---|
.. | .. |
---|
772 | 931 | { |
---|
773 | 932 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
---|
774 | 933 | |
---|
775 | | - destruct(dce110_pool); |
---|
| 934 | + dce80_resource_destruct(dce110_pool); |
---|
776 | 935 | kfree(dce110_pool); |
---|
777 | 936 | *pool = NULL; |
---|
778 | 937 | } |
---|
.. | .. |
---|
780 | 939 | static const struct resource_funcs dce80_res_pool_funcs = { |
---|
781 | 940 | .destroy = dce80_destroy_resource_pool, |
---|
782 | 941 | .link_enc_create = dce80_link_encoder_create, |
---|
| 942 | + .panel_cntl_create = dce80_panel_cntl_create, |
---|
783 | 943 | .validate_bandwidth = dce80_validate_bandwidth, |
---|
784 | 944 | .validate_plane = dce100_validate_plane, |
---|
785 | 945 | .add_stream_to_ctx = dce100_add_stream_to_ctx, |
---|
786 | | - .validate_global = dce80_validate_global |
---|
| 946 | + .validate_global = dce80_validate_global, |
---|
| 947 | + .find_first_free_match_stream_enc_for_link = dce100_find_first_free_match_stream_enc_for_link |
---|
787 | 948 | }; |
---|
788 | 949 | |
---|
789 | 950 | static bool dce80_construct( |
---|
.. | .. |
---|
793 | 954 | { |
---|
794 | 955 | unsigned int i; |
---|
795 | 956 | struct dc_context *ctx = dc->ctx; |
---|
796 | | - struct dc_firmware_info info; |
---|
797 | 957 | struct dc_bios *bp; |
---|
798 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
---|
799 | 958 | |
---|
800 | 959 | ctx->dc_bios->regs = &bios_regs; |
---|
801 | 960 | |
---|
.. | .. |
---|
813 | 972 | dc->caps.i2c_speed_in_khz = 40; |
---|
814 | 973 | dc->caps.max_cursor_size = 128; |
---|
815 | 974 | dc->caps.dual_link_dvi = true; |
---|
| 975 | + dc->caps.extended_aux_timeout_support = false; |
---|
816 | 976 | |
---|
817 | 977 | /************************************************* |
---|
818 | 978 | * Create resources * |
---|
.. | .. |
---|
820 | 980 | |
---|
821 | 981 | bp = ctx->dc_bios; |
---|
822 | 982 | |
---|
823 | | - if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) && |
---|
824 | | - info.external_clock_source_frequency_for_dp != 0) { |
---|
| 983 | + if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { |
---|
825 | 984 | pool->base.dp_clock_source = |
---|
826 | 985 | dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); |
---|
827 | 986 | |
---|
.. | .. |
---|
858 | 1017 | } |
---|
859 | 1018 | } |
---|
860 | 1019 | |
---|
861 | | - pool->base.dccg = dce_dccg_create(ctx, |
---|
862 | | - &disp_clk_regs, |
---|
863 | | - &disp_clk_shift, |
---|
864 | | - &disp_clk_mask); |
---|
865 | | - if (pool->base.dccg == NULL) { |
---|
866 | | - dm_error("DC: failed to create display clock!\n"); |
---|
867 | | - BREAK_TO_DEBUGGER(); |
---|
868 | | - goto res_create_fail; |
---|
869 | | - } |
---|
870 | | - |
---|
871 | 1020 | pool->base.dmcu = dce_dmcu_create(ctx, |
---|
872 | 1021 | &dmcu_regs, |
---|
873 | 1022 | &dmcu_shift, |
---|
.. | .. |
---|
887 | 1036 | BREAK_TO_DEBUGGER(); |
---|
888 | 1037 | goto res_create_fail; |
---|
889 | 1038 | } |
---|
890 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
---|
891 | | - pool->base.dccg->max_clks_state = |
---|
892 | | - static_clk_info.max_clocks_state; |
---|
893 | 1039 | |
---|
894 | 1040 | { |
---|
895 | 1041 | struct irq_service_init_data init_data; |
---|
.. | .. |
---|
935 | 1081 | dm_error("DC: failed to create output pixel processor!\n"); |
---|
936 | 1082 | goto res_create_fail; |
---|
937 | 1083 | } |
---|
| 1084 | + } |
---|
938 | 1085 | |
---|
| 1086 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
939 | 1087 | pool->base.engines[i] = dce80_aux_engine_create(ctx, i); |
---|
940 | 1088 | if (pool->base.engines[i] == NULL) { |
---|
941 | 1089 | BREAK_TO_DEBUGGER(); |
---|
.. | .. |
---|
943 | 1091 | "DC:failed to create aux engine!!\n"); |
---|
944 | 1092 | goto res_create_fail; |
---|
945 | 1093 | } |
---|
| 1094 | + pool->base.hw_i2cs[i] = dce80_i2c_hw_create(ctx, i); |
---|
| 1095 | + if (pool->base.hw_i2cs[i] == NULL) { |
---|
| 1096 | + BREAK_TO_DEBUGGER(); |
---|
| 1097 | + dm_error( |
---|
| 1098 | + "DC:failed to create i2c engine!!\n"); |
---|
| 1099 | + goto res_create_fail; |
---|
| 1100 | + } |
---|
| 1101 | + pool->base.sw_i2cs[i] = dce80_i2c_sw_create(ctx); |
---|
| 1102 | + if (pool->base.sw_i2cs[i] == NULL) { |
---|
| 1103 | + BREAK_TO_DEBUGGER(); |
---|
| 1104 | + dm_error( |
---|
| 1105 | + "DC:failed to create sw i2c!!\n"); |
---|
| 1106 | + goto res_create_fail; |
---|
| 1107 | + } |
---|
946 | 1108 | } |
---|
947 | 1109 | |
---|
948 | 1110 | dc->caps.max_planes = pool->base.pipe_count; |
---|
| 1111 | + |
---|
| 1112 | + for (i = 0; i < dc->caps.max_planes; ++i) |
---|
| 1113 | + dc->caps.planes[i] = plane_cap; |
---|
| 1114 | + |
---|
949 | 1115 | dc->caps.disable_dp_clk_share = true; |
---|
950 | 1116 | |
---|
951 | 1117 | if (!resource_construct(num_virtual_links, dc, &pool->base, |
---|
.. | .. |
---|
958 | 1124 | return true; |
---|
959 | 1125 | |
---|
960 | 1126 | res_create_fail: |
---|
961 | | - destruct(pool); |
---|
| 1127 | + dce80_resource_destruct(pool); |
---|
962 | 1128 | return false; |
---|
963 | 1129 | } |
---|
964 | 1130 | |
---|
.. | .. |
---|
975 | 1141 | if (dce80_construct(num_virtual_links, dc, pool)) |
---|
976 | 1142 | return &pool->base; |
---|
977 | 1143 | |
---|
| 1144 | + kfree(pool); |
---|
978 | 1145 | BREAK_TO_DEBUGGER(); |
---|
979 | 1146 | return NULL; |
---|
980 | 1147 | } |
---|
.. | .. |
---|
986 | 1153 | { |
---|
987 | 1154 | unsigned int i; |
---|
988 | 1155 | struct dc_context *ctx = dc->ctx; |
---|
989 | | - struct dc_firmware_info info; |
---|
990 | 1156 | struct dc_bios *bp; |
---|
991 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
---|
992 | 1157 | |
---|
993 | 1158 | ctx->dc_bios->regs = &bios_regs; |
---|
994 | 1159 | |
---|
.. | .. |
---|
1013 | 1178 | |
---|
1014 | 1179 | bp = ctx->dc_bios; |
---|
1015 | 1180 | |
---|
1016 | | - if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) && |
---|
1017 | | - info.external_clock_source_frequency_for_dp != 0) { |
---|
| 1181 | + if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { |
---|
1018 | 1182 | pool->base.dp_clock_source = |
---|
1019 | 1183 | dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); |
---|
1020 | 1184 | |
---|
.. | .. |
---|
1051 | 1215 | } |
---|
1052 | 1216 | } |
---|
1053 | 1217 | |
---|
1054 | | - pool->base.dccg = dce_dccg_create(ctx, |
---|
1055 | | - &disp_clk_regs, |
---|
1056 | | - &disp_clk_shift, |
---|
1057 | | - &disp_clk_mask); |
---|
1058 | | - if (pool->base.dccg == NULL) { |
---|
1059 | | - dm_error("DC: failed to create display clock!\n"); |
---|
1060 | | - BREAK_TO_DEBUGGER(); |
---|
1061 | | - goto res_create_fail; |
---|
1062 | | - } |
---|
1063 | | - |
---|
1064 | 1218 | pool->base.dmcu = dce_dmcu_create(ctx, |
---|
1065 | 1219 | &dmcu_regs, |
---|
1066 | 1220 | &dmcu_shift, |
---|
.. | .. |
---|
1080 | 1234 | BREAK_TO_DEBUGGER(); |
---|
1081 | 1235 | goto res_create_fail; |
---|
1082 | 1236 | } |
---|
1083 | | - |
---|
1084 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
---|
1085 | | - pool->base.dccg->max_clks_state = |
---|
1086 | | - static_clk_info.max_clocks_state; |
---|
1087 | 1237 | |
---|
1088 | 1238 | { |
---|
1089 | 1239 | struct irq_service_init_data init_data; |
---|
.. | .. |
---|
1131 | 1281 | } |
---|
1132 | 1282 | } |
---|
1133 | 1283 | |
---|
| 1284 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
| 1285 | + pool->base.engines[i] = dce80_aux_engine_create(ctx, i); |
---|
| 1286 | + if (pool->base.engines[i] == NULL) { |
---|
| 1287 | + BREAK_TO_DEBUGGER(); |
---|
| 1288 | + dm_error( |
---|
| 1289 | + "DC:failed to create aux engine!!\n"); |
---|
| 1290 | + goto res_create_fail; |
---|
| 1291 | + } |
---|
| 1292 | + pool->base.hw_i2cs[i] = dce80_i2c_hw_create(ctx, i); |
---|
| 1293 | + if (pool->base.hw_i2cs[i] == NULL) { |
---|
| 1294 | + BREAK_TO_DEBUGGER(); |
---|
| 1295 | + dm_error( |
---|
| 1296 | + "DC:failed to create i2c engine!!\n"); |
---|
| 1297 | + goto res_create_fail; |
---|
| 1298 | + } |
---|
| 1299 | + pool->base.sw_i2cs[i] = dce80_i2c_sw_create(ctx); |
---|
| 1300 | + if (pool->base.sw_i2cs[i] == NULL) { |
---|
| 1301 | + BREAK_TO_DEBUGGER(); |
---|
| 1302 | + dm_error( |
---|
| 1303 | + "DC:failed to create sw i2c!!\n"); |
---|
| 1304 | + goto res_create_fail; |
---|
| 1305 | + } |
---|
| 1306 | + } |
---|
| 1307 | + |
---|
1134 | 1308 | dc->caps.max_planes = pool->base.pipe_count; |
---|
| 1309 | + |
---|
| 1310 | + for (i = 0; i < dc->caps.max_planes; ++i) |
---|
| 1311 | + dc->caps.planes[i] = plane_cap; |
---|
| 1312 | + |
---|
1135 | 1313 | dc->caps.disable_dp_clk_share = true; |
---|
1136 | 1314 | |
---|
1137 | 1315 | if (!resource_construct(num_virtual_links, dc, &pool->base, |
---|
.. | .. |
---|
1144 | 1322 | return true; |
---|
1145 | 1323 | |
---|
1146 | 1324 | res_create_fail: |
---|
1147 | | - destruct(pool); |
---|
| 1325 | + dce80_resource_destruct(pool); |
---|
1148 | 1326 | return false; |
---|
1149 | 1327 | } |
---|
1150 | 1328 | |
---|
.. | .. |
---|
1161 | 1339 | if (dce81_construct(num_virtual_links, dc, pool)) |
---|
1162 | 1340 | return &pool->base; |
---|
1163 | 1341 | |
---|
| 1342 | + kfree(pool); |
---|
1164 | 1343 | BREAK_TO_DEBUGGER(); |
---|
1165 | 1344 | return NULL; |
---|
1166 | 1345 | } |
---|
.. | .. |
---|
1172 | 1351 | { |
---|
1173 | 1352 | unsigned int i; |
---|
1174 | 1353 | struct dc_context *ctx = dc->ctx; |
---|
1175 | | - struct dc_firmware_info info; |
---|
1176 | 1354 | struct dc_bios *bp; |
---|
1177 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
---|
1178 | 1355 | |
---|
1179 | 1356 | ctx->dc_bios->regs = &bios_regs; |
---|
1180 | 1357 | |
---|
.. | .. |
---|
1199 | 1376 | |
---|
1200 | 1377 | bp = ctx->dc_bios; |
---|
1201 | 1378 | |
---|
1202 | | - if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) && |
---|
1203 | | - info.external_clock_source_frequency_for_dp != 0) { |
---|
| 1379 | + if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { |
---|
1204 | 1380 | pool->base.dp_clock_source = |
---|
1205 | 1381 | dce80_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); |
---|
1206 | 1382 | |
---|
.. | .. |
---|
1233 | 1409 | } |
---|
1234 | 1410 | } |
---|
1235 | 1411 | |
---|
1236 | | - pool->base.dccg = dce_dccg_create(ctx, |
---|
1237 | | - &disp_clk_regs, |
---|
1238 | | - &disp_clk_shift, |
---|
1239 | | - &disp_clk_mask); |
---|
1240 | | - if (pool->base.dccg == NULL) { |
---|
1241 | | - dm_error("DC: failed to create display clock!\n"); |
---|
1242 | | - BREAK_TO_DEBUGGER(); |
---|
1243 | | - goto res_create_fail; |
---|
1244 | | - } |
---|
1245 | | - |
---|
1246 | 1412 | pool->base.dmcu = dce_dmcu_create(ctx, |
---|
1247 | 1413 | &dmcu_regs, |
---|
1248 | 1414 | &dmcu_shift, |
---|
.. | .. |
---|
1262 | 1428 | BREAK_TO_DEBUGGER(); |
---|
1263 | 1429 | goto res_create_fail; |
---|
1264 | 1430 | } |
---|
1265 | | - |
---|
1266 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
---|
1267 | | - pool->base.dccg->max_clks_state = |
---|
1268 | | - static_clk_info.max_clocks_state; |
---|
1269 | 1431 | |
---|
1270 | 1432 | { |
---|
1271 | 1433 | struct irq_service_init_data init_data; |
---|
.. | .. |
---|
1313 | 1475 | } |
---|
1314 | 1476 | } |
---|
1315 | 1477 | |
---|
| 1478 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
| 1479 | + pool->base.engines[i] = dce80_aux_engine_create(ctx, i); |
---|
| 1480 | + if (pool->base.engines[i] == NULL) { |
---|
| 1481 | + BREAK_TO_DEBUGGER(); |
---|
| 1482 | + dm_error( |
---|
| 1483 | + "DC:failed to create aux engine!!\n"); |
---|
| 1484 | + goto res_create_fail; |
---|
| 1485 | + } |
---|
| 1486 | + pool->base.hw_i2cs[i] = dce80_i2c_hw_create(ctx, i); |
---|
| 1487 | + if (pool->base.hw_i2cs[i] == NULL) { |
---|
| 1488 | + BREAK_TO_DEBUGGER(); |
---|
| 1489 | + dm_error( |
---|
| 1490 | + "DC:failed to create i2c engine!!\n"); |
---|
| 1491 | + goto res_create_fail; |
---|
| 1492 | + } |
---|
| 1493 | + pool->base.sw_i2cs[i] = dce80_i2c_sw_create(ctx); |
---|
| 1494 | + if (pool->base.sw_i2cs[i] == NULL) { |
---|
| 1495 | + BREAK_TO_DEBUGGER(); |
---|
| 1496 | + dm_error( |
---|
| 1497 | + "DC:failed to create sw i2c!!\n"); |
---|
| 1498 | + goto res_create_fail; |
---|
| 1499 | + } |
---|
| 1500 | + } |
---|
| 1501 | + |
---|
1316 | 1502 | dc->caps.max_planes = pool->base.pipe_count; |
---|
| 1503 | + |
---|
| 1504 | + for (i = 0; i < dc->caps.max_planes; ++i) |
---|
| 1505 | + dc->caps.planes[i] = plane_cap; |
---|
| 1506 | + |
---|
1317 | 1507 | dc->caps.disable_dp_clk_share = true; |
---|
1318 | 1508 | |
---|
1319 | 1509 | if (!resource_construct(num_virtual_links, dc, &pool->base, |
---|
.. | .. |
---|
1326 | 1516 | return true; |
---|
1327 | 1517 | |
---|
1328 | 1518 | res_create_fail: |
---|
1329 | | - destruct(pool); |
---|
| 1519 | + dce80_resource_destruct(pool); |
---|
1330 | 1520 | return false; |
---|
1331 | 1521 | } |
---|
1332 | 1522 | |
---|