@@ -1374,64 +1374,49 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param
1374
1374
{
1375
1375
struct dcn21_resource_pool * pool = TO_DCN21_RES_POOL (dc -> res_pool );
1376
1376
struct clk_limit_table * clk_table = & bw_params -> clk_table ;
1377
- unsigned int i , j , k ;
1378
- int closest_clk_lvl ;
1377
+ struct _vcs_dpi_voltage_scaling_st clock_limits [ DC__VOLTAGE_STATES ] ;
1378
+ unsigned int i , j , closest_clk_lvl ;
1379
1379
1380
1380
// Default clock levels are used for diags, which may lead to overclocking.
1381
- if (!IS_FPGA_MAXIMUS_DC ( dc -> ctx -> dce_environment ) && ! IS_DIAG_DC (dc -> ctx -> dce_environment )) {
1381
+ if (!IS_DIAG_DC (dc -> ctx -> dce_environment )) {
1382
1382
dcn2_1_ip .max_num_otg = pool -> base .res_cap -> num_timing_generator ;
1383
1383
dcn2_1_ip .max_num_dpp = pool -> base .pipe_count ;
1384
1384
dcn2_1_soc .num_chans = bw_params -> num_channels ;
1385
1385
1386
- /* Vmin: leave lowest DCN clocks, override with dcfclk, fclk, memclk from fuse */
1387
- dcn2_1_soc .clock_limits [0 ].state = 0 ;
1388
- dcn2_1_soc .clock_limits [0 ].dcfclk_mhz = clk_table -> entries [0 ].dcfclk_mhz ;
1389
- dcn2_1_soc .clock_limits [0 ].fabricclk_mhz = clk_table -> entries [0 ].fclk_mhz ;
1390
- dcn2_1_soc .clock_limits [0 ].socclk_mhz = clk_table -> entries [0 ].socclk_mhz ;
1391
- dcn2_1_soc .clock_limits [0 ].dram_speed_mts = clk_table -> entries [0 ].memclk_mhz * 2 ;
1392
-
1393
- /*
1394
- * Other levels: find closest DCN clocks that fit the given clock limit using dcfclk
1395
- * as indicator
1396
- */
1397
-
1398
- closest_clk_lvl = -1 ;
1399
- /* index currently being filled */
1400
- k = 1 ;
1401
- for (i = 1 ; i < clk_table -> num_entries ; i ++ ) {
1402
- /* loop backwards, skip duplicate state*/
1403
- for (j = dcn2_1_soc .num_states - 1 ; j >= k ; j -- ) {
1386
+ ASSERT (clk_table -> num_entries );
1387
+ for (i = 0 ; i < clk_table -> num_entries ; i ++ ) {
1388
+ /* loop backwards*/
1389
+ for (closest_clk_lvl = 0 , j = dcn2_1_soc .num_states - 1 ; j >= 0 ; j -- ) {
1404
1390
if ((unsigned int ) dcn2_1_soc .clock_limits [j ].dcfclk_mhz <= clk_table -> entries [i ].dcfclk_mhz ) {
1405
1391
closest_clk_lvl = j ;
1406
1392
break ;
1407
1393
}
1408
1394
}
1409
1395
1410
- /* if found a lvl that fits, use the DCN clks from it, if not, go to next clk limit*/
1411
- if (closest_clk_lvl != -1 ) {
1412
- dcn2_1_soc .clock_limits [k ].state = i ;
1413
- dcn2_1_soc .clock_limits [k ].dcfclk_mhz = clk_table -> entries [i ].dcfclk_mhz ;
1414
- dcn2_1_soc .clock_limits [k ].fabricclk_mhz = clk_table -> entries [i ].fclk_mhz ;
1415
- dcn2_1_soc .clock_limits [k ].socclk_mhz = clk_table -> entries [i ].socclk_mhz ;
1416
- dcn2_1_soc .clock_limits [k ].dram_speed_mts = clk_table -> entries [i ].memclk_mhz * 2 ;
1417
-
1418
- dcn2_1_soc .clock_limits [k ].dispclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dispclk_mhz ;
1419
- dcn2_1_soc .clock_limits [k ].dppclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dppclk_mhz ;
1420
- dcn2_1_soc .clock_limits [k ].dram_bw_per_chan_gbps = dcn2_1_soc .clock_limits [closest_clk_lvl ].dram_bw_per_chan_gbps ;
1421
- dcn2_1_soc .clock_limits [k ].dscclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dscclk_mhz ;
1422
- dcn2_1_soc .clock_limits [k ].dtbclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dtbclk_mhz ;
1423
- dcn2_1_soc .clock_limits [k ].phyclk_d18_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].phyclk_d18_mhz ;
1424
- dcn2_1_soc .clock_limits [k ].phyclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].phyclk_mhz ;
1425
- k ++ ;
1426
- }
1396
+ clock_limits [i ].state = i ;
1397
+ clock_limits [i ].dcfclk_mhz = clk_table -> entries [i ].dcfclk_mhz ;
1398
+ clock_limits [i ].fabricclk_mhz = clk_table -> entries [i ].fclk_mhz ;
1399
+ clock_limits [i ].socclk_mhz = clk_table -> entries [i ].socclk_mhz ;
1400
+ clock_limits [i ].dram_speed_mts = clk_table -> entries [i ].memclk_mhz * 2 ;
1401
+
1402
+ clock_limits [i ].dispclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dispclk_mhz ;
1403
+ clock_limits [i ].dppclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dppclk_mhz ;
1404
+ clock_limits [i ].dram_bw_per_chan_gbps = dcn2_1_soc .clock_limits [closest_clk_lvl ].dram_bw_per_chan_gbps ;
1405
+ clock_limits [i ].dscclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dscclk_mhz ;
1406
+ clock_limits [i ].dtbclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].dtbclk_mhz ;
1407
+ clock_limits [i ].phyclk_d18_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].phyclk_d18_mhz ;
1408
+ clock_limits [i ].phyclk_mhz = dcn2_1_soc .clock_limits [closest_clk_lvl ].phyclk_mhz ;
1409
+ }
1410
+ for (i = 0 ; i < clk_table -> num_entries ; i ++ )
1411
+ dcn2_1_soc .clock_limits [i ] = clock_limits [i ];
1412
+ if (clk_table -> num_entries ) {
1413
+ dcn2_1_soc .num_states = clk_table -> num_entries ;
1414
+ /* duplicate last level */
1415
+ dcn2_1_soc .clock_limits [dcn2_1_soc .num_states ] = dcn2_1_soc .clock_limits [dcn2_1_soc .num_states - 1 ];
1416
+ dcn2_1_soc .clock_limits [dcn2_1_soc .num_states ].state = dcn2_1_soc .num_states ;
1427
1417
}
1428
- dcn2_1_soc .num_states = k ;
1429
1418
}
1430
1419
1431
- /* duplicate last level */
1432
- dcn2_1_soc .clock_limits [dcn2_1_soc .num_states ] = dcn2_1_soc .clock_limits [dcn2_1_soc .num_states - 1 ];
1433
- dcn2_1_soc .clock_limits [dcn2_1_soc .num_states ].state = dcn2_1_soc .num_states ;
1434
-
1435
1420
dml_init_instance (& dc -> dml , & dcn2_1_soc , & dcn2_1_ip , DML_PROJECT_DCN21 );
1436
1421
}
1437
1422
0 commit comments