aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2018-10-23 02:31:38 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-10-25 15:03:35 -0400
commit7dc94969e165464896366fcb096f4be18ba56f44 (patch)
treed11df917aed9394c06b8ed9ef5697e5b7598446f
parent1a0e348e5693b7acde02e50319b3237657b7981a (diff)
drm/amd/powerplay: correct the clocks for DAL to be Khz unit
Currently the clocks reported are in 10Khz unit. Correct them as Khz unit as DAL wanted. Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Feifei Xu<Feifei.Xu@amd.com> Reviewed-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index 4c9a1a9ef04b..8a1ee9ce7386 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -2012,7 +2012,6 @@ int vega20_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
2012 if (data->smu_features[GNLD_DPM_DCEFCLK].enabled) { 2012 if (data->smu_features[GNLD_DPM_DCEFCLK].enabled) {
2013 switch (clk_type) { 2013 switch (clk_type) {
2014 case amd_pp_dcef_clock: 2014 case amd_pp_dcef_clock:
2015 clk_freq = clock_req->clock_freq_in_khz / 100;
2016 clk_select = PPCLK_DCEFCLK; 2015 clk_select = PPCLK_DCEFCLK;
2017 break; 2016 break;
2018 case amd_pp_disp_clock: 2017 case amd_pp_disp_clock:
@@ -2072,7 +2071,7 @@ static int vega20_notify_smc_display_config_after_ps_adjustment(
2072 2071
2073 if (data->smu_features[GNLD_DPM_DCEFCLK].supported) { 2072 if (data->smu_features[GNLD_DPM_DCEFCLK].supported) {
2074 clock_req.clock_type = amd_pp_dcef_clock; 2073 clock_req.clock_type = amd_pp_dcef_clock;
2075 clock_req.clock_freq_in_khz = min_clocks.dcefClock; 2074 clock_req.clock_freq_in_khz = min_clocks.dcefClock * 10;
2076 if (!vega20_display_clock_voltage_request(hwmgr, &clock_req)) { 2075 if (!vega20_display_clock_voltage_request(hwmgr, &clock_req)) {
2077 if (data->smu_features[GNLD_DS_DCEFCLK].supported) 2076 if (data->smu_features[GNLD_DS_DCEFCLK].supported)
2078 PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter( 2077 PP_ASSERT_WITH_CODE((ret = smum_send_msg_to_smc_with_parameter(
@@ -2371,7 +2370,7 @@ static int vega20_get_sclks(struct pp_hwmgr *hwmgr,
2371 2370
2372 for (i = 0; i < count; i++) { 2371 for (i = 0; i < count; i++) {
2373 clocks->data[i].clocks_in_khz = 2372 clocks->data[i].clocks_in_khz =
2374 dpm_table->dpm_levels[i].value * 100; 2373 dpm_table->dpm_levels[i].value * 1000;
2375 clocks->data[i].latency_in_us = 0; 2374 clocks->data[i].latency_in_us = 0;
2376 } 2375 }
2377 2376
@@ -2401,7 +2400,7 @@ static int vega20_get_memclocks(struct pp_hwmgr *hwmgr,
2401 for (i = 0; i < count; i++) { 2400 for (i = 0; i < count; i++) {
2402 clocks->data[i].clocks_in_khz = 2401 clocks->data[i].clocks_in_khz =
2403 data->mclk_latency_table.entries[i].frequency = 2402 data->mclk_latency_table.entries[i].frequency =
2404 dpm_table->dpm_levels[i].value * 100; 2403 dpm_table->dpm_levels[i].value * 1000;
2405 clocks->data[i].latency_in_us = 2404 clocks->data[i].latency_in_us =
2406 data->mclk_latency_table.entries[i].latency = 2405 data->mclk_latency_table.entries[i].latency =
2407 vega20_get_mem_latency(hwmgr, dpm_table->dpm_levels[i].value); 2406 vega20_get_mem_latency(hwmgr, dpm_table->dpm_levels[i].value);
@@ -2426,7 +2425,7 @@ static int vega20_get_dcefclocks(struct pp_hwmgr *hwmgr,
2426 2425
2427 for (i = 0; i < count; i++) { 2426 for (i = 0; i < count; i++) {
2428 clocks->data[i].clocks_in_khz = 2427 clocks->data[i].clocks_in_khz =
2429 dpm_table->dpm_levels[i].value * 100; 2428 dpm_table->dpm_levels[i].value * 1000;
2430 clocks->data[i].latency_in_us = 0; 2429 clocks->data[i].latency_in_us = 0;
2431 } 2430 }
2432 2431
@@ -2449,7 +2448,7 @@ static int vega20_get_socclocks(struct pp_hwmgr *hwmgr,
2449 2448
2450 for (i = 0; i < count; i++) { 2449 for (i = 0; i < count; i++) {
2451 clocks->data[i].clocks_in_khz = 2450 clocks->data[i].clocks_in_khz =
2452 dpm_table->dpm_levels[i].value * 100; 2451 dpm_table->dpm_levels[i].value * 1000;
2453 clocks->data[i].latency_in_us = 0; 2452 clocks->data[i].latency_in_us = 0;
2454 } 2453 }
2455 2454
@@ -2600,11 +2599,11 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,
2600 return -EINVAL; 2599 return -EINVAL;
2601 } 2600 }
2602 2601
2603 if (input_clk < clocks.data[0].clocks_in_khz / 100 || 2602 if (input_clk < clocks.data[0].clocks_in_khz / 1000 ||
2604 input_clk > od8_settings[OD8_SETTING_UCLK_FMAX].max_value) { 2603 input_clk > od8_settings[OD8_SETTING_UCLK_FMAX].max_value) {
2605 pr_info("clock freq %d is not within allowed range [%d - %d]\n", 2604 pr_info("clock freq %d is not within allowed range [%d - %d]\n",
2606 input_clk, 2605 input_clk,
2607 clocks.data[0].clocks_in_khz / 100, 2606 clocks.data[0].clocks_in_khz / 1000,
2608 od8_settings[OD8_SETTING_UCLK_FMAX].max_value); 2607 od8_settings[OD8_SETTING_UCLK_FMAX].max_value);
2609 return -EINVAL; 2608 return -EINVAL;
2610 } 2609 }
@@ -2756,7 +2755,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
2756 2755
2757 for (i = 0; i < clocks.num_levels; i++) 2756 for (i = 0; i < clocks.num_levels; i++)
2758 size += sprintf(buf + size, "%d: %uMhz %s\n", 2757 size += sprintf(buf + size, "%d: %uMhz %s\n",
2759 i, clocks.data[i].clocks_in_khz / 100, 2758 i, clocks.data[i].clocks_in_khz / 1000,
2760 (clocks.data[i].clocks_in_khz == now) ? "*" : ""); 2759 (clocks.data[i].clocks_in_khz == now) ? "*" : "");
2761 break; 2760 break;
2762 2761
@@ -2773,7 +2772,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
2773 2772
2774 for (i = 0; i < clocks.num_levels; i++) 2773 for (i = 0; i < clocks.num_levels; i++)
2775 size += sprintf(buf + size, "%d: %uMhz %s\n", 2774 size += sprintf(buf + size, "%d: %uMhz %s\n",
2776 i, clocks.data[i].clocks_in_khz / 100, 2775 i, clocks.data[i].clocks_in_khz / 1000,
2777 (clocks.data[i].clocks_in_khz == now) ? "*" : ""); 2776 (clocks.data[i].clocks_in_khz == now) ? "*" : "");
2778 break; 2777 break;
2779 2778
@@ -2838,7 +2837,7 @@ static int vega20_print_clock_levels(struct pp_hwmgr *hwmgr,
2838 return ret); 2837 return ret);
2839 2838
2840 size += sprintf(buf + size, "MCLK: %7uMhz %10uMhz\n", 2839 size += sprintf(buf + size, "MCLK: %7uMhz %10uMhz\n",
2841 clocks.data[0].clocks_in_khz / 100, 2840 clocks.data[0].clocks_in_khz / 1000,
2842 od8_settings[OD8_SETTING_UCLK_FMAX].max_value); 2841 od8_settings[OD8_SETTING_UCLK_FMAX].max_value);
2843 } 2842 }
2844 2843