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

drm/amd/display: Get num_chans from VBIOS table

Get the values from VBIOS table

Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Alvin Lee and committed by
Alex Deucher
d31bdabb 1ed0b2dd

+110 -1
+98
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
··· 1378 1378 return NULL; 1379 1379 } 1380 1380 1381 + static enum bp_result get_vram_info_v23( 1382 + struct bios_parser *bp, 1383 + struct dc_vram_info *info) 1384 + { 1385 + struct atom_vram_info_header_v2_3 *info_v23; 1386 + enum bp_result result = BP_RESULT_OK; 1387 + 1388 + info_v23 = GET_IMAGE(struct atom_vram_info_header_v2_3, 1389 + DATA_TABLES(vram_info)); 1390 + 1391 + if (info_v23 == NULL) 1392 + return BP_RESULT_BADBIOSTABLE; 1393 + 1394 + info->num_chans = info_v23->vram_module[0].channel_num; 1395 + info->dram_channel_width_bytes = (1 << info_v23->vram_module[0].channel_width) / 8; 1396 + 1397 + return result; 1398 + } 1399 + 1400 + static enum bp_result get_vram_info_v24( 1401 + struct bios_parser *bp, 1402 + struct dc_vram_info *info) 1403 + { 1404 + struct atom_vram_info_header_v2_4 *info_v24; 1405 + enum bp_result result = BP_RESULT_OK; 1406 + 1407 + info_v24 = GET_IMAGE(struct atom_vram_info_header_v2_4, 1408 + DATA_TABLES(vram_info)); 1409 + 1410 + if (info_v24 == NULL) 1411 + return BP_RESULT_BADBIOSTABLE; 1412 + 1413 + info->num_chans = info_v24->vram_module[0].channel_num; 1414 + info->dram_channel_width_bytes = (1 << info_v24->vram_module[0].channel_width) / 8; 1415 + 1416 + return result; 1417 + } 1418 + 1419 + static enum bp_result get_vram_info_v25( 1420 + struct bios_parser *bp, 1421 + struct dc_vram_info *info) 1422 + { 1423 + struct atom_vram_info_header_v2_5 *info_v25; 1424 + enum bp_result result = BP_RESULT_OK; 1425 + 1426 + info_v25 = GET_IMAGE(struct atom_vram_info_header_v2_5, 1427 + DATA_TABLES(vram_info)); 1428 + 1429 + if (info_v25 == NULL) 1430 + return BP_RESULT_BADBIOSTABLE; 1431 + 1432 + info->num_chans = info_v25->vram_module[0].channel_num; 1433 + info->dram_channel_width_bytes = (1 << info_v25->vram_module[0].channel_width) / 8; 1434 + 1435 + return result; 1436 + } 1437 + 1381 1438 /* 1382 1439 * get_integrated_info_v11 1383 1440 * ··· 1723 1666 } 1724 1667 } 1725 1668 1669 + return result; 1670 + } 1671 + 1672 + static enum bp_result bios_parser_get_vram_info( 1673 + struct dc_bios *dcb, 1674 + struct dc_vram_info *info) 1675 + { 1676 + struct bios_parser *bp = BP_FROM_DCB(dcb); 1677 + enum bp_result result = BP_RESULT_BADBIOSTABLE; 1678 + struct atom_common_table_header *header; 1679 + struct atom_data_revision revision; 1680 + 1681 + if (info && DATA_TABLES(vram_info)) { 1682 + header = GET_IMAGE(struct atom_common_table_header, 1683 + DATA_TABLES(vram_info)); 1684 + 1685 + get_atom_data_table_revision(header, &revision); 1686 + 1687 + switch (revision.major) { 1688 + case 2: 1689 + switch (revision.minor) { 1690 + case 3: 1691 + result = get_vram_info_v23(bp, info); 1692 + break; 1693 + case 4: 1694 + result = get_vram_info_v24(bp, info); 1695 + break; 1696 + case 5: 1697 + result = get_vram_info_v25(bp, info); 1698 + break; 1699 + default: 1700 + break; 1701 + } 1702 + break; 1703 + 1704 + default: 1705 + return result; 1706 + } 1707 + 1708 + } 1726 1709 return result; 1727 1710 } 1728 1711 ··· 2209 2112 2210 2113 bp->base.integrated_info = bios_parser_create_integrated_info(&bp->base); 2211 2114 bp->base.fw_info_valid = bios_parser_get_firmware_info(&bp->base, &bp->base.fw_info) == BP_RESULT_OK; 2115 + bios_parser_get_vram_info(&bp->base, &bp->base.vram_info); 2212 2116 2213 2117 return true; 2214 2118 }
+1
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
··· 153 153 struct integrated_info *integrated_info; 154 154 struct dc_firmware_info fw_info; 155 155 bool fw_info_valid; 156 + struct dc_vram_info vram_info; 156 157 }; 157 158 158 159 #endif /* DC_BIOS_TYPES_H */
+6 -1
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
··· 195 195 .max_avg_dram_bw_use_normal_percent = 40.0, 196 196 .writeback_latency_us = 12.0, 197 197 .max_request_size_bytes = 256, 198 - .dram_channel_width_bytes = 2, 199 198 .fabric_datapath_to_dcn_data_return_bytes = 64, 200 199 .dcn_downspread_percent = 0.5, 201 200 .downspread_percent = 0.38, ··· 2240 2241 static void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params) 2241 2242 { 2242 2243 unsigned int i; 2244 + 2245 + if (dc->ctx->dc_bios->vram_info.num_chans) 2246 + dcn3_0_soc.num_chans = dc->ctx->dc_bios->vram_info.num_chans; 2247 + 2248 + if (dc->ctx->dc_bios->vram_info.dram_channel_width_bytes) 2249 + dcn3_0_soc.dram_channel_width_bytes = dc->ctx->dc_bios->vram_info.dram_channel_width_bytes; 2243 2250 2244 2251 dcn3_0_soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0; 2245 2252 dc->dml.soc.dispclk_dppclk_vco_speed_mhz = dc->clk_mgr->dentist_vco_freq_khz / 1000.0;
+5
drivers/gpu/drm/amd/display/include/grph_object_ctrl_defs.h
··· 183 183 184 184 }; 185 185 186 + struct dc_vram_info { 187 + unsigned int num_chans; 188 + unsigned int dram_channel_width_bytes; 189 + }; 190 + 186 191 struct step_and_delay_info { 187 192 uint32_t step; 188 193 uint32_t delay;