aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/kv_dpm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index 3f57f6463dc8..cb79a93c2eb7 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -65,8 +65,6 @@ static int kv_set_thermal_temperature_range(struct amdgpu_device *adev,
65 int min_temp, int max_temp); 65 int min_temp, int max_temp);
66static int kv_init_fps_limits(struct amdgpu_device *adev); 66static int kv_init_fps_limits(struct amdgpu_device *adev);
67 67
68static void kv_dpm_powergate_uvd(void *handle, bool gate);
69static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate);
70static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate); 68static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate);
71static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate); 69static void kv_dpm_powergate_acp(struct amdgpu_device *adev, bool gate);
72 70
@@ -1354,8 +1352,6 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
1354 return ret; 1352 return ret;
1355 } 1353 }
1356 1354
1357 kv_update_current_ps(adev, adev->pm.dpm.boot_ps);
1358
1359 if (adev->irq.installed && 1355 if (adev->irq.installed &&
1360 amdgpu_is_internal_thermal_sensor(adev->pm.int_thermal_type)) { 1356 amdgpu_is_internal_thermal_sensor(adev->pm.int_thermal_type)) {
1361 ret = kv_set_thermal_temperature_range(adev, KV_TEMP_RANGE_MIN, KV_TEMP_RANGE_MAX); 1357 ret = kv_set_thermal_temperature_range(adev, KV_TEMP_RANGE_MIN, KV_TEMP_RANGE_MAX);
@@ -1374,6 +1370,8 @@ static int kv_dpm_enable(struct amdgpu_device *adev)
1374 1370
1375static void kv_dpm_disable(struct amdgpu_device *adev) 1371static void kv_dpm_disable(struct amdgpu_device *adev)
1376{ 1372{
1373 struct kv_power_info *pi = kv_get_pi(adev);
1374
1377 amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq, 1375 amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
1378 AMDGPU_THERMAL_IRQ_LOW_TO_HIGH); 1376 AMDGPU_THERMAL_IRQ_LOW_TO_HIGH);
1379 amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq, 1377 amdgpu_irq_put(adev, &adev->pm.dpm.thermal.irq,
@@ -1387,8 +1385,10 @@ static void kv_dpm_disable(struct amdgpu_device *adev)
1387 /* powerup blocks */ 1385 /* powerup blocks */
1388 kv_dpm_powergate_acp(adev, false); 1386 kv_dpm_powergate_acp(adev, false);
1389 kv_dpm_powergate_samu(adev, false); 1387 kv_dpm_powergate_samu(adev, false);
1390 kv_dpm_powergate_vce(adev, false); 1388 if (pi->caps_vce_pg) /* power on the VCE block */
1391 kv_dpm_powergate_uvd(adev, false); 1389 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
1390 if (pi->caps_uvd_pg) /* power on the UVD block */
1391 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_UVDPowerON);
1392 1392
1393 kv_enable_smc_cac(adev, false); 1393 kv_enable_smc_cac(adev, false);
1394 kv_enable_didt(adev, false); 1394 kv_enable_didt(adev, false);
@@ -1551,7 +1551,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
1551 int ret; 1551 int ret;
1552 1552
1553 if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) { 1553 if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) {
1554 kv_dpm_powergate_vce(adev, false);
1555 if (pi->caps_stable_p_state) 1554 if (pi->caps_stable_p_state)
1556 pi->vce_boot_level = table->count - 1; 1555 pi->vce_boot_level = table->count - 1;
1557 else 1556 else
@@ -1573,7 +1572,6 @@ static int kv_update_vce_dpm(struct amdgpu_device *adev,
1573 kv_enable_vce_dpm(adev, true); 1572 kv_enable_vce_dpm(adev, true);
1574 } else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) { 1573 } else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) {
1575 kv_enable_vce_dpm(adev, false); 1574 kv_enable_vce_dpm(adev, false);
1576 kv_dpm_powergate_vce(adev, true);
1577 } 1575 }
1578 1576
1579 return 0; 1577 return 0;
@@ -1702,24 +1700,32 @@ static void kv_dpm_powergate_uvd(void *handle, bool gate)
1702 } 1700 }
1703} 1701}
1704 1702
1705static void kv_dpm_powergate_vce(struct amdgpu_device *adev, bool gate) 1703static void kv_dpm_powergate_vce(void *handle, bool gate)
1706{ 1704{
1705 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
1707 struct kv_power_info *pi = kv_get_pi(adev); 1706 struct kv_power_info *pi = kv_get_pi(adev);
1708 1707 int ret;
1709 if (pi->vce_power_gated == gate)
1710 return;
1711 1708
1712 pi->vce_power_gated = gate; 1709 pi->vce_power_gated = gate;
1713 1710
1714 if (!pi->caps_vce_pg) 1711 if (gate) {
1715 return; 1712 /* stop the VCE block */
1716 1713 ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
1717 if (gate) 1714 AMD_PG_STATE_GATE);
1718 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF); 1715 kv_enable_vce_dpm(adev, false);
1719 else 1716 if (pi->caps_vce_pg) /* power off the VCE block */
1720 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON); 1717 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF);
1718 } else {
1719 if (pi->caps_vce_pg) /* power on the VCE block */
1720 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON);
1721 kv_enable_vce_dpm(adev, true);
1722 /* re-init the VCE block */
1723 ret = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE,
1724 AMD_PG_STATE_UNGATE);
1725 }
1721} 1726}
1722 1727
1728
1723static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate) 1729static void kv_dpm_powergate_samu(struct amdgpu_device *adev, bool gate)
1724{ 1730{
1725 struct kv_power_info *pi = kv_get_pi(adev); 1731 struct kv_power_info *pi = kv_get_pi(adev);
@@ -3061,7 +3067,7 @@ static int kv_dpm_hw_init(void *handle)
3061 else 3067 else
3062 adev->pm.dpm_enabled = true; 3068 adev->pm.dpm_enabled = true;
3063 mutex_unlock(&adev->pm.mutex); 3069 mutex_unlock(&adev->pm.mutex);
3064 3070 amdgpu_pm_compute_clocks(adev);
3065 return ret; 3071 return ret;
3066} 3072}
3067 3073
@@ -3313,6 +3319,9 @@ static int kv_set_powergating_by_smu(void *handle,
3313 case AMD_IP_BLOCK_TYPE_UVD: 3319 case AMD_IP_BLOCK_TYPE_UVD:
3314 kv_dpm_powergate_uvd(handle, gate); 3320 kv_dpm_powergate_uvd(handle, gate);
3315 break; 3321 break;
3322 case AMD_IP_BLOCK_TYPE_VCE:
3323 kv_dpm_powergate_vce(handle, gate);
3324 break;
3316 default: 3325 default:
3317 break; 3326 break;
3318 } 3327 }