drm/powerplay: Fix Vega20 power reading again

Submitted by Deucher, Alexander on Aug. 23, 2019, 2:35 p.m.

Details

Message ID BN6PR12MB18093000064D627498B66814F7A40@BN6PR12MB1809.namprd12.prod.outlook.com
State New
Headers show
Series "drm/powerplay: Fix Vega20 power reading again" ( rev: 2 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Deucher, Alexander Aug. 23, 2019, 2:35 p.m.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
index 9f50a12f5c03..98a6f5305974 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c
@@ -2101,10 +2101,11 @@  static int vega20_get_gpu_power(struct pp_hwmgr *hwmgr,
         if (ret)
                 return ret;

-       if (hwmgr->smu_version < 0x282e00)
-               *query = metrics_table.CurrSocketPower << 8;
-       else
+       /* For the 40.46 release, they changed the value name */
+       if (hwmgr->smu_version == 0x282e00)
                 *query = metrics_table.AverageSocketPower << 8;
+       else
+               *query = metrics_table.CurrSocketPower << 8;

         return ret;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 0fac824490d7..899bf96b23e1 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -2932,10 +2932,11 @@  static int vega20_get_gpu_power(struct smu_context *smu, uint32_t *value)
         if (ret)
                 return ret;

-       if (smu_version < 0x282e00)
-               *value = metrics.CurrSocketPower << 8;
-       else
+       /* For the 40.46 release, they changed the value name */
+       if (smu_version == 0x282e00)
                 *value = metrics.AverageSocketPower << 8;
+       else
+               *value = metrics.CurrSocketPower << 8;

         return 0;
 }