Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: fix deep color ratio

Fix enum mapping for deep color ratio

Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Hansen Dsouza <Hansen.Dsouza@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Hansen Dsouza and committed by
Alex Deucher
df5a07c4 3b8b44a4

+111 -2
+100
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.c
··· 971 971 return true; 972 972 } 973 973 974 + #if defined(CONFIG_DRM_AMD_DC_DCN) 975 + static bool dcn31_program_pix_clk( 976 + struct clock_source *clock_source, 977 + struct pixel_clk_params *pix_clk_params, 978 + struct pll_settings *pll_settings) 979 + { 980 + struct dce110_clk_src *clk_src = TO_DCE110_CLK_SRC(clock_source); 981 + struct bp_pixel_clock_parameters bp_pc_params = {0}; 982 + enum transmitter_color_depth bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_24; 983 + 984 + if (IS_FPGA_MAXIMUS_DC(clock_source->ctx->dce_environment)) { 985 + unsigned int inst = pix_clk_params->controller_id - CONTROLLER_ID_D0; 986 + unsigned dp_dto_ref_100hz = 7000000; 987 + unsigned clock_100hz = pll_settings->actual_pix_clk_100hz; 988 + 989 + /* Set DTO values: phase = target clock, modulo = reference clock */ 990 + REG_WRITE(PHASE[inst], clock_100hz); 991 + REG_WRITE(MODULO[inst], dp_dto_ref_100hz); 992 + 993 + /* Enable DTO */ 994 + REG_UPDATE(PIXEL_RATE_CNTL[inst], DP_DTO0_ENABLE, 1); 995 + return true; 996 + } 997 + 998 + /*ATOMBIOS expects pixel rate adjusted by deep color ratio)*/ 999 + bp_pc_params.controller_id = pix_clk_params->controller_id; 1000 + bp_pc_params.pll_id = clock_source->id; 1001 + bp_pc_params.target_pixel_clock_100hz = pll_settings->actual_pix_clk_100hz; 1002 + bp_pc_params.encoder_object_id = pix_clk_params->encoder_object_id; 1003 + bp_pc_params.signal_type = pix_clk_params->signal_type; 1004 + 1005 + // Make sure we send the correct color depth to DMUB for HDMI 1006 + if (pix_clk_params->signal_type == SIGNAL_TYPE_HDMI_TYPE_A) { 1007 + switch (pix_clk_params->color_depth) { 1008 + case COLOR_DEPTH_888: 1009 + bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_24; 1010 + break; 1011 + case COLOR_DEPTH_101010: 1012 + bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_30; 1013 + break; 1014 + case COLOR_DEPTH_121212: 1015 + bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_36; 1016 + break; 1017 + case COLOR_DEPTH_161616: 1018 + bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_48; 1019 + break; 1020 + default: 1021 + bp_pc_colour_depth = TRANSMITTER_COLOR_DEPTH_24; 1022 + break; 1023 + } 1024 + bp_pc_params.color_depth = bp_pc_colour_depth; 1025 + } 1026 + 1027 + if (clock_source->id != CLOCK_SOURCE_ID_DP_DTO) { 1028 + bp_pc_params.flags.SET_GENLOCK_REF_DIV_SRC = 1029 + pll_settings->use_external_clk; 1030 + bp_pc_params.flags.SET_XTALIN_REF_SRC = 1031 + !pll_settings->use_external_clk; 1032 + if (pix_clk_params->flags.SUPPORT_YCBCR420) { 1033 + bp_pc_params.flags.SUPPORT_YUV_420 = 1; 1034 + } 1035 + } 1036 + if (clk_src->bios->funcs->set_pixel_clock( 1037 + clk_src->bios, &bp_pc_params) != BP_RESULT_OK) 1038 + return false; 1039 + /* Resync deep color DTO */ 1040 + if (clock_source->id != CLOCK_SOURCE_ID_DP_DTO) 1041 + dce112_program_pixel_clk_resync(clk_src, 1042 + pix_clk_params->signal_type, 1043 + pix_clk_params->color_depth, 1044 + pix_clk_params->flags.SUPPORT_YCBCR420); 1045 + 1046 + return true; 1047 + } 1048 + #endif 974 1049 975 1050 static bool dce110_clock_source_power_down( 976 1051 struct clock_source *clk_src) ··· 1277 1202 static const struct clock_source_funcs dcn3_clk_src_funcs = { 1278 1203 .cs_power_down = dce110_clock_source_power_down, 1279 1204 .program_pix_clk = dcn3_program_pix_clk, 1205 + .get_pix_clk_dividers = dcn3_get_pix_clk_dividers, 1206 + .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz 1207 + }; 1208 + 1209 + static const struct clock_source_funcs dcn31_clk_src_funcs = { 1210 + .cs_power_down = dce110_clock_source_power_down, 1211 + .program_pix_clk = dcn31_program_pix_clk, 1280 1212 .get_pix_clk_dividers = dcn3_get_pix_clk_dividers, 1281 1213 .get_pixel_clk_frequency_100hz = get_pixel_clk_frequency_100hz 1282 1214 }; ··· 1686 1604 bool ret = dce112_clk_src_construct(clk_src, ctx, bios, id, regs, cs_shift, cs_mask); 1687 1605 1688 1606 clk_src->base.funcs = &dcn3_clk_src_funcs; 1607 + 1608 + return ret; 1609 + } 1610 + #endif 1611 + 1612 + #if defined(CONFIG_DRM_AMD_DC_DCN) 1613 + bool dcn31_clk_src_construct( 1614 + struct dce110_clk_src *clk_src, 1615 + struct dc_context *ctx, 1616 + struct dc_bios *bios, 1617 + enum clock_source_id id, 1618 + const struct dce110_clk_src_regs *regs, 1619 + const struct dce110_clk_src_shift *cs_shift, 1620 + const struct dce110_clk_src_mask *cs_mask) 1621 + { 1622 + bool ret = dce112_clk_src_construct(clk_src, ctx, bios, id, regs, cs_shift, cs_mask); 1623 + 1624 + clk_src->base.funcs = &dcn31_clk_src_funcs; 1689 1625 1690 1626 return ret; 1691 1627 }
+9
drivers/gpu/drm/amd/display/dc/dce/dce_clock_source.h
··· 292 292 const struct dce110_clk_src_regs *regs, 293 293 const struct dce110_clk_src_shift *cs_shift, 294 294 const struct dce110_clk_src_mask *cs_mask); 295 + 296 + bool dcn31_clk_src_construct( 297 + struct dce110_clk_src *clk_src, 298 + struct dc_context *ctx, 299 + struct dc_bios *bios, 300 + enum clock_source_id id, 301 + const struct dce110_clk_src_regs *regs, 302 + const struct dce110_clk_src_shift *cs_shift, 303 + const struct dce110_clk_src_mask *cs_mask); 295 304 #endif 296 305 297 306 /* this table is use to find *1.001 and /1.001 pixel rates from non-precise pixel rate */
+1 -1
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c
··· 2177 2177 if (!clk_src) 2178 2178 return NULL; 2179 2179 2180 - if (dcn3_clk_src_construct(clk_src, ctx, bios, id, 2180 + if (dcn31_clk_src_construct(clk_src, ctx, bios, id, 2181 2181 regs, &cs_shift, &cs_mask)) { 2182 2182 clk_src->base.dp_clk_src = dp_clk_src; 2183 2183 return &clk_src->base;
+1 -1
drivers/gpu/drm/amd/display/dc/dcn316/dcn316_resource.c
··· 1759 1759 if (!clk_src) 1760 1760 return NULL; 1761 1761 1762 - if (dcn3_clk_src_construct(clk_src, ctx, bios, id, 1762 + if (dcn31_clk_src_construct(clk_src, ctx, bios, id, 1763 1763 regs, &cs_shift, &cs_mask)) { 1764 1764 clk_src->base.dp_clk_src = dp_clk_src; 1765 1765 return &clk_src->base;