.. | .. |
---|
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" |
---|
.. | .. |
---|
30 | 32 | |
---|
31 | 33 | #include "resource.h" |
---|
32 | 34 | #include "dce110/dce110_resource.h" |
---|
33 | | - |
---|
34 | 35 | #include "include/irq_service_interface.h" |
---|
35 | 36 | #include "dce/dce_audio.h" |
---|
36 | 37 | #include "dce110/dce110_timing_generator.h" |
---|
.. | .. |
---|
45 | 46 | #include "dce110/dce110_transform_v.h" |
---|
46 | 47 | #include "dce/dce_opp.h" |
---|
47 | 48 | #include "dce110/dce110_opp_v.h" |
---|
48 | | -#include "dce/dce_clocks.h" |
---|
49 | 49 | #include "dce/dce_clock_source.h" |
---|
50 | 50 | #include "dce/dce_hwseq.h" |
---|
51 | 51 | #include "dce110/dce110_hw_sequencer.h" |
---|
52 | 52 | #include "dce/dce_aux.h" |
---|
53 | 53 | #include "dce/dce_abm.h" |
---|
54 | 54 | #include "dce/dce_dmcu.h" |
---|
| 55 | +#include "dce/dce_i2c.h" |
---|
| 56 | +#include "dce/dce_panel_cntl.h" |
---|
55 | 57 | |
---|
56 | 58 | #define DC_LOGGER \ |
---|
57 | 59 | dc->ctx->logger |
---|
.. | .. |
---|
83 | 85 | |
---|
84 | 86 | #ifndef mmBIOS_SCRATCH_2 |
---|
85 | 87 | #define mmBIOS_SCRATCH_2 0x05CB |
---|
| 88 | + #define mmBIOS_SCRATCH_3 0x05CC |
---|
86 | 89 | #define mmBIOS_SCRATCH_6 0x05CF |
---|
87 | 90 | #endif |
---|
88 | 91 | |
---|
.. | .. |
---|
146 | 149 | /* set register offset with instance */ |
---|
147 | 150 | #define SRI(reg_name, block, id)\ |
---|
148 | 151 | .reg_name = mm ## block ## id ## _ ## reg_name |
---|
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 | 152 | |
---|
162 | 153 | static const struct dce_dmcu_registers dmcu_regs = { |
---|
163 | 154 | DMCU_DCE110_COMMON_REG_LIST() |
---|
.. | .. |
---|
285 | 276 | SE_COMMON_MASK_SH_LIST_DCE110(_MASK) |
---|
286 | 277 | }; |
---|
287 | 278 | |
---|
| 279 | +static const struct dce_panel_cntl_registers panel_cntl_regs[] = { |
---|
| 280 | + { DCE_PANEL_CNTL_REG_LIST() } |
---|
| 281 | +}; |
---|
| 282 | + |
---|
| 283 | +static const struct dce_panel_cntl_shift panel_cntl_shift = { |
---|
| 284 | + DCE_PANEL_CNTL_MASK_SH_LIST(__SHIFT) |
---|
| 285 | +}; |
---|
| 286 | + |
---|
| 287 | +static const struct dce_panel_cntl_mask panel_cntl_mask = { |
---|
| 288 | + DCE_PANEL_CNTL_MASK_SH_LIST(_MASK) |
---|
| 289 | +}; |
---|
| 290 | + |
---|
| 291 | +static const struct dce110_aux_registers_shift aux_shift = { |
---|
| 292 | + DCE_AUX_MASK_SH_LIST(__SHIFT) |
---|
| 293 | +}; |
---|
| 294 | + |
---|
| 295 | +static const struct dce110_aux_registers_mask aux_mask = { |
---|
| 296 | + DCE_AUX_MASK_SH_LIST(_MASK) |
---|
| 297 | +}; |
---|
| 298 | + |
---|
288 | 299 | #define opp_regs(id)\ |
---|
289 | 300 | [id] = {\ |
---|
290 | 301 | OPP_DCE_110_REG_LIST(id),\ |
---|
.. | .. |
---|
341 | 352 | AUD_COMMON_MASK_SH_LIST(__SHIFT) |
---|
342 | 353 | }; |
---|
343 | 354 | |
---|
344 | | -static const struct dce_aduio_mask audio_mask = { |
---|
| 355 | +static const struct dce_audio_mask audio_mask = { |
---|
345 | 356 | AUD_COMMON_MASK_SH_LIST(_MASK) |
---|
346 | 357 | }; |
---|
347 | 358 | |
---|
.. | .. |
---|
368 | 379 | }; |
---|
369 | 380 | |
---|
370 | 381 | static const struct bios_registers bios_regs = { |
---|
| 382 | + .BIOS_SCRATCH_3 = mmBIOS_SCRATCH_3, |
---|
371 | 383 | .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6 |
---|
372 | 384 | }; |
---|
373 | 385 | |
---|
.. | .. |
---|
377 | 389 | .num_audio = 3, |
---|
378 | 390 | .num_stream_encoder = 3, |
---|
379 | 391 | .num_pll = 2, |
---|
| 392 | + .num_ddc = 3, |
---|
380 | 393 | }; |
---|
381 | 394 | |
---|
382 | 395 | static const struct resource_caps stoney_resource_cap = { |
---|
.. | .. |
---|
385 | 398 | .num_audio = 3, |
---|
386 | 399 | .num_stream_encoder = 3, |
---|
387 | 400 | .num_pll = 2, |
---|
| 401 | + .num_ddc = 3, |
---|
| 402 | +}; |
---|
| 403 | + |
---|
| 404 | +static const struct dc_plane_cap plane_cap = { |
---|
| 405 | + .type = DC_PLANE_TYPE_DCE_RGB, |
---|
| 406 | + .blends_with_below = true, |
---|
| 407 | + .blends_with_above = true, |
---|
| 408 | + .per_pixel_alpha = 1, |
---|
| 409 | + |
---|
| 410 | + .pixel_format_support = { |
---|
| 411 | + .argb8888 = true, |
---|
| 412 | + .nv12 = false, |
---|
| 413 | + .fp16 = false |
---|
| 414 | + }, |
---|
| 415 | + |
---|
| 416 | + .max_upscale_factor = { |
---|
| 417 | + .argb8888 = 16000, |
---|
| 418 | + .nv12 = 1, |
---|
| 419 | + .fp16 = 1 |
---|
| 420 | + }, |
---|
| 421 | + |
---|
| 422 | + .max_downscale_factor = { |
---|
| 423 | + .argb8888 = 250, |
---|
| 424 | + .nv12 = 1, |
---|
| 425 | + .fp16 = 1 |
---|
| 426 | + }, |
---|
| 427 | + 64, |
---|
| 428 | + 64 |
---|
| 429 | +}; |
---|
| 430 | + |
---|
| 431 | +static const struct dc_plane_cap underlay_plane_cap = { |
---|
| 432 | + .type = DC_PLANE_TYPE_DCE_UNDERLAY, |
---|
| 433 | + .blends_with_above = true, |
---|
| 434 | + .per_pixel_alpha = 1, |
---|
| 435 | + |
---|
| 436 | + .pixel_format_support = { |
---|
| 437 | + .argb8888 = false, |
---|
| 438 | + .nv12 = true, |
---|
| 439 | + .fp16 = false |
---|
| 440 | + }, |
---|
| 441 | + |
---|
| 442 | + .max_upscale_factor = { |
---|
| 443 | + .argb8888 = 1, |
---|
| 444 | + .nv12 = 16000, |
---|
| 445 | + .fp16 = 1 |
---|
| 446 | + }, |
---|
| 447 | + |
---|
| 448 | + .max_downscale_factor = { |
---|
| 449 | + .argb8888 = 1, |
---|
| 450 | + .nv12 = 250, |
---|
| 451 | + .fp16 = 1 |
---|
| 452 | + }, |
---|
| 453 | + 64, |
---|
| 454 | + 64 |
---|
388 | 455 | }; |
---|
389 | 456 | |
---|
390 | 457 | #define CTX ctx |
---|
.. | .. |
---|
397 | 464 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700 |
---|
398 | 465 | #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8 |
---|
399 | 466 | #endif |
---|
| 467 | + |
---|
| 468 | +static int map_transmitter_id_to_phy_instance( |
---|
| 469 | + enum transmitter transmitter) |
---|
| 470 | +{ |
---|
| 471 | + switch (transmitter) { |
---|
| 472 | + case TRANSMITTER_UNIPHY_A: |
---|
| 473 | + return 0; |
---|
| 474 | + break; |
---|
| 475 | + case TRANSMITTER_UNIPHY_B: |
---|
| 476 | + return 1; |
---|
| 477 | + break; |
---|
| 478 | + case TRANSMITTER_UNIPHY_C: |
---|
| 479 | + return 2; |
---|
| 480 | + break; |
---|
| 481 | + case TRANSMITTER_UNIPHY_D: |
---|
| 482 | + return 3; |
---|
| 483 | + break; |
---|
| 484 | + case TRANSMITTER_UNIPHY_E: |
---|
| 485 | + return 4; |
---|
| 486 | + break; |
---|
| 487 | + case TRANSMITTER_UNIPHY_F: |
---|
| 488 | + return 5; |
---|
| 489 | + break; |
---|
| 490 | + case TRANSMITTER_UNIPHY_G: |
---|
| 491 | + return 6; |
---|
| 492 | + break; |
---|
| 493 | + default: |
---|
| 494 | + ASSERT(0); |
---|
| 495 | + return 0; |
---|
| 496 | + } |
---|
| 497 | +} |
---|
400 | 498 | |
---|
401 | 499 | static void read_dce_straps( |
---|
402 | 500 | struct dc_context *ctx, |
---|
.. | .. |
---|
565 | 663 | |
---|
566 | 664 | static const struct encoder_feature_support link_enc_feature = { |
---|
567 | 665 | .max_hdmi_deep_color = COLOR_DEPTH_121212, |
---|
568 | | - .max_hdmi_pixel_clock = 594000, |
---|
| 666 | + .max_hdmi_pixel_clock = 300000, |
---|
569 | 667 | .flags.bits.IS_HBR2_CAPABLE = true, |
---|
570 | | - .flags.bits.IS_TPS3_CAPABLE = true, |
---|
571 | | - .flags.bits.IS_YCBCR_CAPABLE = true |
---|
| 668 | + .flags.bits.IS_TPS3_CAPABLE = true |
---|
572 | 669 | }; |
---|
573 | 670 | |
---|
574 | 671 | static struct link_encoder *dce110_link_encoder_create( |
---|
.. | .. |
---|
576 | 673 | { |
---|
577 | 674 | struct dce110_link_encoder *enc110 = |
---|
578 | 675 | kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); |
---|
| 676 | + int link_regs_id; |
---|
579 | 677 | |
---|
580 | 678 | if (!enc110) |
---|
581 | 679 | return NULL; |
---|
582 | 680 | |
---|
| 681 | + link_regs_id = |
---|
| 682 | + map_transmitter_id_to_phy_instance(enc_init_data->transmitter); |
---|
| 683 | + |
---|
583 | 684 | dce110_link_encoder_construct(enc110, |
---|
584 | 685 | enc_init_data, |
---|
585 | 686 | &link_enc_feature, |
---|
586 | | - &link_enc_regs[enc_init_data->transmitter], |
---|
| 687 | + &link_enc_regs[link_regs_id], |
---|
587 | 688 | &link_enc_aux_regs[enc_init_data->channel - 1], |
---|
588 | 689 | &link_enc_hpd_regs[enc_init_data->hpd_source]); |
---|
589 | 690 | return &enc110->base; |
---|
| 691 | +} |
---|
| 692 | + |
---|
| 693 | +static struct panel_cntl *dce110_panel_cntl_create(const struct panel_cntl_init_data *init_data) |
---|
| 694 | +{ |
---|
| 695 | + struct dce_panel_cntl *panel_cntl = |
---|
| 696 | + kzalloc(sizeof(struct dce_panel_cntl), GFP_KERNEL); |
---|
| 697 | + |
---|
| 698 | + if (!panel_cntl) |
---|
| 699 | + return NULL; |
---|
| 700 | + |
---|
| 701 | + dce_panel_cntl_construct(panel_cntl, |
---|
| 702 | + init_data, |
---|
| 703 | + &panel_cntl_regs[init_data->inst], |
---|
| 704 | + &panel_cntl_shift, |
---|
| 705 | + &panel_cntl_mask); |
---|
| 706 | + |
---|
| 707 | + return &panel_cntl->base; |
---|
590 | 708 | } |
---|
591 | 709 | |
---|
592 | 710 | static struct output_pixel_processor *dce110_opp_create( |
---|
.. | .. |
---|
604 | 722 | return &opp->base; |
---|
605 | 723 | } |
---|
606 | 724 | |
---|
607 | | -struct aux_engine *dce110_aux_engine_create( |
---|
| 725 | +struct dce_aux *dce110_aux_engine_create( |
---|
608 | 726 | struct dc_context *ctx, |
---|
609 | 727 | uint32_t inst) |
---|
610 | 728 | { |
---|
.. | .. |
---|
616 | 734 | |
---|
617 | 735 | dce110_aux_engine_construct(aux_engine, ctx, inst, |
---|
618 | 736 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD, |
---|
619 | | - &aux_engine_regs[inst]); |
---|
| 737 | + &aux_engine_regs[inst], |
---|
| 738 | + &aux_mask, |
---|
| 739 | + &aux_shift, |
---|
| 740 | + ctx->dc->caps.extended_aux_timeout_support); |
---|
620 | 741 | |
---|
621 | 742 | return &aux_engine->base; |
---|
622 | 743 | } |
---|
| 744 | +#define i2c_inst_regs(id) { I2C_HW_ENGINE_COMMON_REG_LIST(id) } |
---|
623 | 745 | |
---|
| 746 | +static const struct dce_i2c_registers i2c_hw_regs[] = { |
---|
| 747 | + i2c_inst_regs(1), |
---|
| 748 | + i2c_inst_regs(2), |
---|
| 749 | + i2c_inst_regs(3), |
---|
| 750 | + i2c_inst_regs(4), |
---|
| 751 | + i2c_inst_regs(5), |
---|
| 752 | + i2c_inst_regs(6), |
---|
| 753 | +}; |
---|
| 754 | + |
---|
| 755 | +static const struct dce_i2c_shift i2c_shifts = { |
---|
| 756 | + I2C_COMMON_MASK_SH_LIST_DCE110(__SHIFT) |
---|
| 757 | +}; |
---|
| 758 | + |
---|
| 759 | +static const struct dce_i2c_mask i2c_masks = { |
---|
| 760 | + I2C_COMMON_MASK_SH_LIST_DCE110(_MASK) |
---|
| 761 | +}; |
---|
| 762 | + |
---|
| 763 | +struct dce_i2c_hw *dce110_i2c_hw_create( |
---|
| 764 | + struct dc_context *ctx, |
---|
| 765 | + uint32_t inst) |
---|
| 766 | +{ |
---|
| 767 | + struct dce_i2c_hw *dce_i2c_hw = |
---|
| 768 | + kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); |
---|
| 769 | + |
---|
| 770 | + if (!dce_i2c_hw) |
---|
| 771 | + return NULL; |
---|
| 772 | + |
---|
| 773 | + dce100_i2c_hw_construct(dce_i2c_hw, ctx, inst, |
---|
| 774 | + &i2c_hw_regs[inst], &i2c_shifts, &i2c_masks); |
---|
| 775 | + |
---|
| 776 | + return dce_i2c_hw; |
---|
| 777 | +} |
---|
624 | 778 | struct clock_source *dce110_clock_source_create( |
---|
625 | 779 | struct dc_context *ctx, |
---|
626 | 780 | struct dc_bios *bios, |
---|
.. | .. |
---|
640 | 794 | return &clk_src->base; |
---|
641 | 795 | } |
---|
642 | 796 | |
---|
| 797 | + kfree(clk_src); |
---|
643 | 798 | BREAK_TO_DEBUGGER(); |
---|
644 | 799 | return NULL; |
---|
645 | 800 | } |
---|
.. | .. |
---|
661 | 816 | *clk_src = NULL; |
---|
662 | 817 | } |
---|
663 | 818 | |
---|
664 | | -static void destruct(struct dce110_resource_pool *pool) |
---|
| 819 | +static void dce110_resource_destruct(struct dce110_resource_pool *pool) |
---|
665 | 820 | { |
---|
666 | 821 | unsigned int i; |
---|
667 | 822 | |
---|
.. | .. |
---|
684 | 839 | kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i])); |
---|
685 | 840 | pool->base.timing_generators[i] = NULL; |
---|
686 | 841 | } |
---|
| 842 | + } |
---|
687 | 843 | |
---|
| 844 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
688 | 845 | if (pool->base.engines[i] != NULL) |
---|
689 | 846 | dce110_engine_destroy(&pool->base.engines[i]); |
---|
690 | | - |
---|
| 847 | + if (pool->base.hw_i2cs[i] != NULL) { |
---|
| 848 | + kfree(pool->base.hw_i2cs[i]); |
---|
| 849 | + pool->base.hw_i2cs[i] = NULL; |
---|
| 850 | + } |
---|
| 851 | + if (pool->base.sw_i2cs[i] != NULL) { |
---|
| 852 | + kfree(pool->base.sw_i2cs[i]); |
---|
| 853 | + pool->base.sw_i2cs[i] = NULL; |
---|
| 854 | + } |
---|
691 | 855 | } |
---|
692 | 856 | |
---|
693 | 857 | for (i = 0; i < pool->base.stream_enc_count; i++) { |
---|
.. | .. |
---|
716 | 880 | if (pool->base.dmcu != NULL) |
---|
717 | 881 | dce_dmcu_destroy(&pool->base.dmcu); |
---|
718 | 882 | |
---|
719 | | - if (pool->base.dccg != NULL) |
---|
720 | | - dce_dccg_destroy(&pool->base.dccg); |
---|
721 | | - |
---|
722 | 883 | if (pool->base.irqs != NULL) { |
---|
723 | 884 | dal_irq_service_destroy(&pool->base.irqs); |
---|
724 | 885 | } |
---|
.. | .. |
---|
735 | 896 | * the pixel clock normalization for hdmi up to here instead of doing it |
---|
736 | 897 | * in pll_adjust_pix_clk |
---|
737 | 898 | */ |
---|
738 | | - pixel_clk_params->requested_pix_clk = stream->timing.pix_clk_khz; |
---|
739 | | - pixel_clk_params->encoder_object_id = stream->sink->link->link_enc->id; |
---|
| 899 | + pixel_clk_params->requested_pix_clk_100hz = stream->timing.pix_clk_100hz; |
---|
| 900 | + pixel_clk_params->encoder_object_id = stream->link->link_enc->id; |
---|
740 | 901 | pixel_clk_params->signal_type = pipe_ctx->stream->signal; |
---|
741 | 902 | pixel_clk_params->controller_id = pipe_ctx->stream_res.tg->inst + 1; |
---|
742 | 903 | /* TODO: un-hardcode*/ |
---|
.. | .. |
---|
753 | 914 | pixel_clk_params->color_depth = COLOR_DEPTH_888; |
---|
754 | 915 | } |
---|
755 | 916 | if (stream->timing.pixel_encoding == PIXEL_ENCODING_YCBCR420) { |
---|
756 | | - pixel_clk_params->requested_pix_clk = pixel_clk_params->requested_pix_clk / 2; |
---|
| 917 | + pixel_clk_params->requested_pix_clk_100hz = pixel_clk_params->requested_pix_clk_100hz / 2; |
---|
757 | 918 | } |
---|
| 919 | + if (stream->timing.timing_3d_format == TIMING_3D_FORMAT_HW_FRAME_PACKING) |
---|
| 920 | + pixel_clk_params->requested_pix_clk_100hz *= 2; |
---|
| 921 | + |
---|
758 | 922 | } |
---|
759 | 923 | |
---|
760 | 924 | void dce110_resource_build_pipe_hw_param(struct pipe_ctx *pipe_ctx) |
---|
.. | .. |
---|
805 | 969 | |
---|
806 | 970 | static bool dce110_validate_bandwidth( |
---|
807 | 971 | struct dc *dc, |
---|
808 | | - struct dc_state *context) |
---|
| 972 | + struct dc_state *context, |
---|
| 973 | + bool fast_validate) |
---|
809 | 974 | { |
---|
810 | 975 | bool result = false; |
---|
811 | 976 | |
---|
.. | .. |
---|
819 | 984 | dc->bw_vbios, |
---|
820 | 985 | context->res_ctx.pipe_ctx, |
---|
821 | 986 | dc->res_pool->pipe_count, |
---|
822 | | - &context->bw.dce)) |
---|
| 987 | + &context->bw_ctx.bw.dce)) |
---|
823 | 988 | result = true; |
---|
824 | 989 | |
---|
825 | 990 | if (!result) |
---|
.. | .. |
---|
827 | 992 | __func__, |
---|
828 | 993 | context->streams[0]->timing.h_addressable, |
---|
829 | 994 | context->streams[0]->timing.v_addressable, |
---|
830 | | - context->streams[0]->timing.pix_clk_khz); |
---|
| 995 | + context->streams[0]->timing.pix_clk_100hz / 10); |
---|
831 | 996 | |
---|
832 | | - if (memcmp(&dc->current_state->bw.dce, |
---|
833 | | - &context->bw.dce, sizeof(context->bw.dce))) { |
---|
| 997 | + if (memcmp(&dc->current_state->bw_ctx.bw.dce, |
---|
| 998 | + &context->bw_ctx.bw.dce, sizeof(context->bw_ctx.bw.dce))) { |
---|
834 | 999 | |
---|
835 | 1000 | DC_LOG_BANDWIDTH_CALCS( |
---|
836 | 1001 | "%s: finish,\n" |
---|
.. | .. |
---|
844 | 1009 | "sclk: %d sclk_sleep: %d yclk: %d blackout_recovery_time_us: %d\n" |
---|
845 | 1010 | , |
---|
846 | 1011 | __func__, |
---|
847 | | - context->bw.dce.nbp_state_change_wm_ns[0].b_mark, |
---|
848 | | - context->bw.dce.nbp_state_change_wm_ns[0].a_mark, |
---|
849 | | - context->bw.dce.urgent_wm_ns[0].b_mark, |
---|
850 | | - context->bw.dce.urgent_wm_ns[0].a_mark, |
---|
851 | | - context->bw.dce.stutter_exit_wm_ns[0].b_mark, |
---|
852 | | - context->bw.dce.stutter_exit_wm_ns[0].a_mark, |
---|
853 | | - context->bw.dce.nbp_state_change_wm_ns[1].b_mark, |
---|
854 | | - context->bw.dce.nbp_state_change_wm_ns[1].a_mark, |
---|
855 | | - context->bw.dce.urgent_wm_ns[1].b_mark, |
---|
856 | | - context->bw.dce.urgent_wm_ns[1].a_mark, |
---|
857 | | - context->bw.dce.stutter_exit_wm_ns[1].b_mark, |
---|
858 | | - context->bw.dce.stutter_exit_wm_ns[1].a_mark, |
---|
859 | | - context->bw.dce.nbp_state_change_wm_ns[2].b_mark, |
---|
860 | | - context->bw.dce.nbp_state_change_wm_ns[2].a_mark, |
---|
861 | | - context->bw.dce.urgent_wm_ns[2].b_mark, |
---|
862 | | - context->bw.dce.urgent_wm_ns[2].a_mark, |
---|
863 | | - context->bw.dce.stutter_exit_wm_ns[2].b_mark, |
---|
864 | | - context->bw.dce.stutter_exit_wm_ns[2].a_mark, |
---|
865 | | - context->bw.dce.stutter_mode_enable, |
---|
866 | | - context->bw.dce.cpuc_state_change_enable, |
---|
867 | | - context->bw.dce.cpup_state_change_enable, |
---|
868 | | - context->bw.dce.nbp_state_change_enable, |
---|
869 | | - context->bw.dce.all_displays_in_sync, |
---|
870 | | - context->bw.dce.dispclk_khz, |
---|
871 | | - context->bw.dce.sclk_khz, |
---|
872 | | - context->bw.dce.sclk_deep_sleep_khz, |
---|
873 | | - context->bw.dce.yclk_khz, |
---|
874 | | - context->bw.dce.blackout_recovery_time_us); |
---|
| 1012 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].b_mark, |
---|
| 1013 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[0].a_mark, |
---|
| 1014 | + context->bw_ctx.bw.dce.urgent_wm_ns[0].b_mark, |
---|
| 1015 | + context->bw_ctx.bw.dce.urgent_wm_ns[0].a_mark, |
---|
| 1016 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].b_mark, |
---|
| 1017 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[0].a_mark, |
---|
| 1018 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].b_mark, |
---|
| 1019 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[1].a_mark, |
---|
| 1020 | + context->bw_ctx.bw.dce.urgent_wm_ns[1].b_mark, |
---|
| 1021 | + context->bw_ctx.bw.dce.urgent_wm_ns[1].a_mark, |
---|
| 1022 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].b_mark, |
---|
| 1023 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[1].a_mark, |
---|
| 1024 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].b_mark, |
---|
| 1025 | + context->bw_ctx.bw.dce.nbp_state_change_wm_ns[2].a_mark, |
---|
| 1026 | + context->bw_ctx.bw.dce.urgent_wm_ns[2].b_mark, |
---|
| 1027 | + context->bw_ctx.bw.dce.urgent_wm_ns[2].a_mark, |
---|
| 1028 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].b_mark, |
---|
| 1029 | + context->bw_ctx.bw.dce.stutter_exit_wm_ns[2].a_mark, |
---|
| 1030 | + context->bw_ctx.bw.dce.stutter_mode_enable, |
---|
| 1031 | + context->bw_ctx.bw.dce.cpuc_state_change_enable, |
---|
| 1032 | + context->bw_ctx.bw.dce.cpup_state_change_enable, |
---|
| 1033 | + context->bw_ctx.bw.dce.nbp_state_change_enable, |
---|
| 1034 | + context->bw_ctx.bw.dce.all_displays_in_sync, |
---|
| 1035 | + context->bw_ctx.bw.dce.dispclk_khz, |
---|
| 1036 | + context->bw_ctx.bw.dce.sclk_khz, |
---|
| 1037 | + context->bw_ctx.bw.dce.sclk_deep_sleep_khz, |
---|
| 1038 | + context->bw_ctx.bw.dce.yclk_khz, |
---|
| 1039 | + context->bw_ctx.bw.dce.blackout_recovery_time_us); |
---|
875 | 1040 | } |
---|
876 | 1041 | return result; |
---|
877 | 1042 | } |
---|
.. | .. |
---|
966 | 1131 | struct dc_stream_state *stream) |
---|
967 | 1132 | { |
---|
968 | 1133 | struct dc *dc = stream->ctx->dc; |
---|
| 1134 | + struct dce_hwseq *hws = dc->hwseq; |
---|
969 | 1135 | struct resource_context *res_ctx = &context->res_ctx; |
---|
970 | 1136 | unsigned int underlay_idx = pool->underlay_pipe_index; |
---|
971 | 1137 | struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[underlay_idx]; |
---|
.. | .. |
---|
986 | 1152 | struct tg_color black_color = {0}; |
---|
987 | 1153 | struct dc_bios *dcb = dc->ctx->dc_bios; |
---|
988 | 1154 | |
---|
989 | | - dc->hwss.enable_display_power_gating( |
---|
| 1155 | + hws->funcs.enable_display_power_gating( |
---|
990 | 1156 | dc, |
---|
991 | 1157 | pipe_ctx->stream_res.tg->inst, |
---|
992 | 1158 | dcb, PIPE_GATING_CONTROL_DISABLE); |
---|
.. | .. |
---|
998 | 1164 | |
---|
999 | 1165 | pipe_ctx->stream_res.tg->funcs->program_timing(pipe_ctx->stream_res.tg, |
---|
1000 | 1166 | &stream->timing, |
---|
| 1167 | + 0, |
---|
| 1168 | + 0, |
---|
| 1169 | + 0, |
---|
| 1170 | + 0, |
---|
| 1171 | + pipe_ctx->stream->signal, |
---|
1001 | 1172 | false); |
---|
1002 | 1173 | |
---|
1003 | 1174 | pipe_ctx->stream_res.tg->funcs->enable_advanced_request( |
---|
.. | .. |
---|
1008 | 1179 | pipe_ctx->plane_res.mi->funcs->allocate_mem_input(pipe_ctx->plane_res.mi, |
---|
1009 | 1180 | stream->timing.h_total, |
---|
1010 | 1181 | stream->timing.v_total, |
---|
1011 | | - stream->timing.pix_clk_khz, |
---|
| 1182 | + stream->timing.pix_clk_100hz / 10, |
---|
1012 | 1183 | context->stream_count); |
---|
1013 | 1184 | |
---|
1014 | 1185 | color_space_to_black_color(dc, |
---|
.. | .. |
---|
1025 | 1196 | { |
---|
1026 | 1197 | struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool); |
---|
1027 | 1198 | |
---|
1028 | | - destruct(dce110_pool); |
---|
| 1199 | + dce110_resource_destruct(dce110_pool); |
---|
1029 | 1200 | kfree(dce110_pool); |
---|
1030 | 1201 | *pool = NULL; |
---|
| 1202 | +} |
---|
| 1203 | + |
---|
| 1204 | +struct stream_encoder *dce110_find_first_free_match_stream_enc_for_link( |
---|
| 1205 | + struct resource_context *res_ctx, |
---|
| 1206 | + const struct resource_pool *pool, |
---|
| 1207 | + struct dc_stream_state *stream) |
---|
| 1208 | +{ |
---|
| 1209 | + int i; |
---|
| 1210 | + int j = -1; |
---|
| 1211 | + struct dc_link *link = stream->link; |
---|
| 1212 | + |
---|
| 1213 | + for (i = 0; i < pool->stream_enc_count; i++) { |
---|
| 1214 | + if (!res_ctx->is_stream_enc_acquired[i] && |
---|
| 1215 | + pool->stream_enc[i]) { |
---|
| 1216 | + /* Store first available for MST second display |
---|
| 1217 | + * in daisy chain use case |
---|
| 1218 | + */ |
---|
| 1219 | + j = i; |
---|
| 1220 | + if (pool->stream_enc[i]->id == |
---|
| 1221 | + link->link_enc->preferred_engine) |
---|
| 1222 | + return pool->stream_enc[i]; |
---|
| 1223 | + } |
---|
| 1224 | + } |
---|
| 1225 | + |
---|
| 1226 | + /* |
---|
| 1227 | + * For CZ and later, we can allow DIG FE and BE to differ for all display types |
---|
| 1228 | + */ |
---|
| 1229 | + |
---|
| 1230 | + if (j >= 0) |
---|
| 1231 | + return pool->stream_enc[j]; |
---|
| 1232 | + |
---|
| 1233 | + return NULL; |
---|
1031 | 1234 | } |
---|
1032 | 1235 | |
---|
1033 | 1236 | |
---|
1034 | 1237 | static const struct resource_funcs dce110_res_pool_funcs = { |
---|
1035 | 1238 | .destroy = dce110_destroy_resource_pool, |
---|
1036 | 1239 | .link_enc_create = dce110_link_encoder_create, |
---|
| 1240 | + .panel_cntl_create = dce110_panel_cntl_create, |
---|
1037 | 1241 | .validate_bandwidth = dce110_validate_bandwidth, |
---|
1038 | 1242 | .validate_plane = dce110_validate_plane, |
---|
1039 | 1243 | .acquire_idle_pipe_for_layer = dce110_acquire_underlay, |
---|
1040 | 1244 | .add_stream_to_ctx = dce110_add_stream_to_ctx, |
---|
1041 | | - .validate_global = dce110_validate_global |
---|
| 1245 | + .validate_global = dce110_validate_global, |
---|
| 1246 | + .find_first_free_match_stream_enc_for_link = dce110_find_first_free_match_stream_enc_for_link |
---|
1042 | 1247 | }; |
---|
1043 | 1248 | |
---|
1044 | 1249 | static bool underlay_create(struct dc_context *ctx, struct resource_pool *pool) |
---|
.. | .. |
---|
1126 | 1331 | &clks); |
---|
1127 | 1332 | |
---|
1128 | 1333 | dc->bw_vbios->low_yclk = bw_frc_to_fixed( |
---|
1129 | | - clks.clocks_in_khz[0] * MEMORY_TYPE_MULTIPLIER, 1000); |
---|
| 1334 | + clks.clocks_in_khz[0] * MEMORY_TYPE_MULTIPLIER_CZ, 1000); |
---|
1130 | 1335 | dc->bw_vbios->mid_yclk = bw_frc_to_fixed( |
---|
1131 | | - clks.clocks_in_khz[clks.num_levels>>1] * MEMORY_TYPE_MULTIPLIER, |
---|
| 1336 | + clks.clocks_in_khz[clks.num_levels>>1] * MEMORY_TYPE_MULTIPLIER_CZ, |
---|
1132 | 1337 | 1000); |
---|
1133 | 1338 | dc->bw_vbios->high_yclk = bw_frc_to_fixed( |
---|
1134 | | - clks.clocks_in_khz[clks.num_levels-1] * MEMORY_TYPE_MULTIPLIER, |
---|
| 1339 | + clks.clocks_in_khz[clks.num_levels-1] * MEMORY_TYPE_MULTIPLIER_CZ, |
---|
1135 | 1340 | 1000); |
---|
1136 | 1341 | } |
---|
1137 | 1342 | |
---|
.. | .. |
---|
1144 | 1349 | return &carrizo_resource_cap; |
---|
1145 | 1350 | } |
---|
1146 | 1351 | |
---|
1147 | | -static bool construct( |
---|
| 1352 | +static bool dce110_resource_construct( |
---|
1148 | 1353 | uint8_t num_virtual_links, |
---|
1149 | 1354 | struct dc *dc, |
---|
1150 | 1355 | struct dce110_resource_pool *pool, |
---|
.. | .. |
---|
1152 | 1357 | { |
---|
1153 | 1358 | unsigned int i; |
---|
1154 | 1359 | struct dc_context *ctx = dc->ctx; |
---|
1155 | | - struct dc_firmware_info info; |
---|
1156 | 1360 | struct dc_bios *bp; |
---|
1157 | | - struct dm_pp_static_clock_info static_clk_info = {0}; |
---|
1158 | 1361 | |
---|
1159 | 1362 | ctx->dc_bios->regs = &bios_regs; |
---|
1160 | 1363 | |
---|
.. | .. |
---|
1172 | 1375 | dc->caps.i2c_speed_in_khz = 100; |
---|
1173 | 1376 | dc->caps.max_cursor_size = 128; |
---|
1174 | 1377 | dc->caps.is_apu = true; |
---|
| 1378 | + dc->caps.extended_aux_timeout_support = false; |
---|
1175 | 1379 | |
---|
1176 | 1380 | /************************************************* |
---|
1177 | 1381 | * Create resources * |
---|
.. | .. |
---|
1179 | 1383 | |
---|
1180 | 1384 | bp = ctx->dc_bios; |
---|
1181 | 1385 | |
---|
1182 | | - if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) && |
---|
1183 | | - info.external_clock_source_frequency_for_dp != 0) { |
---|
| 1386 | + if (bp->fw_info_valid && bp->fw_info.external_clock_source_frequency_for_dp != 0) { |
---|
1184 | 1387 | pool->base.dp_clock_source = |
---|
1185 | 1388 | dce110_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true); |
---|
1186 | 1389 | |
---|
.. | .. |
---|
1210 | 1413 | } |
---|
1211 | 1414 | } |
---|
1212 | 1415 | |
---|
1213 | | - pool->base.dccg = dce110_dccg_create(ctx, |
---|
1214 | | - &disp_clk_regs, |
---|
1215 | | - &disp_clk_shift, |
---|
1216 | | - &disp_clk_mask); |
---|
1217 | | - if (pool->base.dccg == NULL) { |
---|
1218 | | - dm_error("DC: failed to create display clock!\n"); |
---|
1219 | | - BREAK_TO_DEBUGGER(); |
---|
1220 | | - goto res_create_fail; |
---|
1221 | | - } |
---|
1222 | | - |
---|
1223 | 1416 | pool->base.dmcu = dce_dmcu_create(ctx, |
---|
1224 | 1417 | &dmcu_regs, |
---|
1225 | 1418 | &dmcu_shift, |
---|
.. | .. |
---|
1239 | 1432 | BREAK_TO_DEBUGGER(); |
---|
1240 | 1433 | goto res_create_fail; |
---|
1241 | 1434 | } |
---|
1242 | | - |
---|
1243 | | - /* get static clock information for PPLIB or firmware, save |
---|
1244 | | - * max_clock_state |
---|
1245 | | - */ |
---|
1246 | | - if (dm_pp_get_static_clocks(ctx, &static_clk_info)) |
---|
1247 | | - pool->base.dccg->max_clks_state = |
---|
1248 | | - static_clk_info.max_clocks_state; |
---|
1249 | 1435 | |
---|
1250 | 1436 | { |
---|
1251 | 1437 | struct irq_service_init_data init_data; |
---|
.. | .. |
---|
1295 | 1481 | "DC: failed to create output pixel processor!\n"); |
---|
1296 | 1482 | goto res_create_fail; |
---|
1297 | 1483 | } |
---|
| 1484 | + } |
---|
1298 | 1485 | |
---|
| 1486 | + for (i = 0; i < pool->base.res_cap->num_ddc; i++) { |
---|
1299 | 1487 | pool->base.engines[i] = dce110_aux_engine_create(ctx, i); |
---|
1300 | 1488 | if (pool->base.engines[i] == NULL) { |
---|
1301 | 1489 | BREAK_TO_DEBUGGER(); |
---|
.. | .. |
---|
1303 | 1491 | "DC:failed to create aux engine!!\n"); |
---|
1304 | 1492 | goto res_create_fail; |
---|
1305 | 1493 | } |
---|
| 1494 | + pool->base.hw_i2cs[i] = dce110_i2c_hw_create(ctx, i); |
---|
| 1495 | + if (pool->base.hw_i2cs[i] == NULL) { |
---|
| 1496 | + BREAK_TO_DEBUGGER(); |
---|
| 1497 | + dm_error( |
---|
| 1498 | + "DC:failed to create i2c engine!!\n"); |
---|
| 1499 | + goto res_create_fail; |
---|
| 1500 | + } |
---|
| 1501 | + pool->base.sw_i2cs[i] = NULL; |
---|
1306 | 1502 | } |
---|
1307 | 1503 | |
---|
1308 | | - dc->fbc_compressor = dce110_compressor_create(ctx); |
---|
| 1504 | + if (dc->config.fbc_support) |
---|
| 1505 | + dc->fbc_compressor = dce110_compressor_create(ctx); |
---|
1309 | 1506 | |
---|
1310 | 1507 | if (!underlay_create(ctx, &pool->base)) |
---|
1311 | 1508 | goto res_create_fail; |
---|
.. | .. |
---|
1319 | 1516 | |
---|
1320 | 1517 | dc->caps.max_planes = pool->base.pipe_count; |
---|
1321 | 1518 | |
---|
| 1519 | + for (i = 0; i < pool->base.underlay_pipe_index; ++i) |
---|
| 1520 | + dc->caps.planes[i] = plane_cap; |
---|
| 1521 | + |
---|
| 1522 | + dc->caps.planes[pool->base.underlay_pipe_index] = underlay_plane_cap; |
---|
| 1523 | + |
---|
1322 | 1524 | bw_calcs_init(dc->bw_dceip, dc->bw_vbios, dc->ctx->asic_id); |
---|
1323 | 1525 | |
---|
1324 | 1526 | bw_calcs_data_update_from_pplib(dc); |
---|
.. | .. |
---|
1326 | 1528 | return true; |
---|
1327 | 1529 | |
---|
1328 | 1530 | res_create_fail: |
---|
1329 | | - destruct(pool); |
---|
| 1531 | + dce110_resource_destruct(pool); |
---|
1330 | 1532 | return false; |
---|
1331 | 1533 | } |
---|
1332 | 1534 | |
---|
.. | .. |
---|
1341 | 1543 | if (!pool) |
---|
1342 | 1544 | return NULL; |
---|
1343 | 1545 | |
---|
1344 | | - if (construct(num_virtual_links, dc, pool, asic_id)) |
---|
| 1546 | + if (dce110_resource_construct(num_virtual_links, dc, pool, asic_id)) |
---|
1345 | 1547 | return &pool->base; |
---|
1346 | 1548 | |
---|
1347 | 1549 | kfree(pool); |
---|