drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_latency
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Jan 2020 18:19:51 +0000 (13:19 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Feb 2020 15:37:52 +0000 (10:37 -0500)
Only send non-0 clocks to DC for validation.  This mirrors
what the windows driver does.

Bug: https://gitlab.freedesktop.org/drm/amd/issues/963
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c

index 4e8ab13..273126c 100644 (file)
@@ -1026,12 +1026,15 @@ static int smu10_get_clock_by_type_with_latency(struct pp_hwmgr *hwmgr,
 
        clocks->num_levels = 0;
        for (i = 0; i < pclk_vol_table->count; i++) {
-               clocks->data[i].clocks_in_khz = pclk_vol_table->entries[i].clk * 10;
-               clocks->data[i].latency_in_us = latency_required ?
-                                               smu10_get_mem_latency(hwmgr,
-                                               pclk_vol_table->entries[i].clk) :
-                                               0;
-               clocks->num_levels++;
+               if (pclk_vol_table->entries[i].clk) {
+                       clocks->data[clocks->num_levels].clocks_in_khz =
+                               pclk_vol_table->entries[i].clk * 10;
+                       clocks->data[clocks->num_levels].latency_in_us = latency_required ?
+                               smu10_get_mem_latency(hwmgr,
+                                                     pclk_vol_table->entries[i].clk) :
+                               0;
+                       clocks->num_levels++;
+               }
        }
 
        return 0;