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

drm/amd/display: get socBB from VBIOS

[why]
Some SOC BB paramters may vary per SKU, and it does
not make sense for driver to hardcode these values

[how]
Parse the values from VBIOS if available, and use
them if valid

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Jun Lei and committed by
Alex Deucher
93669c8e e9462a32

+96 -1
+70 -1
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
··· 847 847 return result; 848 848 } 849 849 850 + static enum bp_result get_soc_bb_info_v4_4( 851 + struct bios_parser *bp, 852 + struct bp_soc_bb_info *soc_bb_info) 853 + { 854 + enum bp_result result = BP_RESULT_OK; 855 + struct atom_display_controller_info_v4_4 *disp_cntl_tbl = NULL; 856 + 857 + if (!soc_bb_info) 858 + return BP_RESULT_BADINPUT; 859 + 860 + if (!DATA_TABLES(dce_info)) 861 + return BP_RESULT_BADBIOSTABLE; 862 + 863 + if (!DATA_TABLES(smu_info)) 864 + return BP_RESULT_BADBIOSTABLE; 865 + 866 + disp_cntl_tbl = GET_IMAGE(struct atom_display_controller_info_v4_4, 867 + DATA_TABLES(dce_info)); 868 + if (!disp_cntl_tbl) 869 + return BP_RESULT_BADBIOSTABLE; 870 + 871 + soc_bb_info->dram_clock_change_latency_100ns = disp_cntl_tbl->max_mclk_chg_lat; 872 + soc_bb_info->dram_sr_enter_exit_latency_100ns = disp_cntl_tbl->max_sr_enter_exit_lat; 873 + soc_bb_info->dram_sr_exit_latency_100ns = disp_cntl_tbl->max_sr_exit_lat; 874 + 875 + return result; 876 + } 877 + 878 + static enum bp_result bios_parser_get_soc_bb_info( 879 + struct dc_bios *dcb, 880 + struct bp_soc_bb_info *soc_bb_info) 881 + { 882 + struct bios_parser *bp = BP_FROM_DCB(dcb); 883 + enum bp_result result = BP_RESULT_UNSUPPORTED; 884 + struct atom_common_table_header *header; 885 + struct atom_data_revision tbl_revision; 886 + 887 + if (!soc_bb_info) /* check for bad input */ 888 + return BP_RESULT_BADINPUT; 889 + 890 + if (!DATA_TABLES(dce_info)) 891 + return BP_RESULT_UNSUPPORTED; 892 + 893 + header = GET_IMAGE(struct atom_common_table_header, 894 + DATA_TABLES(dce_info)); 895 + get_atom_data_table_revision(header, &tbl_revision); 896 + 897 + switch (tbl_revision.major) { 898 + case 4: 899 + switch (tbl_revision.minor) { 900 + case 1: 901 + case 2: 902 + case 3: 903 + break; 904 + case 4: 905 + result = get_soc_bb_info_v4_4(bp, soc_bb_info); 906 + default: 907 + break; 908 + } 909 + break; 910 + default: 911 + break; 912 + } 913 + 914 + return result; 915 + } 916 + 850 917 static enum bp_result get_embedded_panel_info_v2_1( 851 918 struct bios_parser *bp, 852 919 struct embedded_panel_info *info) ··· 2289 2222 2290 2223 .get_atom_dc_golden_table = bios_get_atom_dc_golden_table, 2291 2224 2292 - .enable_lvtma_control = bios_parser_enable_lvtma_control 2225 + .enable_lvtma_control = bios_parser_enable_lvtma_control, 2226 + 2227 + .get_soc_bb_info = bios_parser_get_soc_bb_info, 2293 2228 }; 2294 2229 2295 2230 static bool bios_parser2_construct(
+4
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
··· 140 140 enum bp_result (*enable_lvtma_control)( 141 141 struct dc_bios *bios, 142 142 uint8_t uc_pwr_on); 143 + 144 + enum bp_result (*get_soc_bb_info)( 145 + struct dc_bios *dcb, 146 + struct bp_soc_bb_info *soc_bb_info); 143 147 }; 144 148 145 149 struct bios_registers {
+16
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c
··· 1828 1828 loaded_ip->max_num_dpp = pool->base.pipe_count; 1829 1829 loaded_ip->clamp_min_dcfclk = dc->config.clamp_min_dcfclk; 1830 1830 dcn20_patch_bounding_box(dc, loaded_bb); 1831 + 1832 + if (!bb && dc->ctx->dc_bios->funcs->get_soc_bb_info) { 1833 + struct bp_soc_bb_info bb_info = {0}; 1834 + 1835 + if (dc->ctx->dc_bios->funcs->get_soc_bb_info(dc->ctx->dc_bios, &bb_info) == BP_RESULT_OK) { 1836 + if (bb_info.dram_clock_change_latency_100ns > 0) 1837 + dcn3_0_soc.dram_clock_change_latency_us = bb_info.dram_clock_change_latency_100ns * 10; 1838 + 1839 + if (bb_info.dram_sr_enter_exit_latency_100ns > 0) 1840 + dcn3_0_soc.sr_enter_plus_exit_time_us = bb_info.dram_sr_enter_exit_latency_100ns * 10; 1841 + 1842 + if (bb_info.dram_sr_exit_latency_100ns > 0) 1843 + dcn3_0_soc.sr_exit_time_us = bb_info.dram_sr_exit_latency_100ns * 10; 1844 + } 1845 + } 1846 + 1831 1847 return true; 1832 1848 } 1833 1849
+6
drivers/gpu/drm/amd/display/include/bios_parser_types.h
··· 318 318 uint32_t RESERVED:27; 319 319 }; 320 320 321 + struct bp_soc_bb_info { 322 + uint32_t dram_clock_change_latency_100ns; 323 + uint32_t dram_sr_exit_latency_100ns; 324 + uint32_t dram_sr_enter_exit_latency_100ns; 325 + }; 326 + 321 327 #endif /*__DAL_BIOS_PARSER_TYPES_H__ */