mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 22:50:54 -04:00
drm/amd/pm: power up or down vcn by instance
For smu ip with multiple vcn instances (smu 11/13/14), remove all the for loop in dpm_set_vcn_enable() functions. And use the instance argument to power up/down vcn for the given instance only, instead of powering up/down for all vcn instances. v2: remove all duplicated functions in v1. remove for-loop from each ip, and temporarily move to dpm_set_vcn_enable, in order to keep the exact same logic as before, until further separation in the next patch. Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
a3300782d5
commit
8aaf166703
@@ -242,6 +242,7 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu,
|
||||
{
|
||||
struct smu_power_context *smu_power = &smu->smu_power;
|
||||
struct smu_power_gate *power_gate = &smu_power->power_gate;
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
@@ -256,9 +257,11 @@ static int smu_dpm_set_vcn_enable(struct smu_context *smu,
|
||||
if (atomic_read(&power_gate->vcn_gated) ^ enable)
|
||||
return 0;
|
||||
|
||||
ret = smu->ppt_funcs->dpm_set_vcn_enable(smu, enable, 0xff);
|
||||
if (!ret)
|
||||
atomic_set(&power_gate->vcn_gated, !enable);
|
||||
for (int i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
ret = smu->ppt_funcs->dpm_set_vcn_enable(smu, enable, i);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1157,19 +1157,15 @@ static int sienna_cichlid_dpm_set_vcn_enable(struct smu_context *smu,
|
||||
int inst)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
/* vcn dpm on is a prerequisite for vcn power gate messages */
|
||||
if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
0x10000 * i, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
if (adev->vcn.harvest_config & (1 << inst))
|
||||
return ret;
|
||||
/* vcn dpm on is a prerequisite for vcn power gate messages */
|
||||
if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_MM_DPM_PG_BIT)) {
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
0x10000 * inst, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -2108,18 +2108,14 @@ int smu_v13_0_set_vcn_enable(struct smu_context *smu,
|
||||
int inst)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
if (adev->vcn.harvest_config & (1 << inst))
|
||||
return ret;
|
||||
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
i << 16U, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
inst << 16U, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1511,29 +1511,24 @@ int smu_v14_0_set_vcn_enable(struct smu_context *smu,
|
||||
int inst)
|
||||
{
|
||||
struct amdgpu_device *adev = smu->adev;
|
||||
int i, ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
|
||||
if (adev->vcn.harvest_config & (1 << i))
|
||||
continue;
|
||||
if (adev->vcn.harvest_config & (1 << inst))
|
||||
return ret;
|
||||
|
||||
if (smu->is_apu) {
|
||||
if (i == 0)
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0,
|
||||
i << 16U, NULL);
|
||||
else if (i == 1)
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1,
|
||||
i << 16U, NULL);
|
||||
} else {
|
||||
if (smu->is_apu) {
|
||||
if (inst == 0)
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
i << 16U, NULL);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
SMU_MSG_PowerUpVcn0 : SMU_MSG_PowerDownVcn0,
|
||||
inst << 16U, NULL);
|
||||
else if (inst == 1)
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn1 : SMU_MSG_PowerDownVcn1,
|
||||
inst << 16U, NULL);
|
||||
} else {
|
||||
ret = smu_cmn_send_smc_msg_with_param(smu, enable ?
|
||||
SMU_MSG_PowerUpVcn : SMU_MSG_PowerDownVcn,
|
||||
inst << 16U, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user