Commit 974d5ef0 authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/pm: drop unneeded vcn/jpeg_gate_lock

As those related APIs are already protected by adev->pm.mutex.
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e0638c7a
...@@ -158,8 +158,8 @@ static u32 smu_get_sclk(void *handle, bool low) ...@@ -158,8 +158,8 @@ static u32 smu_get_sclk(void *handle, bool low)
return clk_freq * 100; return clk_freq * 100;
} }
static int smu_dpm_set_vcn_enable_locked(struct smu_context *smu, static int smu_dpm_set_vcn_enable(struct smu_context *smu,
bool enable) bool enable)
{ {
struct smu_power_context *smu_power = &smu->smu_power; struct smu_power_context *smu_power = &smu->smu_power;
struct smu_power_gate *power_gate = &smu_power->power_gate; struct smu_power_gate *power_gate = &smu_power->power_gate;
...@@ -178,24 +178,8 @@ static int smu_dpm_set_vcn_enable_locked(struct smu_context *smu, ...@@ -178,24 +178,8 @@ static int smu_dpm_set_vcn_enable_locked(struct smu_context *smu,
return ret; return ret;
} }
static int smu_dpm_set_vcn_enable(struct smu_context *smu, static int smu_dpm_set_jpeg_enable(struct smu_context *smu,
bool enable) bool enable)
{
struct smu_power_context *smu_power = &smu->smu_power;
struct smu_power_gate *power_gate = &smu_power->power_gate;
int ret = 0;
mutex_lock(&power_gate->vcn_gate_lock);
ret = smu_dpm_set_vcn_enable_locked(smu, enable);
mutex_unlock(&power_gate->vcn_gate_lock);
return ret;
}
static int smu_dpm_set_jpeg_enable_locked(struct smu_context *smu,
bool enable)
{ {
struct smu_power_context *smu_power = &smu->smu_power; struct smu_power_context *smu_power = &smu->smu_power;
struct smu_power_gate *power_gate = &smu_power->power_gate; struct smu_power_gate *power_gate = &smu_power->power_gate;
...@@ -214,22 +198,6 @@ static int smu_dpm_set_jpeg_enable_locked(struct smu_context *smu, ...@@ -214,22 +198,6 @@ static int smu_dpm_set_jpeg_enable_locked(struct smu_context *smu,
return ret; return ret;
} }
static int smu_dpm_set_jpeg_enable(struct smu_context *smu,
bool enable)
{
struct smu_power_context *smu_power = &smu->smu_power;
struct smu_power_gate *power_gate = &smu_power->power_gate;
int ret = 0;
mutex_lock(&power_gate->jpeg_gate_lock);
ret = smu_dpm_set_jpeg_enable_locked(smu, enable);
mutex_unlock(&power_gate->jpeg_gate_lock);
return ret;
}
/** /**
* smu_dpm_set_power_gate - power gate/ungate the specific IP block * smu_dpm_set_power_gate - power gate/ungate the specific IP block
* *
...@@ -620,32 +588,25 @@ static int smu_set_default_dpm_table(struct smu_context *smu) ...@@ -620,32 +588,25 @@ static int smu_set_default_dpm_table(struct smu_context *smu)
if (!smu->ppt_funcs->set_default_dpm_table) if (!smu->ppt_funcs->set_default_dpm_table)
return 0; return 0;
mutex_lock(&power_gate->vcn_gate_lock);
mutex_lock(&power_gate->jpeg_gate_lock);
vcn_gate = atomic_read(&power_gate->vcn_gated); vcn_gate = atomic_read(&power_gate->vcn_gated);
jpeg_gate = atomic_read(&power_gate->jpeg_gated); jpeg_gate = atomic_read(&power_gate->jpeg_gated);
ret = smu_dpm_set_vcn_enable_locked(smu, true); ret = smu_dpm_set_vcn_enable(smu, true);
if (ret) if (ret)
goto err0_out; return ret;
ret = smu_dpm_set_jpeg_enable_locked(smu, true); ret = smu_dpm_set_jpeg_enable(smu, true);
if (ret) if (ret)
goto err1_out; goto err_out;
ret = smu->ppt_funcs->set_default_dpm_table(smu); ret = smu->ppt_funcs->set_default_dpm_table(smu);
if (ret) if (ret)
dev_err(smu->adev->dev, dev_err(smu->adev->dev,
"Failed to setup default dpm clock tables!\n"); "Failed to setup default dpm clock tables!\n");
smu_dpm_set_jpeg_enable_locked(smu, !jpeg_gate); smu_dpm_set_jpeg_enable(smu, !jpeg_gate);
err1_out: err_out:
smu_dpm_set_vcn_enable_locked(smu, !vcn_gate); smu_dpm_set_vcn_enable(smu, !vcn_gate);
err0_out:
mutex_unlock(&power_gate->jpeg_gate_lock);
mutex_unlock(&power_gate->vcn_gate_lock);
return ret; return ret;
} }
...@@ -1007,8 +968,6 @@ static int smu_sw_init(void *handle) ...@@ -1007,8 +968,6 @@ static int smu_sw_init(void *handle)
atomic_set(&smu->smu_power.power_gate.vcn_gated, 1); atomic_set(&smu->smu_power.power_gate.vcn_gated, 1);
atomic_set(&smu->smu_power.power_gate.jpeg_gated, 1); atomic_set(&smu->smu_power.power_gate.jpeg_gated, 1);
mutex_init(&smu->smu_power.power_gate.vcn_gate_lock);
mutex_init(&smu->smu_power.power_gate.jpeg_gate_lock);
smu->workload_mask = 1 << smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT]; smu->workload_mask = 1 << smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];
smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0; smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;
......
...@@ -376,8 +376,6 @@ struct smu_power_gate { ...@@ -376,8 +376,6 @@ struct smu_power_gate {
bool vce_gated; bool vce_gated;
atomic_t vcn_gated; atomic_t vcn_gated;
atomic_t jpeg_gated; atomic_t jpeg_gated;
struct mutex vcn_gate_lock;
struct mutex jpeg_gate_lock;
}; };
struct smu_power_context { struct smu_power_context {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment