Commit 4a629668 authored by Leo Liu's avatar Leo Liu Committed by Alex Deucher

drm/amdgpu/powerplay: add Renoir VCN power management

Thus VCN can be powered up for normal operations
Signed-off-by: default avatarLeo Liu <leo.liu@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAaron Liu <aaron.liu@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 51548c0f
...@@ -1268,8 +1268,10 @@ static int smu_hw_init(void *handle) ...@@ -1268,8 +1268,10 @@ static int smu_hw_init(void *handle)
return ret; return ret;
} }
if (adev->asic_type == CHIP_RENOIR) if (adev->asic_type == CHIP_RENOIR) {
smu_powergate_sdma(&adev->smu, false); smu_powergate_sdma(&adev->smu, false);
smu_powergate_vcn(&adev->smu, false);
}
if (!smu->pm_enabled) if (!smu->pm_enabled)
return 0; return 0;
...@@ -1322,8 +1324,10 @@ static int smu_hw_fini(void *handle) ...@@ -1322,8 +1324,10 @@ static int smu_hw_fini(void *handle)
struct smu_table_context *table_context = &smu->smu_table; struct smu_table_context *table_context = &smu->smu_table;
int ret = 0; int ret = 0;
if (adev->asic_type == CHIP_RENOIR) if (adev->asic_type == CHIP_RENOIR) {
smu_powergate_sdma(&adev->smu, true); smu_powergate_sdma(&adev->smu, true);
smu_powergate_vcn(&adev->smu, true);
}
kfree(table_context->driver_pptable); kfree(table_context->driver_pptable);
table_context->driver_pptable = NULL; table_context->driver_pptable = NULL;
......
...@@ -474,6 +474,7 @@ struct smu_funcs ...@@ -474,6 +474,7 @@ struct smu_funcs
int (*populate_smc_pptable)(struct smu_context *smu); int (*populate_smc_pptable)(struct smu_context *smu);
int (*check_fw_version)(struct smu_context *smu); int (*check_fw_version)(struct smu_context *smu);
int (*powergate_sdma)(struct smu_context *smu, bool gate); int (*powergate_sdma)(struct smu_context *smu, bool gate);
int (*powergate_vcn)(struct smu_context *smu, bool gate);
int (*write_pptable)(struct smu_context *smu); int (*write_pptable)(struct smu_context *smu);
int (*set_min_dcef_deep_sleep)(struct smu_context *smu); int (*set_min_dcef_deep_sleep)(struct smu_context *smu);
int (*set_tool_table_location)(struct smu_context *smu); int (*set_tool_table_location)(struct smu_context *smu);
...@@ -552,6 +553,8 @@ struct smu_funcs ...@@ -552,6 +553,8 @@ struct smu_funcs
((smu)->funcs->setup_pptable ? (smu)->funcs->setup_pptable((smu)) : 0) ((smu)->funcs->setup_pptable ? (smu)->funcs->setup_pptable((smu)) : 0)
#define smu_powergate_sdma(smu, gate) \ #define smu_powergate_sdma(smu, gate) \
((smu)->funcs->powergate_sdma ? (smu)->funcs->powergate_sdma((smu), (gate)) : 0) ((smu)->funcs->powergate_sdma ? (smu)->funcs->powergate_sdma((smu), (gate)) : 0)
#define smu_powergate_vcn(smu, gate) \
((smu)->funcs->powergate_vcn ? (smu)->funcs->powergate_vcn((smu), (gate)) : 0)
#define smu_get_vbios_bootup_values(smu) \ #define smu_get_vbios_bootup_values(smu) \
((smu)->funcs->get_vbios_bootup_values ? (smu)->funcs->get_vbios_bootup_values((smu)) : 0) ((smu)->funcs->get_vbios_bootup_values ? (smu)->funcs->get_vbios_bootup_values((smu)) : 0)
#define smu_get_clk_info_from_vbios(smu) \ #define smu_get_clk_info_from_vbios(smu) \
......
...@@ -172,10 +172,22 @@ static int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate) ...@@ -172,10 +172,22 @@ static int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate)
return smu_send_smc_msg(smu, SMU_MSG_PowerUpSdma); return smu_send_smc_msg(smu, SMU_MSG_PowerUpSdma);
} }
static int smu_v12_0_powergate_vcn(struct smu_context *smu, bool gate)
{
if (!(smu->adev->flags & AMD_IS_APU))
return 0;
if (gate)
return smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
else
return smu_send_smc_msg(smu, SMU_MSG_PowerUpVcn);
}
static const struct smu_funcs smu_v12_0_funcs = { static const struct smu_funcs smu_v12_0_funcs = {
.check_fw_status = smu_v12_0_check_fw_status, .check_fw_status = smu_v12_0_check_fw_status,
.check_fw_version = smu_v12_0_check_fw_version, .check_fw_version = smu_v12_0_check_fw_version,
.powergate_sdma = smu_v12_0_powergate_sdma, .powergate_sdma = smu_v12_0_powergate_sdma,
.powergate_vcn = smu_v12_0_powergate_vcn,
.send_smc_msg = smu_v12_0_send_msg, .send_smc_msg = smu_v12_0_send_msg,
.send_smc_msg_with_param = smu_v12_0_send_msg_with_param, .send_smc_msg_with_param = smu_v12_0_send_msg_with_param,
.read_smc_arg = smu_v12_0_read_arg, .read_smc_arg = smu_v12_0_read_arg,
......
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