2 * Copyright 2012-15 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
25 #include "dm_services.h"
27 #include "link_encoder.h"
28 #include "stream_encoder.h"
31 #include "include/irq_service_interface.h"
32 #include "../virtual/virtual_stream_encoder.h"
33 #include "dce110/dce110_resource.h"
34 #include "dce110/dce110_timing_generator.h"
35 #include "irq/dce110/irq_service_dce110.h"
36 #include "dce/dce_link_encoder.h"
37 #include "dce/dce_stream_encoder.h"
39 #include "dce/dce_mem_input.h"
40 #include "dce/dce_ipp.h"
41 #include "dce/dce_transform.h"
42 #include "dce/dce_opp.h"
43 #include "dce/dce_clocks.h"
44 #include "dce/dce_clock_source.h"
45 #include "dce/dce_audio.h"
46 #include "dce/dce_hwseq.h"
47 #include "dce100/dce100_hw_sequencer.h"
49 #include "reg_helper.h"
51 #include "dce/dce_10_0_d.h"
52 #include "dce/dce_10_0_sh_mask.h"
54 #include "dce/dce_dmcu.h"
55 #include "dce/dce_aux.h"
56 #include "dce/dce_abm.h"
58 #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT
59 #include "gmc/gmc_8_2_d.h"
60 #include "gmc/gmc_8_2_sh_mask.h"
63 #ifndef mmDP_DPHY_INTERNAL_CTRL
64 #define mmDP_DPHY_INTERNAL_CTRL 0x4aa7
65 #define mmDP0_DP_DPHY_INTERNAL_CTRL 0x4aa7
66 #define mmDP1_DP_DPHY_INTERNAL_CTRL 0x4ba7
67 #define mmDP2_DP_DPHY_INTERNAL_CTRL 0x4ca7
68 #define mmDP3_DP_DPHY_INTERNAL_CTRL 0x4da7
69 #define mmDP4_DP_DPHY_INTERNAL_CTRL 0x4ea7
70 #define mmDP5_DP_DPHY_INTERNAL_CTRL 0x4fa7
71 #define mmDP6_DP_DPHY_INTERNAL_CTRL 0x54a7
72 #define mmDP7_DP_DPHY_INTERNAL_CTRL 0x56a7
73 #define mmDP8_DP_DPHY_INTERNAL_CTRL 0x57a7
76 #ifndef mmBIOS_SCRATCH_2
77 #define mmBIOS_SCRATCH_2 0x05CB
78 #define mmBIOS_SCRATCH_6 0x05CF
81 #ifndef mmDP_DPHY_BS_SR_SWAP_CNTL
82 #define mmDP_DPHY_BS_SR_SWAP_CNTL 0x4ADC
83 #define mmDP0_DP_DPHY_BS_SR_SWAP_CNTL 0x4ADC
84 #define mmDP1_DP_DPHY_BS_SR_SWAP_CNTL 0x4BDC
85 #define mmDP2_DP_DPHY_BS_SR_SWAP_CNTL 0x4CDC
86 #define mmDP3_DP_DPHY_BS_SR_SWAP_CNTL 0x4DDC
87 #define mmDP4_DP_DPHY_BS_SR_SWAP_CNTL 0x4EDC
88 #define mmDP5_DP_DPHY_BS_SR_SWAP_CNTL 0x4FDC
89 #define mmDP6_DP_DPHY_BS_SR_SWAP_CNTL 0x54DC
92 #ifndef mmDP_DPHY_FAST_TRAINING
93 #define mmDP_DPHY_FAST_TRAINING 0x4ABC
94 #define mmDP0_DP_DPHY_FAST_TRAINING 0x4ABC
95 #define mmDP1_DP_DPHY_FAST_TRAINING 0x4BBC
96 #define mmDP2_DP_DPHY_FAST_TRAINING 0x4CBC
97 #define mmDP3_DP_DPHY_FAST_TRAINING 0x4DBC
98 #define mmDP4_DP_DPHY_FAST_TRAINING 0x4EBC
99 #define mmDP5_DP_DPHY_FAST_TRAINING 0x4FBC
100 #define mmDP6_DP_DPHY_FAST_TRAINING 0x54BC
103 static const struct dce110_timing_generator_offsets dce100_tg_offsets[] = {
105 .crtc = (mmCRTC0_CRTC_CONTROL - mmCRTC_CONTROL),
106 .dcp = (mmDCP0_GRPH_CONTROL - mmGRPH_CONTROL),
109 .crtc = (mmCRTC1_CRTC_CONTROL - mmCRTC_CONTROL),
110 .dcp = (mmDCP1_GRPH_CONTROL - mmGRPH_CONTROL),
113 .crtc = (mmCRTC2_CRTC_CONTROL - mmCRTC_CONTROL),
114 .dcp = (mmDCP2_GRPH_CONTROL - mmGRPH_CONTROL),
117 .crtc = (mmCRTC3_CRTC_CONTROL - mmCRTC_CONTROL),
118 .dcp = (mmDCP3_GRPH_CONTROL - mmGRPH_CONTROL),
121 .crtc = (mmCRTC4_CRTC_CONTROL - mmCRTC_CONTROL),
122 .dcp = (mmDCP4_GRPH_CONTROL - mmGRPH_CONTROL),
125 .crtc = (mmCRTC5_CRTC_CONTROL - mmCRTC_CONTROL),
126 .dcp = (mmDCP5_GRPH_CONTROL - mmGRPH_CONTROL),
130 /* set register offset */
131 #define SR(reg_name)\
132 .reg_name = mm ## reg_name
134 /* set register offset with instance */
135 #define SRI(reg_name, block, id)\
136 .reg_name = mm ## block ## id ## _ ## reg_name
139 static const struct dccg_registers disp_clk_regs = {
140 CLK_COMMON_REG_LIST_DCE_BASE()
143 static const struct dccg_shift disp_clk_shift = {
144 CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
147 static const struct dccg_mask disp_clk_mask = {
148 CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
151 #define ipp_regs(id)\
153 IPP_DCE100_REG_LIST_DCE_BASE(id)\
156 static const struct dce_ipp_registers ipp_regs[] = {
165 static const struct dce_ipp_shift ipp_shift = {
166 IPP_DCE100_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
169 static const struct dce_ipp_mask ipp_mask = {
170 IPP_DCE100_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
173 #define transform_regs(id)\
175 XFM_COMMON_REG_LIST_DCE100(id)\
178 static const struct dce_transform_registers xfm_regs[] = {
187 static const struct dce_transform_shift xfm_shift = {
188 XFM_COMMON_MASK_SH_LIST_DCE110(__SHIFT)
191 static const struct dce_transform_mask xfm_mask = {
192 XFM_COMMON_MASK_SH_LIST_DCE110(_MASK)
195 #define aux_regs(id)\
200 static const struct dce110_link_enc_aux_registers link_enc_aux_regs[] = {
209 #define hpd_regs(id)\
214 static const struct dce110_link_enc_hpd_registers link_enc_hpd_regs[] = {
223 #define link_regs(id)\
225 LE_DCE100_REG_LIST(id)\
228 static const struct dce110_link_enc_registers link_enc_regs[] = {
238 #define stream_enc_regs(id)\
240 SE_COMMON_REG_LIST_DCE_BASE(id),\
244 static const struct dce110_stream_enc_registers stream_enc_regs[] = {
254 static const struct dce_stream_encoder_shift se_shift = {
255 SE_COMMON_MASK_SH_LIST_DCE80_100(__SHIFT)
258 static const struct dce_stream_encoder_mask se_mask = {
259 SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK)
262 #define opp_regs(id)\
264 OPP_DCE_100_REG_LIST(id),\
267 static const struct dce_opp_registers opp_regs[] = {
276 static const struct dce_opp_shift opp_shift = {
277 OPP_COMMON_MASK_SH_LIST_DCE_100(__SHIFT)
280 static const struct dce_opp_mask opp_mask = {
281 OPP_COMMON_MASK_SH_LIST_DCE_100(_MASK)
283 #define aux_engine_regs(id)\
285 AUX_COMMON_REG_LIST(id), \
286 .AUX_RESET_MASK = 0 \
289 static const struct dce110_aux_registers aux_engine_regs[] = {
298 #define audio_regs(id)\
300 AUD_COMMON_REG_LIST(id)\
303 static const struct dce_audio_registers audio_regs[] = {
313 static const struct dce_audio_shift audio_shift = {
314 AUD_COMMON_MASK_SH_LIST(__SHIFT)
317 static const struct dce_aduio_mask audio_mask = {
318 AUD_COMMON_MASK_SH_LIST(_MASK)
321 #define clk_src_regs(id)\
323 CS_COMMON_REG_LIST_DCE_100_110(id),\
326 static const struct dce110_clk_src_regs clk_src_regs[] = {
332 static const struct dce110_clk_src_shift cs_shift = {
333 CS_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
336 static const struct dce110_clk_src_mask cs_mask = {
337 CS_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
340 static const struct dce_dmcu_registers dmcu_regs = {
341 DMCU_DCE110_COMMON_REG_LIST()
344 static const struct dce_dmcu_shift dmcu_shift = {
345 DMCU_MASK_SH_LIST_DCE110(__SHIFT)
348 static const struct dce_dmcu_mask dmcu_mask = {
349 DMCU_MASK_SH_LIST_DCE110(_MASK)
352 static const struct dce_abm_registers abm_regs = {
353 ABM_DCE110_COMMON_REG_LIST()
356 static const struct dce_abm_shift abm_shift = {
357 ABM_MASK_SH_LIST_DCE110(__SHIFT)
360 static const struct dce_abm_mask abm_mask = {
361 ABM_MASK_SH_LIST_DCE110(_MASK)
364 #define DCFE_MEM_PWR_CTRL_REG_BASE 0x1b03
366 static const struct bios_registers bios_regs = {
367 .BIOS_SCRATCH_6 = mmBIOS_SCRATCH_6
370 static const struct resource_caps res_cap = {
371 .num_timing_generator = 6,
373 .num_stream_encoder = 6,
378 #define REG(reg) mm ## reg
380 #ifndef mmCC_DC_HDMI_STRAPS
381 #define mmCC_DC_HDMI_STRAPS 0x1918
382 #define CC_DC_HDMI_STRAPS__HDMI_DISABLE_MASK 0x40
383 #define CC_DC_HDMI_STRAPS__HDMI_DISABLE__SHIFT 0x6
384 #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700
385 #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8
388 static void read_dce_straps(
389 struct dc_context *ctx,
390 struct resource_straps *straps)
392 REG_GET_2(CC_DC_HDMI_STRAPS,
393 HDMI_DISABLE, &straps->hdmi_disable,
394 AUDIO_STREAM_NUMBER, &straps->audio_stream_number);
396 REG_GET(DC_PINSTRAPS, DC_PINSTRAPS_AUDIO, &straps->dc_pinstraps_audio);
399 static struct audio *create_audio(
400 struct dc_context *ctx, unsigned int inst)
402 return dce_audio_create(ctx, inst,
403 &audio_regs[inst], &audio_shift, &audio_mask);
406 static struct timing_generator *dce100_timing_generator_create(
407 struct dc_context *ctx,
409 const struct dce110_timing_generator_offsets *offsets)
411 struct dce110_timing_generator *tg110 =
412 kzalloc(sizeof(struct dce110_timing_generator), GFP_KERNEL);
417 dce110_timing_generator_construct(tg110, ctx, instance, offsets);
421 static struct stream_encoder *dce100_stream_encoder_create(
422 enum engine_id eng_id,
423 struct dc_context *ctx)
425 struct dce110_stream_encoder *enc110 =
426 kzalloc(sizeof(struct dce110_stream_encoder), GFP_KERNEL);
431 dce110_stream_encoder_construct(enc110, ctx, ctx->dc_bios, eng_id,
432 &stream_enc_regs[eng_id], &se_shift, &se_mask);
433 return &enc110->base;
436 #define SRII(reg_name, block, id)\
437 .reg_name[id] = mm ## block ## id ## _ ## reg_name
439 static const struct dce_hwseq_registers hwseq_reg = {
440 HWSEQ_DCE10_REG_LIST()
443 static const struct dce_hwseq_shift hwseq_shift = {
444 HWSEQ_DCE10_MASK_SH_LIST(__SHIFT)
447 static const struct dce_hwseq_mask hwseq_mask = {
448 HWSEQ_DCE10_MASK_SH_LIST(_MASK)
451 static struct dce_hwseq *dce100_hwseq_create(
452 struct dc_context *ctx)
454 struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL);
458 hws->regs = &hwseq_reg;
459 hws->shifts = &hwseq_shift;
460 hws->masks = &hwseq_mask;
465 static const struct resource_create_funcs res_create_funcs = {
466 .read_dce_straps = read_dce_straps,
467 .create_audio = create_audio,
468 .create_stream_encoder = dce100_stream_encoder_create,
469 .create_hwseq = dce100_hwseq_create,
472 #define mi_inst_regs(id) { \
473 MI_DCE8_REG_LIST(id), \
474 .MC_HUB_RDREQ_DMIF_LIMIT = mmMC_HUB_RDREQ_DMIF_LIMIT \
476 static const struct dce_mem_input_registers mi_regs[] = {
485 static const struct dce_mem_input_shift mi_shifts = {
486 MI_DCE8_MASK_SH_LIST(__SHIFT),
487 .ENABLE = MC_HUB_RDREQ_DMIF_LIMIT__ENABLE__SHIFT
490 static const struct dce_mem_input_mask mi_masks = {
491 MI_DCE8_MASK_SH_LIST(_MASK),
492 .ENABLE = MC_HUB_RDREQ_DMIF_LIMIT__ENABLE_MASK
495 static struct mem_input *dce100_mem_input_create(
496 struct dc_context *ctx,
499 struct dce_mem_input *dce_mi = kzalloc(sizeof(struct dce_mem_input),
507 dce_mem_input_construct(dce_mi, ctx, inst, &mi_regs[inst], &mi_shifts, &mi_masks);
508 dce_mi->wa.single_head_rdreq_dmif_limit = 2;
509 return &dce_mi->base;
512 static void dce100_transform_destroy(struct transform **xfm)
514 kfree(TO_DCE_TRANSFORM(*xfm));
518 static struct transform *dce100_transform_create(
519 struct dc_context *ctx,
522 struct dce_transform *transform =
523 kzalloc(sizeof(struct dce_transform), GFP_KERNEL);
528 dce_transform_construct(transform, ctx, inst,
529 &xfm_regs[inst], &xfm_shift, &xfm_mask);
530 return &transform->base;
533 static struct input_pixel_processor *dce100_ipp_create(
534 struct dc_context *ctx, uint32_t inst)
536 struct dce_ipp *ipp = kzalloc(sizeof(struct dce_ipp), GFP_KERNEL);
543 dce_ipp_construct(ipp, ctx, inst,
544 &ipp_regs[inst], &ipp_shift, &ipp_mask);
548 static const struct encoder_feature_support link_enc_feature = {
549 .max_hdmi_deep_color = COLOR_DEPTH_121212,
550 .max_hdmi_pixel_clock = 300000,
551 .flags.bits.IS_HBR2_CAPABLE = true,
552 .flags.bits.IS_TPS3_CAPABLE = true,
553 .flags.bits.IS_YCBCR_CAPABLE = true
556 struct link_encoder *dce100_link_encoder_create(
557 const struct encoder_init_data *enc_init_data)
559 struct dce110_link_encoder *enc110 =
560 kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL);
565 dce110_link_encoder_construct(enc110,
568 &link_enc_regs[enc_init_data->transmitter],
569 &link_enc_aux_regs[enc_init_data->channel - 1],
570 &link_enc_hpd_regs[enc_init_data->hpd_source]);
571 return &enc110->base;
574 struct output_pixel_processor *dce100_opp_create(
575 struct dc_context *ctx,
578 struct dce110_opp *opp =
579 kzalloc(sizeof(struct dce110_opp), GFP_KERNEL);
584 dce110_opp_construct(opp,
585 ctx, inst, &opp_regs[inst], &opp_shift, &opp_mask);
589 struct aux_engine *dce100_aux_engine_create(
590 struct dc_context *ctx,
593 struct aux_engine_dce110 *aux_engine =
594 kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL);
599 dce110_aux_engine_construct(aux_engine, ctx, inst,
600 SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD,
601 &aux_engine_regs[inst]);
603 return &aux_engine->base;
606 struct clock_source *dce100_clock_source_create(
607 struct dc_context *ctx,
608 struct dc_bios *bios,
609 enum clock_source_id id,
610 const struct dce110_clk_src_regs *regs,
613 struct dce110_clk_src *clk_src =
614 kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL);
619 if (dce110_clk_src_construct(clk_src, ctx, bios, id,
620 regs, &cs_shift, &cs_mask)) {
621 clk_src->base.dp_clk_src = dp_clk_src;
622 return &clk_src->base;
629 void dce100_clock_source_destroy(struct clock_source **clk_src)
631 kfree(TO_DCE110_CLK_SRC(*clk_src));
635 static void destruct(struct dce110_resource_pool *pool)
639 for (i = 0; i < pool->base.pipe_count; i++) {
640 if (pool->base.opps[i] != NULL)
641 dce110_opp_destroy(&pool->base.opps[i]);
643 if (pool->base.transforms[i] != NULL)
644 dce100_transform_destroy(&pool->base.transforms[i]);
646 if (pool->base.ipps[i] != NULL)
647 dce_ipp_destroy(&pool->base.ipps[i]);
649 if (pool->base.mis[i] != NULL) {
650 kfree(TO_DCE_MEM_INPUT(pool->base.mis[i]));
651 pool->base.mis[i] = NULL;
654 if (pool->base.timing_generators[i] != NULL) {
655 kfree(DCE110TG_FROM_TG(pool->base.timing_generators[i]));
656 pool->base.timing_generators[i] = NULL;
659 if (pool->base.engines[i] != NULL)
660 dce110_engine_destroy(&pool->base.engines[i]);
664 for (i = 0; i < pool->base.stream_enc_count; i++) {
665 if (pool->base.stream_enc[i] != NULL)
666 kfree(DCE110STRENC_FROM_STRENC(pool->base.stream_enc[i]));
669 for (i = 0; i < pool->base.clk_src_count; i++) {
670 if (pool->base.clock_sources[i] != NULL)
671 dce100_clock_source_destroy(&pool->base.clock_sources[i]);
674 if (pool->base.dp_clock_source != NULL)
675 dce100_clock_source_destroy(&pool->base.dp_clock_source);
677 for (i = 0; i < pool->base.audio_count; i++) {
678 if (pool->base.audios[i] != NULL)
679 dce_aud_destroy(&pool->base.audios[i]);
682 if (pool->base.dccg != NULL)
683 dce_dccg_destroy(&pool->base.dccg);
685 if (pool->base.abm != NULL)
686 dce_abm_destroy(&pool->base.abm);
688 if (pool->base.dmcu != NULL)
689 dce_dmcu_destroy(&pool->base.dmcu);
691 if (pool->base.irqs != NULL)
692 dal_irq_service_destroy(&pool->base.irqs);
695 static enum dc_status build_mapped_resource(
697 struct dc_state *context,
698 struct dc_stream_state *stream)
700 struct pipe_ctx *pipe_ctx = resource_get_head_pipe_for_stream(&context->res_ctx, stream);
703 return DC_ERROR_UNEXPECTED;
705 dce110_resource_build_pipe_hw_param(pipe_ctx);
707 resource_build_info_frame(pipe_ctx);
712 bool dce100_validate_bandwidth(
714 struct dc_state *context)
717 bool at_least_one_pipe = false;
719 for (i = 0; i < dc->res_pool->pipe_count; i++) {
720 if (context->res_ctx.pipe_ctx[i].stream)
721 at_least_one_pipe = true;
724 if (at_least_one_pipe) {
725 /* 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;
729 context->bw.dce.dispclk_khz = 0;
730 context->bw.dce.yclk_khz = 0;
736 static bool dce100_validate_surface_sets(
737 struct dc_state *context)
741 for (i = 0; i < context->stream_count; i++) {
742 if (context->stream_status[i].plane_count == 0)
745 if (context->stream_status[i].plane_count > 1)
748 if (context->stream_status[i].plane_states[0]->format
749 >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
756 enum dc_status dce100_validate_global(
758 struct dc_state *context)
760 if (!dce100_validate_surface_sets(context))
761 return DC_FAIL_SURFACE_VALIDATE;
766 enum dc_status dce100_add_stream_to_ctx(
768 struct dc_state *new_ctx,
769 struct dc_stream_state *dc_stream)
771 enum dc_status result = DC_ERROR_UNEXPECTED;
773 result = resource_map_pool_resources(dc, new_ctx, dc_stream);
776 result = resource_map_clock_resources(dc, new_ctx, dc_stream);
779 result = build_mapped_resource(dc, new_ctx, dc_stream);
784 static void dce100_destroy_resource_pool(struct resource_pool **pool)
786 struct dce110_resource_pool *dce110_pool = TO_DCE110_RES_POOL(*pool);
788 destruct(dce110_pool);
793 enum dc_status dce100_validate_plane(const struct dc_plane_state *plane_state, struct dc_caps *caps)
796 if (plane_state->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
799 return DC_FAIL_SURFACE_VALIDATE;
802 static const struct resource_funcs dce100_res_pool_funcs = {
803 .destroy = dce100_destroy_resource_pool,
804 .link_enc_create = dce100_link_encoder_create,
805 .validate_bandwidth = dce100_validate_bandwidth,
806 .validate_plane = dce100_validate_plane,
807 .add_stream_to_ctx = dce100_add_stream_to_ctx,
808 .validate_global = dce100_validate_global
811 static bool construct(
812 uint8_t num_virtual_links,
814 struct dce110_resource_pool *pool)
817 struct dc_context *ctx = dc->ctx;
818 struct dc_firmware_info info;
820 struct dm_pp_static_clock_info static_clk_info = {0};
822 ctx->dc_bios->regs = &bios_regs;
824 pool->base.res_cap = &res_cap;
825 pool->base.funcs = &dce100_res_pool_funcs;
826 pool->base.underlay_pipe_index = NO_UNDERLAY_PIPE;
830 if ((bp->funcs->get_firmware_info(bp, &info) == BP_RESULT_OK) &&
831 info.external_clock_source_frequency_for_dp != 0) {
832 pool->base.dp_clock_source =
833 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_EXTERNAL, NULL, true);
835 pool->base.clock_sources[0] =
836 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], false);
837 pool->base.clock_sources[1] =
838 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
839 pool->base.clock_sources[2] =
840 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
841 pool->base.clk_src_count = 3;
844 pool->base.dp_clock_source =
845 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL0, &clk_src_regs[0], true);
847 pool->base.clock_sources[0] =
848 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL1, &clk_src_regs[1], false);
849 pool->base.clock_sources[1] =
850 dce100_clock_source_create(ctx, bp, CLOCK_SOURCE_ID_PLL2, &clk_src_regs[2], false);
851 pool->base.clk_src_count = 2;
854 if (pool->base.dp_clock_source == NULL) {
855 dm_error("DC: failed to create dp clock source!\n");
857 goto res_create_fail;
860 for (i = 0; i < pool->base.clk_src_count; i++) {
861 if (pool->base.clock_sources[i] == NULL) {
862 dm_error("DC: failed to create clock sources!\n");
864 goto res_create_fail;
868 pool->base.dccg = dce_dccg_create(ctx,
872 if (pool->base.dccg == NULL) {
873 dm_error("DC: failed to create display clock!\n");
875 goto res_create_fail;
878 pool->base.dmcu = dce_dmcu_create(ctx,
882 if (pool->base.dmcu == NULL) {
883 dm_error("DC: failed to create dmcu!\n");
885 goto res_create_fail;
888 pool->base.abm = dce_abm_create(ctx,
892 if (pool->base.abm == NULL) {
893 dm_error("DC: failed to create abm!\n");
895 goto res_create_fail;
898 /* get static clock information for PPLIB or firmware, save
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;
905 struct irq_service_init_data init_data;
906 init_data.ctx = dc->ctx;
907 pool->base.irqs = dal_irq_service_dce110_create(&init_data);
908 if (!pool->base.irqs)
909 goto res_create_fail;
912 /*************************************************
913 * Resource + asic cap harcoding *
914 *************************************************/
915 pool->base.underlay_pipe_index = NO_UNDERLAY_PIPE;
916 pool->base.pipe_count = res_cap.num_timing_generator;
917 pool->base.timing_generator_count = pool->base.res_cap->num_timing_generator;
918 dc->caps.max_downscale_ratio = 200;
919 dc->caps.i2c_speed_in_khz = 40;
920 dc->caps.max_cursor_size = 128;
921 dc->caps.dual_link_dvi = true;
922 dc->caps.disable_dp_clk_share = true;
923 for (i = 0; i < pool->base.pipe_count; i++) {
924 pool->base.timing_generators[i] =
925 dce100_timing_generator_create(
928 &dce100_tg_offsets[i]);
929 if (pool->base.timing_generators[i] == NULL) {
931 dm_error("DC: failed to create tg!\n");
932 goto res_create_fail;
935 pool->base.mis[i] = dce100_mem_input_create(ctx, i);
936 if (pool->base.mis[i] == NULL) {
939 "DC: failed to create memory input!\n");
940 goto res_create_fail;
943 pool->base.ipps[i] = dce100_ipp_create(ctx, i);
944 if (pool->base.ipps[i] == NULL) {
947 "DC: failed to create input pixel processor!\n");
948 goto res_create_fail;
951 pool->base.transforms[i] = dce100_transform_create(ctx, i);
952 if (pool->base.transforms[i] == NULL) {
955 "DC: failed to create transform!\n");
956 goto res_create_fail;
959 pool->base.opps[i] = dce100_opp_create(ctx, i);
960 if (pool->base.opps[i] == NULL) {
963 "DC: failed to create output pixel processor!\n");
964 goto res_create_fail;
966 pool->base.engines[i] = dce100_aux_engine_create(ctx, i);
967 if (pool->base.engines[i] == NULL) {
970 "DC:failed to create aux engine!!\n");
971 goto res_create_fail;
975 dc->caps.max_planes = pool->base.pipe_count;
977 if (!resource_construct(num_virtual_links, dc, &pool->base,
979 goto res_create_fail;
981 /* Create hardware sequencer */
982 dce100_hw_sequencer_construct(dc);
991 struct resource_pool *dce100_create_resource_pool(
992 uint8_t num_virtual_links,
995 struct dce110_resource_pool *pool =
996 kzalloc(sizeof(struct dce110_resource_pool), GFP_KERNEL);
1001 if (construct(num_virtual_links, dc, pool))
1005 BREAK_TO_DEBUGGER();