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.
26 #include <linux/slab.h>
28 #include "dce/dce_8_0_d.h"
29 #include "dce/dce_8_0_sh_mask.h"
31 #include "dm_services.h"
33 #include "link_encoder.h"
34 #include "stream_encoder.h"
37 #include "include/irq_service_interface.h"
38 #include "irq/dce80/irq_service_dce80.h"
39 #include "dce110/dce110_timing_generator.h"
40 #include "dce110/dce110_resource.h"
41 #include "dce80/dce80_timing_generator.h"
42 #include "dce/dce_mem_input.h"
43 #include "dce/dce_link_encoder.h"
44 #include "dce/dce_stream_encoder.h"
45 #include "dce/dce_ipp.h"
46 #include "dce/dce_transform.h"
47 #include "dce/dce_opp.h"
48 #include "dce/dce_clock_source.h"
49 #include "dce/dce_audio.h"
50 #include "dce/dce_hwseq.h"
51 #include "dce80/dce80_hw_sequencer.h"
52 #include "dce100/dce100_resource.h"
53 #include "dce/dce_panel_cntl.h"
55 #include "reg_helper.h"
57 #include "dce/dce_dmcu.h"
58 #include "dce/dce_aux.h"
59 #include "dce/dce_abm.h"
60 #include "dce/dce_i2c.h"
61 /* TODO remove this include */
63 #ifndef mmMC_HUB_RDREQ_DMIF_LIMIT
64 #include "gmc/gmc_7_1_d.h"
65 #include "gmc/gmc_7_1_sh_mask.h"
68 #ifndef mmDP_DPHY_INTERNAL_CTRL
69 #define mmDP_DPHY_INTERNAL_CTRL 0x1CDE
70 #define mmDP0_DP_DPHY_INTERNAL_CTRL 0x1CDE
71 #define mmDP1_DP_DPHY_INTERNAL_CTRL 0x1FDE
72 #define mmDP2_DP_DPHY_INTERNAL_CTRL 0x42DE
73 #define mmDP3_DP_DPHY_INTERNAL_CTRL 0x45DE
74 #define mmDP4_DP_DPHY_INTERNAL_CTRL 0x48DE
75 #define mmDP5_DP_DPHY_INTERNAL_CTRL 0x4BDE
76 #define mmDP6_DP_DPHY_INTERNAL_CTRL 0x4EDE
80 #ifndef mmBIOS_SCRATCH_2
81 #define mmBIOS_SCRATCH_2 0x05CB
82 #define mmBIOS_SCRATCH_3 0x05CC
83 #define mmBIOS_SCRATCH_6 0x05CF
86 #ifndef mmDP_DPHY_FAST_TRAINING
87 #define mmDP_DPHY_FAST_TRAINING 0x1CCE
88 #define mmDP0_DP_DPHY_FAST_TRAINING 0x1CCE
89 #define mmDP1_DP_DPHY_FAST_TRAINING 0x1FCE
90 #define mmDP2_DP_DPHY_FAST_TRAINING 0x42CE
91 #define mmDP3_DP_DPHY_FAST_TRAINING 0x45CE
92 #define mmDP4_DP_DPHY_FAST_TRAINING 0x48CE
93 #define mmDP5_DP_DPHY_FAST_TRAINING 0x4BCE
94 #define mmDP6_DP_DPHY_FAST_TRAINING 0x4ECE
98 #ifndef mmHPD_DC_HPD_CONTROL
99 #define mmHPD_DC_HPD_CONTROL 0x189A
100 #define mmHPD0_DC_HPD_CONTROL 0x189A
101 #define mmHPD1_DC_HPD_CONTROL 0x18A2
102 #define mmHPD2_DC_HPD_CONTROL 0x18AA
103 #define mmHPD3_DC_HPD_CONTROL 0x18B2
104 #define mmHPD4_DC_HPD_CONTROL 0x18BA
105 #define mmHPD5_DC_HPD_CONTROL 0x18C2
108 #define DCE11_DIG_FE_CNTL 0x4a00
109 #define DCE11_DIG_BE_CNTL 0x4a47
110 #define DCE11_DP_SEC 0x4ac3
112 static const struct dce110_timing_generator_offsets dce80_tg_offsets
[] = {
114 .crtc
= (mmCRTC0_CRTC_CONTROL
- mmCRTC_CONTROL
),
115 .dcp
= (mmGRPH_CONTROL
- mmGRPH_CONTROL
),
116 .dmif
= (mmDMIF_PG0_DPG_WATERMARK_MASK_CONTROL
117 - mmDPG_WATERMARK_MASK_CONTROL
),
120 .crtc
= (mmCRTC1_CRTC_CONTROL
- mmCRTC_CONTROL
),
121 .dcp
= (mmDCP1_GRPH_CONTROL
- mmGRPH_CONTROL
),
122 .dmif
= (mmDMIF_PG1_DPG_WATERMARK_MASK_CONTROL
123 - mmDPG_WATERMARK_MASK_CONTROL
),
126 .crtc
= (mmCRTC2_CRTC_CONTROL
- mmCRTC_CONTROL
),
127 .dcp
= (mmDCP2_GRPH_CONTROL
- mmGRPH_CONTROL
),
128 .dmif
= (mmDMIF_PG2_DPG_WATERMARK_MASK_CONTROL
129 - mmDPG_WATERMARK_MASK_CONTROL
),
132 .crtc
= (mmCRTC3_CRTC_CONTROL
- mmCRTC_CONTROL
),
133 .dcp
= (mmDCP3_GRPH_CONTROL
- mmGRPH_CONTROL
),
134 .dmif
= (mmDMIF_PG3_DPG_WATERMARK_MASK_CONTROL
135 - mmDPG_WATERMARK_MASK_CONTROL
),
138 .crtc
= (mmCRTC4_CRTC_CONTROL
- mmCRTC_CONTROL
),
139 .dcp
= (mmDCP4_GRPH_CONTROL
- mmGRPH_CONTROL
),
140 .dmif
= (mmDMIF_PG4_DPG_WATERMARK_MASK_CONTROL
141 - mmDPG_WATERMARK_MASK_CONTROL
),
144 .crtc
= (mmCRTC5_CRTC_CONTROL
- mmCRTC_CONTROL
),
145 .dcp
= (mmDCP5_GRPH_CONTROL
- mmGRPH_CONTROL
),
146 .dmif
= (mmDMIF_PG5_DPG_WATERMARK_MASK_CONTROL
147 - mmDPG_WATERMARK_MASK_CONTROL
),
151 /* set register offset */
152 #define SR(reg_name)\
153 .reg_name = mm ## reg_name
155 /* set register offset with instance */
156 #define SRI(reg_name, block, id)\
157 .reg_name = mm ## block ## id ## _ ## reg_name
159 #define ipp_regs(id)\
161 IPP_COMMON_REG_LIST_DCE_BASE(id)\
164 static const struct dce_ipp_registers ipp_regs
[] = {
173 static const struct dce_ipp_shift ipp_shift
= {
174 IPP_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT
)
177 static const struct dce_ipp_mask ipp_mask
= {
178 IPP_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK
)
181 #define transform_regs(id)\
183 XFM_COMMON_REG_LIST_DCE80(id)\
186 static const struct dce_transform_registers xfm_regs
[] = {
195 static const struct dce_transform_shift xfm_shift
= {
196 XFM_COMMON_MASK_SH_LIST_DCE80(__SHIFT
)
199 static const struct dce_transform_mask xfm_mask
= {
200 XFM_COMMON_MASK_SH_LIST_DCE80(_MASK
)
203 #define aux_regs(id)\
208 static const struct dce110_link_enc_aux_registers link_enc_aux_regs
[] = {
217 #define hpd_regs(id)\
222 static const struct dce110_link_enc_hpd_registers link_enc_hpd_regs
[] = {
231 #define link_regs(id)\
233 LE_DCE80_REG_LIST(id)\
236 static const struct dce110_link_enc_registers link_enc_regs
[] = {
246 #define stream_enc_regs(id)\
248 SE_COMMON_REG_LIST_DCE_BASE(id),\
252 static const struct dce110_stream_enc_registers stream_enc_regs
[] = {
262 static const struct dce_stream_encoder_shift se_shift
= {
263 SE_COMMON_MASK_SH_LIST_DCE80_100(__SHIFT
)
266 static const struct dce_stream_encoder_mask se_mask
= {
267 SE_COMMON_MASK_SH_LIST_DCE80_100(_MASK
)
270 static const struct dce_panel_cntl_registers panel_cntl_regs
[] = {
271 { DCE_PANEL_CNTL_REG_LIST() }
274 static const struct dce_panel_cntl_shift panel_cntl_shift
= {
275 DCE_PANEL_CNTL_MASK_SH_LIST(__SHIFT
)
278 static const struct dce_panel_cntl_mask panel_cntl_mask
= {
279 DCE_PANEL_CNTL_MASK_SH_LIST(_MASK
)
282 #define opp_regs(id)\
284 OPP_DCE_80_REG_LIST(id),\
287 static const struct dce_opp_registers opp_regs
[] = {
296 static const struct dce_opp_shift opp_shift
= {
297 OPP_COMMON_MASK_SH_LIST_DCE_80(__SHIFT
)
300 static const struct dce_opp_mask opp_mask
= {
301 OPP_COMMON_MASK_SH_LIST_DCE_80(_MASK
)
304 static const struct dce110_aux_registers_shift aux_shift
= {
305 DCE10_AUX_MASK_SH_LIST(__SHIFT
)
308 static const struct dce110_aux_registers_mask aux_mask
= {
309 DCE10_AUX_MASK_SH_LIST(_MASK
)
312 #define aux_engine_regs(id)\
314 AUX_COMMON_REG_LIST(id), \
315 .AUX_RESET_MASK = 0 \
318 static const struct dce110_aux_registers aux_engine_regs
[] = {
327 #define audio_regs(id)\
329 AUD_COMMON_REG_LIST(id)\
332 static const struct dce_audio_registers audio_regs
[] = {
342 static const struct dce_audio_shift audio_shift
= {
343 AUD_COMMON_MASK_SH_LIST(__SHIFT
)
346 static const struct dce_audio_mask audio_mask
= {
347 AUD_COMMON_MASK_SH_LIST(_MASK
)
350 #define clk_src_regs(id)\
352 CS_COMMON_REG_LIST_DCE_80(id),\
356 static const struct dce110_clk_src_regs clk_src_regs
[] = {
362 static const struct dce110_clk_src_shift cs_shift
= {
363 CS_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT
)
366 static const struct dce110_clk_src_mask cs_mask
= {
367 CS_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK
)
370 static const struct bios_registers bios_regs
= {
371 .BIOS_SCRATCH_3
= mmBIOS_SCRATCH_3
,
372 .BIOS_SCRATCH_6
= mmBIOS_SCRATCH_6
375 static const struct resource_caps res_cap
= {
376 .num_timing_generator
= 6,
378 .num_stream_encoder
= 6,
383 static const struct resource_caps res_cap_81
= {
384 .num_timing_generator
= 4,
386 .num_stream_encoder
= 7,
391 static const struct resource_caps res_cap_83
= {
392 .num_timing_generator
= 2,
394 .num_stream_encoder
= 6,
399 static const struct dc_plane_cap plane_cap
= {
400 .type
= DC_PLANE_TYPE_DCE_RGB
,
402 .pixel_format_support
= {
408 .max_upscale_factor
= {
414 .max_downscale_factor
= {
421 static const struct dce_dmcu_registers dmcu_regs
= {
422 DMCU_DCE80_REG_LIST()
425 static const struct dce_dmcu_shift dmcu_shift
= {
426 DMCU_MASK_SH_LIST_DCE80(__SHIFT
)
429 static const struct dce_dmcu_mask dmcu_mask
= {
430 DMCU_MASK_SH_LIST_DCE80(_MASK
)
432 static const struct dce_abm_registers abm_regs
= {
433 ABM_DCE110_COMMON_REG_LIST()
436 static const struct dce_abm_shift abm_shift
= {
437 ABM_MASK_SH_LIST_DCE110(__SHIFT
)
440 static const struct dce_abm_mask abm_mask
= {
441 ABM_MASK_SH_LIST_DCE110(_MASK
)
445 #define REG(reg) mm ## reg
447 #ifndef mmCC_DC_HDMI_STRAPS
448 #define mmCC_DC_HDMI_STRAPS 0x1918
449 #define CC_DC_HDMI_STRAPS__HDMI_DISABLE_MASK 0x40
450 #define CC_DC_HDMI_STRAPS__HDMI_DISABLE__SHIFT 0x6
451 #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER_MASK 0x700
452 #define CC_DC_HDMI_STRAPS__AUDIO_STREAM_NUMBER__SHIFT 0x8
455 static int map_transmitter_id_to_phy_instance(
456 enum transmitter transmitter
)
458 switch (transmitter
) {
459 case TRANSMITTER_UNIPHY_A
:
461 case TRANSMITTER_UNIPHY_B
:
463 case TRANSMITTER_UNIPHY_C
:
465 case TRANSMITTER_UNIPHY_D
:
467 case TRANSMITTER_UNIPHY_E
:
469 case TRANSMITTER_UNIPHY_F
:
471 case TRANSMITTER_UNIPHY_G
:
479 static void read_dce_straps(
480 struct dc_context
*ctx
,
481 struct resource_straps
*straps
)
483 REG_GET_2(CC_DC_HDMI_STRAPS
,
484 HDMI_DISABLE
, &straps
->hdmi_disable
,
485 AUDIO_STREAM_NUMBER
, &straps
->audio_stream_number
);
487 REG_GET(DC_PINSTRAPS
, DC_PINSTRAPS_AUDIO
, &straps
->dc_pinstraps_audio
);
490 static struct audio
*create_audio(
491 struct dc_context
*ctx
, unsigned int inst
)
493 return dce_audio_create(ctx
, inst
,
494 &audio_regs
[inst
], &audio_shift
, &audio_mask
);
497 static struct timing_generator
*dce80_timing_generator_create(
498 struct dc_context
*ctx
,
500 const struct dce110_timing_generator_offsets
*offsets
)
502 struct dce110_timing_generator
*tg110
=
503 kzalloc(sizeof(struct dce110_timing_generator
), GFP_KERNEL
);
508 dce80_timing_generator_construct(tg110
, ctx
, instance
, offsets
);
512 static struct output_pixel_processor
*dce80_opp_create(
513 struct dc_context
*ctx
,
516 struct dce110_opp
*opp
=
517 kzalloc(sizeof(struct dce110_opp
), GFP_KERNEL
);
522 dce110_opp_construct(opp
,
523 ctx
, inst
, &opp_regs
[inst
], &opp_shift
, &opp_mask
);
527 struct dce_aux
*dce80_aux_engine_create(
528 struct dc_context
*ctx
,
531 struct aux_engine_dce110
*aux_engine
=
532 kzalloc(sizeof(struct aux_engine_dce110
), GFP_KERNEL
);
537 dce110_aux_engine_construct(aux_engine
, ctx
, inst
,
538 SW_AUX_TIMEOUT_PERIOD_MULTIPLIER
* AUX_TIMEOUT_PERIOD
,
539 &aux_engine_regs
[inst
],
542 ctx
->dc
->caps
.extended_aux_timeout_support
);
544 return &aux_engine
->base
;
546 #define i2c_inst_regs(id) { I2C_HW_ENGINE_COMMON_REG_LIST(id) }
548 static const struct dce_i2c_registers i2c_hw_regs
[] = {
557 static const struct dce_i2c_shift i2c_shifts
= {
558 I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT
)
561 static const struct dce_i2c_mask i2c_masks
= {
562 I2C_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK
)
565 struct dce_i2c_hw
*dce80_i2c_hw_create(
566 struct dc_context
*ctx
,
569 struct dce_i2c_hw
*dce_i2c_hw
=
570 kzalloc(sizeof(struct dce_i2c_hw
), GFP_KERNEL
);
575 dce_i2c_hw_construct(dce_i2c_hw
, ctx
, inst
,
576 &i2c_hw_regs
[inst
], &i2c_shifts
, &i2c_masks
);
581 struct dce_i2c_sw
*dce80_i2c_sw_create(
582 struct dc_context
*ctx
)
584 struct dce_i2c_sw
*dce_i2c_sw
=
585 kzalloc(sizeof(struct dce_i2c_sw
), GFP_KERNEL
);
590 dce_i2c_sw_construct(dce_i2c_sw
, ctx
);
594 static struct stream_encoder
*dce80_stream_encoder_create(
595 enum engine_id eng_id
,
596 struct dc_context
*ctx
)
598 struct dce110_stream_encoder
*enc110
=
599 kzalloc(sizeof(struct dce110_stream_encoder
), GFP_KERNEL
);
604 dce110_stream_encoder_construct(enc110
, ctx
, ctx
->dc_bios
, eng_id
,
605 &stream_enc_regs
[eng_id
],
606 &se_shift
, &se_mask
);
607 return &enc110
->base
;
610 #define SRII(reg_name, block, id)\
611 .reg_name[id] = mm ## block ## id ## _ ## reg_name
613 static const struct dce_hwseq_registers hwseq_reg
= {
614 HWSEQ_DCE8_REG_LIST()
617 static const struct dce_hwseq_shift hwseq_shift
= {
618 HWSEQ_DCE8_MASK_SH_LIST(__SHIFT
)
621 static const struct dce_hwseq_mask hwseq_mask
= {
622 HWSEQ_DCE8_MASK_SH_LIST(_MASK
)
625 static struct dce_hwseq
*dce80_hwseq_create(
626 struct dc_context
*ctx
)
628 struct dce_hwseq
*hws
= kzalloc(sizeof(struct dce_hwseq
), GFP_KERNEL
);
632 hws
->regs
= &hwseq_reg
;
633 hws
->shifts
= &hwseq_shift
;
634 hws
->masks
= &hwseq_mask
;
639 static const struct resource_create_funcs res_create_funcs
= {
640 .read_dce_straps
= read_dce_straps
,
641 .create_audio
= create_audio
,
642 .create_stream_encoder
= dce80_stream_encoder_create
,
643 .create_hwseq
= dce80_hwseq_create
,
646 #define mi_inst_regs(id) { \
647 MI_DCE8_REG_LIST(id), \
648 .MC_HUB_RDREQ_DMIF_LIMIT = mmMC_HUB_RDREQ_DMIF_LIMIT \
650 static const struct dce_mem_input_registers mi_regs
[] = {
659 static const struct dce_mem_input_shift mi_shifts
= {
660 MI_DCE8_MASK_SH_LIST(__SHIFT
),
661 .ENABLE
= MC_HUB_RDREQ_DMIF_LIMIT__ENABLE__SHIFT
664 static const struct dce_mem_input_mask mi_masks
= {
665 MI_DCE8_MASK_SH_LIST(_MASK
),
666 .ENABLE
= MC_HUB_RDREQ_DMIF_LIMIT__ENABLE_MASK
669 static struct mem_input
*dce80_mem_input_create(
670 struct dc_context
*ctx
,
673 struct dce_mem_input
*dce_mi
= kzalloc(sizeof(struct dce_mem_input
),
681 dce_mem_input_construct(dce_mi
, ctx
, inst
, &mi_regs
[inst
], &mi_shifts
, &mi_masks
);
682 dce_mi
->wa
.single_head_rdreq_dmif_limit
= 2;
683 return &dce_mi
->base
;
686 static void dce80_transform_destroy(struct transform
**xfm
)
688 kfree(TO_DCE_TRANSFORM(*xfm
));
692 static struct transform
*dce80_transform_create(
693 struct dc_context
*ctx
,
696 struct dce_transform
*transform
=
697 kzalloc(sizeof(struct dce_transform
), GFP_KERNEL
);
702 dce_transform_construct(transform
, ctx
, inst
,
703 &xfm_regs
[inst
], &xfm_shift
, &xfm_mask
);
704 transform
->prescaler_on
= false;
705 return &transform
->base
;
708 static const struct encoder_feature_support link_enc_feature
= {
709 .max_hdmi_deep_color
= COLOR_DEPTH_121212
,
710 .max_hdmi_pixel_clock
= 297000,
711 .flags
.bits
.IS_HBR2_CAPABLE
= true,
712 .flags
.bits
.IS_TPS3_CAPABLE
= true
715 struct link_encoder
*dce80_link_encoder_create(
716 const struct encoder_init_data
*enc_init_data
)
718 struct dce110_link_encoder
*enc110
=
719 kzalloc(sizeof(struct dce110_link_encoder
), GFP_KERNEL
);
726 map_transmitter_id_to_phy_instance(enc_init_data
->transmitter
);
728 dce110_link_encoder_construct(enc110
,
731 &link_enc_regs
[link_regs_id
],
732 &link_enc_aux_regs
[enc_init_data
->channel
- 1],
733 &link_enc_hpd_regs
[enc_init_data
->hpd_source
]);
734 return &enc110
->base
;
737 static struct panel_cntl
*dce80_panel_cntl_create(const struct panel_cntl_init_data
*init_data
)
739 struct dce_panel_cntl
*panel_cntl
=
740 kzalloc(sizeof(struct dce_panel_cntl
), GFP_KERNEL
);
745 dce_panel_cntl_construct(panel_cntl
,
747 &panel_cntl_regs
[init_data
->inst
],
751 return &panel_cntl
->base
;
754 struct clock_source
*dce80_clock_source_create(
755 struct dc_context
*ctx
,
756 struct dc_bios
*bios
,
757 enum clock_source_id id
,
758 const struct dce110_clk_src_regs
*regs
,
761 struct dce110_clk_src
*clk_src
=
762 kzalloc(sizeof(struct dce110_clk_src
), GFP_KERNEL
);
767 if (dce110_clk_src_construct(clk_src
, ctx
, bios
, id
,
768 regs
, &cs_shift
, &cs_mask
)) {
769 clk_src
->base
.dp_clk_src
= dp_clk_src
;
770 return &clk_src
->base
;
778 void dce80_clock_source_destroy(struct clock_source
**clk_src
)
780 kfree(TO_DCE110_CLK_SRC(*clk_src
));
784 static struct input_pixel_processor
*dce80_ipp_create(
785 struct dc_context
*ctx
, uint32_t inst
)
787 struct dce_ipp
*ipp
= kzalloc(sizeof(struct dce_ipp
), GFP_KERNEL
);
794 dce_ipp_construct(ipp
, ctx
, inst
,
795 &ipp_regs
[inst
], &ipp_shift
, &ipp_mask
);
799 static void dce80_resource_destruct(struct dce110_resource_pool
*pool
)
803 for (i
= 0; i
< pool
->base
.pipe_count
; i
++) {
804 if (pool
->base
.opps
[i
] != NULL
)
805 dce110_opp_destroy(&pool
->base
.opps
[i
]);
807 if (pool
->base
.transforms
[i
] != NULL
)
808 dce80_transform_destroy(&pool
->base
.transforms
[i
]);
810 if (pool
->base
.ipps
[i
] != NULL
)
811 dce_ipp_destroy(&pool
->base
.ipps
[i
]);
813 if (pool
->base
.mis
[i
] != NULL
) {
814 kfree(TO_DCE_MEM_INPUT(pool
->base
.mis
[i
]));
815 pool
->base
.mis
[i
] = NULL
;
818 if (pool
->base
.timing_generators
[i
] != NULL
) {
819 kfree(DCE110TG_FROM_TG(pool
->base
.timing_generators
[i
]));
820 pool
->base
.timing_generators
[i
] = NULL
;
824 for (i
= 0; i
< pool
->base
.res_cap
->num_ddc
; i
++) {
825 if (pool
->base
.engines
[i
] != NULL
)
826 dce110_engine_destroy(&pool
->base
.engines
[i
]);
827 if (pool
->base
.hw_i2cs
[i
] != NULL
) {
828 kfree(pool
->base
.hw_i2cs
[i
]);
829 pool
->base
.hw_i2cs
[i
] = NULL
;
831 if (pool
->base
.sw_i2cs
[i
] != NULL
) {
832 kfree(pool
->base
.sw_i2cs
[i
]);
833 pool
->base
.sw_i2cs
[i
] = NULL
;
837 for (i
= 0; i
< pool
->base
.stream_enc_count
; i
++) {
838 if (pool
->base
.stream_enc
[i
] != NULL
)
839 kfree(DCE110STRENC_FROM_STRENC(pool
->base
.stream_enc
[i
]));
842 for (i
= 0; i
< pool
->base
.clk_src_count
; i
++) {
843 if (pool
->base
.clock_sources
[i
] != NULL
) {
844 dce80_clock_source_destroy(&pool
->base
.clock_sources
[i
]);
848 if (pool
->base
.abm
!= NULL
)
849 dce_abm_destroy(&pool
->base
.abm
);
851 if (pool
->base
.dmcu
!= NULL
)
852 dce_dmcu_destroy(&pool
->base
.dmcu
);
854 if (pool
->base
.dp_clock_source
!= NULL
)
855 dce80_clock_source_destroy(&pool
->base
.dp_clock_source
);
857 for (i
= 0; i
< pool
->base
.audio_count
; i
++) {
858 if (pool
->base
.audios
[i
] != NULL
) {
859 dce_aud_destroy(&pool
->base
.audios
[i
]);
863 if (pool
->base
.irqs
!= NULL
) {
864 dal_irq_service_destroy(&pool
->base
.irqs
);
868 bool dce80_validate_bandwidth(
870 struct dc_state
*context
,
874 bool at_least_one_pipe
= false;
876 for (i
= 0; i
< dc
->res_pool
->pipe_count
; i
++) {
877 if (context
->res_ctx
.pipe_ctx
[i
].stream
)
878 at_least_one_pipe
= true;
881 if (at_least_one_pipe
) {
882 /* TODO implement when needed but for now hardcode max value*/
883 context
->bw_ctx
.bw
.dce
.dispclk_khz
= 681000;
884 context
->bw_ctx
.bw
.dce
.yclk_khz
= 250000 * MEMORY_TYPE_MULTIPLIER_CZ
;
886 context
->bw_ctx
.bw
.dce
.dispclk_khz
= 0;
887 context
->bw_ctx
.bw
.dce
.yclk_khz
= 0;
893 static bool dce80_validate_surface_sets(
894 struct dc_state
*context
)
898 for (i
= 0; i
< context
->stream_count
; i
++) {
899 if (context
->stream_status
[i
].plane_count
== 0)
902 if (context
->stream_status
[i
].plane_count
> 1)
905 if (context
->stream_status
[i
].plane_states
[0]->format
906 >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN
)
913 enum dc_status
dce80_validate_global(
915 struct dc_state
*context
)
917 if (!dce80_validate_surface_sets(context
))
918 return DC_FAIL_SURFACE_VALIDATE
;
923 static void dce80_destroy_resource_pool(struct resource_pool
**pool
)
925 struct dce110_resource_pool
*dce110_pool
= TO_DCE110_RES_POOL(*pool
);
927 dce80_resource_destruct(dce110_pool
);
932 static const struct resource_funcs dce80_res_pool_funcs
= {
933 .destroy
= dce80_destroy_resource_pool
,
934 .link_enc_create
= dce80_link_encoder_create
,
935 .panel_cntl_create
= dce80_panel_cntl_create
,
936 .validate_bandwidth
= dce80_validate_bandwidth
,
937 .validate_plane
= dce100_validate_plane
,
938 .add_stream_to_ctx
= dce100_add_stream_to_ctx
,
939 .validate_global
= dce80_validate_global
,
940 .find_first_free_match_stream_enc_for_link
= dce100_find_first_free_match_stream_enc_for_link
943 static bool dce80_construct(
944 uint8_t num_virtual_links
,
946 struct dce110_resource_pool
*pool
)
949 struct dc_context
*ctx
= dc
->ctx
;
952 ctx
->dc_bios
->regs
= &bios_regs
;
954 pool
->base
.res_cap
= &res_cap
;
955 pool
->base
.funcs
= &dce80_res_pool_funcs
;
958 /*************************************************
959 * Resource + asic cap harcoding *
960 *************************************************/
961 pool
->base
.underlay_pipe_index
= NO_UNDERLAY_PIPE
;
962 pool
->base
.pipe_count
= res_cap
.num_timing_generator
;
963 pool
->base
.timing_generator_count
= res_cap
.num_timing_generator
;
964 dc
->caps
.max_downscale_ratio
= 200;
965 dc
->caps
.i2c_speed_in_khz
= 40;
966 dc
->caps
.i2c_speed_in_khz_hdcp
= 40;
967 dc
->caps
.max_cursor_size
= 128;
968 dc
->caps
.min_horizontal_blanking_period
= 80;
969 dc
->caps
.dual_link_dvi
= true;
970 dc
->caps
.extended_aux_timeout_support
= false;
972 /*************************************************
974 *************************************************/
978 if (bp
->fw_info_valid
&& bp
->fw_info
.external_clock_source_frequency_for_dp
!= 0) {
979 pool
->base
.dp_clock_source
=
980 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_EXTERNAL
, NULL
, true);
982 pool
->base
.clock_sources
[0] =
983 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL0
, &clk_src_regs
[0], false);
984 pool
->base
.clock_sources
[1] =
985 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[1], false);
986 pool
->base
.clock_sources
[2] =
987 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[2], false);
988 pool
->base
.clk_src_count
= 3;
991 pool
->base
.dp_clock_source
=
992 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL0
, &clk_src_regs
[0], true);
994 pool
->base
.clock_sources
[0] =
995 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[1], false);
996 pool
->base
.clock_sources
[1] =
997 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[2], false);
998 pool
->base
.clk_src_count
= 2;
1001 if (pool
->base
.dp_clock_source
== NULL
) {
1002 dm_error("DC: failed to create dp clock source!\n");
1003 BREAK_TO_DEBUGGER();
1004 goto res_create_fail
;
1007 for (i
= 0; i
< pool
->base
.clk_src_count
; i
++) {
1008 if (pool
->base
.clock_sources
[i
] == NULL
) {
1009 dm_error("DC: failed to create clock sources!\n");
1010 BREAK_TO_DEBUGGER();
1011 goto res_create_fail
;
1015 pool
->base
.dmcu
= dce_dmcu_create(ctx
,
1019 if (pool
->base
.dmcu
== NULL
) {
1020 dm_error("DC: failed to create dmcu!\n");
1021 BREAK_TO_DEBUGGER();
1022 goto res_create_fail
;
1025 pool
->base
.abm
= dce_abm_create(ctx
,
1029 if (pool
->base
.abm
== NULL
) {
1030 dm_error("DC: failed to create abm!\n");
1031 BREAK_TO_DEBUGGER();
1032 goto res_create_fail
;
1036 struct irq_service_init_data init_data
;
1037 init_data
.ctx
= dc
->ctx
;
1038 pool
->base
.irqs
= dal_irq_service_dce80_create(&init_data
);
1039 if (!pool
->base
.irqs
)
1040 goto res_create_fail
;
1043 for (i
= 0; i
< pool
->base
.pipe_count
; i
++) {
1044 pool
->base
.timing_generators
[i
] = dce80_timing_generator_create(
1045 ctx
, i
, &dce80_tg_offsets
[i
]);
1046 if (pool
->base
.timing_generators
[i
] == NULL
) {
1047 BREAK_TO_DEBUGGER();
1048 dm_error("DC: failed to create tg!\n");
1049 goto res_create_fail
;
1052 pool
->base
.mis
[i
] = dce80_mem_input_create(ctx
, i
);
1053 if (pool
->base
.mis
[i
] == NULL
) {
1054 BREAK_TO_DEBUGGER();
1055 dm_error("DC: failed to create memory input!\n");
1056 goto res_create_fail
;
1059 pool
->base
.ipps
[i
] = dce80_ipp_create(ctx
, i
);
1060 if (pool
->base
.ipps
[i
] == NULL
) {
1061 BREAK_TO_DEBUGGER();
1062 dm_error("DC: failed to create input pixel processor!\n");
1063 goto res_create_fail
;
1066 pool
->base
.transforms
[i
] = dce80_transform_create(ctx
, i
);
1067 if (pool
->base
.transforms
[i
] == NULL
) {
1068 BREAK_TO_DEBUGGER();
1069 dm_error("DC: failed to create transform!\n");
1070 goto res_create_fail
;
1073 pool
->base
.opps
[i
] = dce80_opp_create(ctx
, i
);
1074 if (pool
->base
.opps
[i
] == NULL
) {
1075 BREAK_TO_DEBUGGER();
1076 dm_error("DC: failed to create output pixel processor!\n");
1077 goto res_create_fail
;
1081 for (i
= 0; i
< pool
->base
.res_cap
->num_ddc
; i
++) {
1082 pool
->base
.engines
[i
] = dce80_aux_engine_create(ctx
, i
);
1083 if (pool
->base
.engines
[i
] == NULL
) {
1084 BREAK_TO_DEBUGGER();
1086 "DC:failed to create aux engine!!\n");
1087 goto res_create_fail
;
1089 pool
->base
.hw_i2cs
[i
] = dce80_i2c_hw_create(ctx
, i
);
1090 if (pool
->base
.hw_i2cs
[i
] == NULL
) {
1091 BREAK_TO_DEBUGGER();
1093 "DC:failed to create i2c engine!!\n");
1094 goto res_create_fail
;
1096 pool
->base
.sw_i2cs
[i
] = dce80_i2c_sw_create(ctx
);
1097 if (pool
->base
.sw_i2cs
[i
] == NULL
) {
1098 BREAK_TO_DEBUGGER();
1100 "DC:failed to create sw i2c!!\n");
1101 goto res_create_fail
;
1105 dc
->caps
.max_planes
= pool
->base
.pipe_count
;
1107 for (i
= 0; i
< dc
->caps
.max_planes
; ++i
)
1108 dc
->caps
.planes
[i
] = plane_cap
;
1110 dc
->caps
.disable_dp_clk_share
= true;
1112 if (!resource_construct(num_virtual_links
, dc
, &pool
->base
,
1114 goto res_create_fail
;
1116 /* Create hardware sequencer */
1117 dce80_hw_sequencer_construct(dc
);
1122 dce80_resource_destruct(pool
);
1126 struct resource_pool
*dce80_create_resource_pool(
1127 uint8_t num_virtual_links
,
1130 struct dce110_resource_pool
*pool
=
1131 kzalloc(sizeof(struct dce110_resource_pool
), GFP_KERNEL
);
1136 if (dce80_construct(num_virtual_links
, dc
, pool
))
1139 BREAK_TO_DEBUGGER();
1143 static bool dce81_construct(
1144 uint8_t num_virtual_links
,
1146 struct dce110_resource_pool
*pool
)
1149 struct dc_context
*ctx
= dc
->ctx
;
1152 ctx
->dc_bios
->regs
= &bios_regs
;
1154 pool
->base
.res_cap
= &res_cap_81
;
1155 pool
->base
.funcs
= &dce80_res_pool_funcs
;
1158 /*************************************************
1159 * Resource + asic cap harcoding *
1160 *************************************************/
1161 pool
->base
.underlay_pipe_index
= NO_UNDERLAY_PIPE
;
1162 pool
->base
.pipe_count
= res_cap_81
.num_timing_generator
;
1163 pool
->base
.timing_generator_count
= res_cap_81
.num_timing_generator
;
1164 dc
->caps
.max_downscale_ratio
= 200;
1165 dc
->caps
.i2c_speed_in_khz
= 40;
1166 dc
->caps
.i2c_speed_in_khz_hdcp
= 40;
1167 dc
->caps
.max_cursor_size
= 128;
1168 dc
->caps
.min_horizontal_blanking_period
= 80;
1169 dc
->caps
.is_apu
= true;
1171 /*************************************************
1172 * Create resources *
1173 *************************************************/
1177 if (bp
->fw_info_valid
&& bp
->fw_info
.external_clock_source_frequency_for_dp
!= 0) {
1178 pool
->base
.dp_clock_source
=
1179 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_EXTERNAL
, NULL
, true);
1181 pool
->base
.clock_sources
[0] =
1182 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL0
, &clk_src_regs
[0], false);
1183 pool
->base
.clock_sources
[1] =
1184 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[1], false);
1185 pool
->base
.clock_sources
[2] =
1186 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[2], false);
1187 pool
->base
.clk_src_count
= 3;
1190 pool
->base
.dp_clock_source
=
1191 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL0
, &clk_src_regs
[0], true);
1193 pool
->base
.clock_sources
[0] =
1194 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[1], false);
1195 pool
->base
.clock_sources
[1] =
1196 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[2], false);
1197 pool
->base
.clk_src_count
= 2;
1200 if (pool
->base
.dp_clock_source
== NULL
) {
1201 dm_error("DC: failed to create dp clock source!\n");
1202 BREAK_TO_DEBUGGER();
1203 goto res_create_fail
;
1206 for (i
= 0; i
< pool
->base
.clk_src_count
; i
++) {
1207 if (pool
->base
.clock_sources
[i
] == NULL
) {
1208 dm_error("DC: failed to create clock sources!\n");
1209 BREAK_TO_DEBUGGER();
1210 goto res_create_fail
;
1214 pool
->base
.dmcu
= dce_dmcu_create(ctx
,
1218 if (pool
->base
.dmcu
== NULL
) {
1219 dm_error("DC: failed to create dmcu!\n");
1220 BREAK_TO_DEBUGGER();
1221 goto res_create_fail
;
1224 pool
->base
.abm
= dce_abm_create(ctx
,
1228 if (pool
->base
.abm
== NULL
) {
1229 dm_error("DC: failed to create abm!\n");
1230 BREAK_TO_DEBUGGER();
1231 goto res_create_fail
;
1235 struct irq_service_init_data init_data
;
1236 init_data
.ctx
= dc
->ctx
;
1237 pool
->base
.irqs
= dal_irq_service_dce80_create(&init_data
);
1238 if (!pool
->base
.irqs
)
1239 goto res_create_fail
;
1242 for (i
= 0; i
< pool
->base
.pipe_count
; i
++) {
1243 pool
->base
.timing_generators
[i
] = dce80_timing_generator_create(
1244 ctx
, i
, &dce80_tg_offsets
[i
]);
1245 if (pool
->base
.timing_generators
[i
] == NULL
) {
1246 BREAK_TO_DEBUGGER();
1247 dm_error("DC: failed to create tg!\n");
1248 goto res_create_fail
;
1251 pool
->base
.mis
[i
] = dce80_mem_input_create(ctx
, i
);
1252 if (pool
->base
.mis
[i
] == NULL
) {
1253 BREAK_TO_DEBUGGER();
1254 dm_error("DC: failed to create memory input!\n");
1255 goto res_create_fail
;
1258 pool
->base
.ipps
[i
] = dce80_ipp_create(ctx
, i
);
1259 if (pool
->base
.ipps
[i
] == NULL
) {
1260 BREAK_TO_DEBUGGER();
1261 dm_error("DC: failed to create input pixel processor!\n");
1262 goto res_create_fail
;
1265 pool
->base
.transforms
[i
] = dce80_transform_create(ctx
, i
);
1266 if (pool
->base
.transforms
[i
] == NULL
) {
1267 BREAK_TO_DEBUGGER();
1268 dm_error("DC: failed to create transform!\n");
1269 goto res_create_fail
;
1272 pool
->base
.opps
[i
] = dce80_opp_create(ctx
, i
);
1273 if (pool
->base
.opps
[i
] == NULL
) {
1274 BREAK_TO_DEBUGGER();
1275 dm_error("DC: failed to create output pixel processor!\n");
1276 goto res_create_fail
;
1280 for (i
= 0; i
< pool
->base
.res_cap
->num_ddc
; i
++) {
1281 pool
->base
.engines
[i
] = dce80_aux_engine_create(ctx
, i
);
1282 if (pool
->base
.engines
[i
] == NULL
) {
1283 BREAK_TO_DEBUGGER();
1285 "DC:failed to create aux engine!!\n");
1286 goto res_create_fail
;
1288 pool
->base
.hw_i2cs
[i
] = dce80_i2c_hw_create(ctx
, i
);
1289 if (pool
->base
.hw_i2cs
[i
] == NULL
) {
1290 BREAK_TO_DEBUGGER();
1292 "DC:failed to create i2c engine!!\n");
1293 goto res_create_fail
;
1295 pool
->base
.sw_i2cs
[i
] = dce80_i2c_sw_create(ctx
);
1296 if (pool
->base
.sw_i2cs
[i
] == NULL
) {
1297 BREAK_TO_DEBUGGER();
1299 "DC:failed to create sw i2c!!\n");
1300 goto res_create_fail
;
1304 dc
->caps
.max_planes
= pool
->base
.pipe_count
;
1306 for (i
= 0; i
< dc
->caps
.max_planes
; ++i
)
1307 dc
->caps
.planes
[i
] = plane_cap
;
1309 dc
->caps
.disable_dp_clk_share
= true;
1311 if (!resource_construct(num_virtual_links
, dc
, &pool
->base
,
1313 goto res_create_fail
;
1315 /* Create hardware sequencer */
1316 dce80_hw_sequencer_construct(dc
);
1321 dce80_resource_destruct(pool
);
1325 struct resource_pool
*dce81_create_resource_pool(
1326 uint8_t num_virtual_links
,
1329 struct dce110_resource_pool
*pool
=
1330 kzalloc(sizeof(struct dce110_resource_pool
), GFP_KERNEL
);
1335 if (dce81_construct(num_virtual_links
, dc
, pool
))
1338 BREAK_TO_DEBUGGER();
1342 static bool dce83_construct(
1343 uint8_t num_virtual_links
,
1345 struct dce110_resource_pool
*pool
)
1348 struct dc_context
*ctx
= dc
->ctx
;
1351 ctx
->dc_bios
->regs
= &bios_regs
;
1353 pool
->base
.res_cap
= &res_cap_83
;
1354 pool
->base
.funcs
= &dce80_res_pool_funcs
;
1357 /*************************************************
1358 * Resource + asic cap harcoding *
1359 *************************************************/
1360 pool
->base
.underlay_pipe_index
= NO_UNDERLAY_PIPE
;
1361 pool
->base
.pipe_count
= res_cap_83
.num_timing_generator
;
1362 pool
->base
.timing_generator_count
= res_cap_83
.num_timing_generator
;
1363 dc
->caps
.max_downscale_ratio
= 200;
1364 dc
->caps
.i2c_speed_in_khz
= 40;
1365 dc
->caps
.i2c_speed_in_khz_hdcp
= 40;
1366 dc
->caps
.max_cursor_size
= 128;
1367 dc
->caps
.min_horizontal_blanking_period
= 80;
1368 dc
->caps
.is_apu
= true;
1370 /*************************************************
1371 * Create resources *
1372 *************************************************/
1376 if (bp
->fw_info_valid
&& bp
->fw_info
.external_clock_source_frequency_for_dp
!= 0) {
1377 pool
->base
.dp_clock_source
=
1378 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_EXTERNAL
, NULL
, true);
1380 pool
->base
.clock_sources
[0] =
1381 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[0], false);
1382 pool
->base
.clock_sources
[1] =
1383 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[1], false);
1384 pool
->base
.clk_src_count
= 2;
1387 pool
->base
.dp_clock_source
=
1388 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL1
, &clk_src_regs
[0], true);
1390 pool
->base
.clock_sources
[0] =
1391 dce80_clock_source_create(ctx
, bp
, CLOCK_SOURCE_ID_PLL2
, &clk_src_regs
[1], false);
1392 pool
->base
.clk_src_count
= 1;
1395 if (pool
->base
.dp_clock_source
== NULL
) {
1396 dm_error("DC: failed to create dp clock source!\n");
1397 BREAK_TO_DEBUGGER();
1398 goto res_create_fail
;
1401 for (i
= 0; i
< pool
->base
.clk_src_count
; i
++) {
1402 if (pool
->base
.clock_sources
[i
] == NULL
) {
1403 dm_error("DC: failed to create clock sources!\n");
1404 BREAK_TO_DEBUGGER();
1405 goto res_create_fail
;
1409 pool
->base
.dmcu
= dce_dmcu_create(ctx
,
1413 if (pool
->base
.dmcu
== NULL
) {
1414 dm_error("DC: failed to create dmcu!\n");
1415 BREAK_TO_DEBUGGER();
1416 goto res_create_fail
;
1419 pool
->base
.abm
= dce_abm_create(ctx
,
1423 if (pool
->base
.abm
== NULL
) {
1424 dm_error("DC: failed to create abm!\n");
1425 BREAK_TO_DEBUGGER();
1426 goto res_create_fail
;
1430 struct irq_service_init_data init_data
;
1431 init_data
.ctx
= dc
->ctx
;
1432 pool
->base
.irqs
= dal_irq_service_dce80_create(&init_data
);
1433 if (!pool
->base
.irqs
)
1434 goto res_create_fail
;
1437 for (i
= 0; i
< pool
->base
.pipe_count
; i
++) {
1438 pool
->base
.timing_generators
[i
] = dce80_timing_generator_create(
1439 ctx
, i
, &dce80_tg_offsets
[i
]);
1440 if (pool
->base
.timing_generators
[i
] == NULL
) {
1441 BREAK_TO_DEBUGGER();
1442 dm_error("DC: failed to create tg!\n");
1443 goto res_create_fail
;
1446 pool
->base
.mis
[i
] = dce80_mem_input_create(ctx
, i
);
1447 if (pool
->base
.mis
[i
] == NULL
) {
1448 BREAK_TO_DEBUGGER();
1449 dm_error("DC: failed to create memory input!\n");
1450 goto res_create_fail
;
1453 pool
->base
.ipps
[i
] = dce80_ipp_create(ctx
, i
);
1454 if (pool
->base
.ipps
[i
] == NULL
) {
1455 BREAK_TO_DEBUGGER();
1456 dm_error("DC: failed to create input pixel processor!\n");
1457 goto res_create_fail
;
1460 pool
->base
.transforms
[i
] = dce80_transform_create(ctx
, i
);
1461 if (pool
->base
.transforms
[i
] == NULL
) {
1462 BREAK_TO_DEBUGGER();
1463 dm_error("DC: failed to create transform!\n");
1464 goto res_create_fail
;
1467 pool
->base
.opps
[i
] = dce80_opp_create(ctx
, i
);
1468 if (pool
->base
.opps
[i
] == NULL
) {
1469 BREAK_TO_DEBUGGER();
1470 dm_error("DC: failed to create output pixel processor!\n");
1471 goto res_create_fail
;
1475 for (i
= 0; i
< pool
->base
.res_cap
->num_ddc
; i
++) {
1476 pool
->base
.engines
[i
] = dce80_aux_engine_create(ctx
, i
);
1477 if (pool
->base
.engines
[i
] == NULL
) {
1478 BREAK_TO_DEBUGGER();
1480 "DC:failed to create aux engine!!\n");
1481 goto res_create_fail
;
1483 pool
->base
.hw_i2cs
[i
] = dce80_i2c_hw_create(ctx
, i
);
1484 if (pool
->base
.hw_i2cs
[i
] == NULL
) {
1485 BREAK_TO_DEBUGGER();
1487 "DC:failed to create i2c engine!!\n");
1488 goto res_create_fail
;
1490 pool
->base
.sw_i2cs
[i
] = dce80_i2c_sw_create(ctx
);
1491 if (pool
->base
.sw_i2cs
[i
] == NULL
) {
1492 BREAK_TO_DEBUGGER();
1494 "DC:failed to create sw i2c!!\n");
1495 goto res_create_fail
;
1499 dc
->caps
.max_planes
= pool
->base
.pipe_count
;
1501 for (i
= 0; i
< dc
->caps
.max_planes
; ++i
)
1502 dc
->caps
.planes
[i
] = plane_cap
;
1504 dc
->caps
.disable_dp_clk_share
= true;
1506 if (!resource_construct(num_virtual_links
, dc
, &pool
->base
,
1508 goto res_create_fail
;
1510 /* Create hardware sequencer */
1511 dce80_hw_sequencer_construct(dc
);
1516 dce80_resource_destruct(pool
);
1520 struct resource_pool
*dce83_create_resource_pool(
1521 uint8_t num_virtual_links
,
1524 struct dce110_resource_pool
*pool
=
1525 kzalloc(sizeof(struct dce110_resource_pool
), GFP_KERNEL
);
1530 if (dce83_construct(num_virtual_links
, dc
, pool
))
1533 BREAK_TO_DEBUGGER();