drm/amd/powerplay: use existed smu_dpm_set* interfaces to implement powergate functions
Subsystems (2)
PATCH 1/1 drm/amd/powerplay: use existed smu_dpm_set* interfaces to implement powergate functions
Abstract powergate_vcn/jpeg functions, using smu_dpm_set* to implement it.
Signed-off-by Huang Rui <[email protected]>
Reviewed-by Kevin Wang <[email protected]>
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 -- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 2 -- drivers/gpu/drm/amd/powerplay/smu_internal.h | 7 +++---- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 22 ---------------------- 5 files changed, 19 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +16 -0
@@ -2736,3 +2736,19 @@ uint32_t smu_get_pptable_power_limit(struct smu_context *smu)return ret; } + +int smu_powergate_vcn (struct smu_context *smu,bool gate) +{ +if (!smu->is_apu) +return 0 ; + +return smu_dpm_set_uvd_enable (smu, !gate); +} + +int smu_powergate_jpeg (struct smu_context *smu,bool gate) +{ +if (!smu->is_apu) +return 0 ; + +return smu_dpm_set_jpeg_enable (smu, !gate); +}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0 -2
@@ -508,8 +508,6 @@ struct pptable_funcs {int (*populate_smc_tables)(struct smu_context *smu);int (*check_fw_version)(struct smu_context *smu);int (*powergate_sdma)(struct smu_context *smu,bool gate); -int (*powergate_vcn)(struct smu_context *smu,bool gate); -int (*powergate_jpeg)(struct smu_context *smu,bool gate);int (*set_gfx_cgpg)(struct smu_context *smu,bool enable);int (*write_pptable)(struct smu_context *smu);int (*set_min_dcef_deep_sleep)(struct smu_context *smu);
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0 -2
@@ -930,8 +930,6 @@ static const struct pptable_funcs renoir_ppt_funcs = { .check_fw_status = smu_v12_0_check_fw_status, .check_fw_version = smu_v12_0_check_fw_version, .powergate_sdma = smu_v12_0_powergate_sdma, - .powergate_vcn = smu_v12_0_powergate_vcn, - .powergate_jpeg = smu_v12_0_powergate_jpeg, .send_smc_msg_with_param = smu_v12_0_send_msg_with_param, .set_gfx_cgpg = smu_v12_0_set_gfx_cgpg, .gfx_off_control = smu_v12_0_gfx_off_control,
drivers/gpu/drm/amd/powerplay/smu_internal.h +3 -4
@@ -40,10 +40,6 @@ ((smu)->ppt_funcs->setup_pptable ? (smu)->ppt_funcs->setup_pptable((smu)) : 0)#define smu_powergate_sdma (smu, gate) \ ((smu)->ppt_funcs->powergate_sdma ? (smu)->ppt_funcs->powergate_sdma((smu), (gate)) : 0) -#define smu_powergate_vcn (smu, gate) \ - ((smu)->ppt_funcs->powergate_vcn ? (smu)->ppt_funcs->powergate_vcn((smu), (gate)) : 0) -#define smu_powergate_jpeg (smu, gate) \ - ((smu)->ppt_funcs->powergate_jpeg ? (smu)->ppt_funcs->powergate_jpeg((smu), (gate)) : 0)#define smu_get_vbios_bootup_values (smu) \ ((smu)->ppt_funcs->get_vbios_bootup_values ? (smu)->ppt_funcs->get_vbios_bootup_values((smu)) : 0)
@@ -214,4 +210,7 @@ static inline int smu_send_smc_msg(struct smu_context *smu, enum smu_message_typ#define smu_set_power_source (smu, power_src) \ ((smu)->ppt_funcs->set_power_source ? (smu)->ppt_funcs->set_power_source((smu), (power_src)) : 0) +int smu_powergate_vcn (struct smu_context *smu,bool gate); +int smu_powergate_jpeg (struct smu_context *smu,bool gate); +#endif
drivers/gpu/drm/amd/powerplay/smu_v12_0.c +0 -22
@@ -182,28 +182,6 @@ int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate)return smu_send_smc_msg (smu, SMU_MSG_PowerUpSdma,NULL ); } -int smu_v12_0_powergate_vcn (struct smu_context *smu,bool gate) -{ -if (!smu->is_apu) -return 0 ; - -if (gate) -return smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn,NULL ); -else -return smu_send_smc_msg (smu, SMU_MSG_PowerUpVcn,NULL ); -} - -int smu_v12_0_powergate_jpeg (struct smu_context *smu,bool gate) -{ -if (!smu->is_apu) -return 0 ; - -if (gate) -return smu_send_smc_msg_with_param (smu, SMU_MSG_PowerDownJpeg,0 ,NULL ); -else -return smu_send_smc_msg_with_param (smu, SMU_MSG_PowerUpJpeg,0 ,NULL ); -} -int smu_v12_0_set_gfx_cgpg (struct smu_context *smu,bool enable) {if (!(smu->adev->pg_flags &AMD_PG_SUPPORT_GFX_PG ))
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 5 lines · Huang Rui
Abstract powergate_vcn/jpeg functions, using smu_dpm_set* to implement it.
Signed-off-by Huang Rui <[email protected]>Reviewed-by Kevin Wang <[email protected]>
Acked-by Alex Deucher <[email protected]>
Quoted 117 lines
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 2 -- drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 2 -- drivers/gpu/drm/amd/powerplay/smu_internal.h | 7 +++---- drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 22 ---------------------- 5 files changed, 19 insertions(+), 30 deletions(-)drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +16
-0@@ -2736,3 +2736,19 @@ uint32_t smu_get_pptable_power_limit(struct smu_context *smu)return ret; } + +int smu_powergate_vcn (struct smu_context *smu,bool gate) +{ +if (!smu->is_apu) +return 0 ; + +return smu_dpm_set_uvd_enable (smu, !gate); +} + +int smu_powergate_jpeg (struct smu_context *smu,bool gate) +{ +if (!smu->is_apu) +return 0 ; + +return smu_dpm_set_jpeg_enable (smu, !gate); +}drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +0
-2@@ -508,8 +508,6 @@ struct pptable_funcs {int (*populate_smc_tables)(struct smu_context *smu);int (*check_fw_version)(struct smu_context *smu);int (*powergate_sdma)(struct smu_context *smu,bool gate); -int (*powergate_vcn)(struct smu_context *smu,bool gate); -int (*powergate_jpeg)(struct smu_context *smu,bool gate);int (*set_gfx_cgpg)(struct smu_context *smu,bool enable);int (*write_pptable)(struct smu_context *smu);int (*set_min_dcef_deep_sleep)(struct smu_context *smu);drivers/gpu/drm/amd/powerplay/renoir_ppt.c +0
-2@@ -930,8 +930,6 @@ static const struct pptable_funcs renoir_ppt_funcs = { .check_fw_status = smu_v12_0_check_fw_status, .check_fw_version = smu_v12_0_check_fw_version, .powergate_sdma = smu_v12_0_powergate_sdma, - .powergate_vcn = smu_v12_0_powergate_vcn, - .powergate_jpeg = smu_v12_0_powergate_jpeg, .send_smc_msg_with_param = smu_v12_0_send_msg_with_param, .set_gfx_cgpg = smu_v12_0_set_gfx_cgpg, .gfx_off_control = smu_v12_0_gfx_off_control,drivers/gpu/drm/amd/powerplay/smu_internal.h +3
-4@@ -40,10 +40,6 @@ ((smu)->ppt_funcs->setup_pptable ? (smu)->ppt_funcs->setup_pptable((smu)) : 0)#define smu_powergate_sdma (smu, gate) \ ((smu)->ppt_funcs->powergate_sdma ? (smu)->ppt_funcs->powergate_sdma((smu), (gate)) : 0) -#define smu_powergate_vcn (smu, gate) \ - ((smu)->ppt_funcs->powergate_vcn ? (smu)->ppt_funcs->powergate_vcn((smu), (gate)) : 0) -#define smu_powergate_jpeg (smu, gate) \ - ((smu)->ppt_funcs->powergate_jpeg ? (smu)->ppt_funcs->powergate_jpeg((smu), (gate)) : 0)#define smu_get_vbios_bootup_values (smu) \ ((smu)->ppt_funcs->get_vbios_bootup_values ? (smu)->ppt_funcs->get_vbios_bootup_values((smu)) : 0)@@ -214,4 +210,7 @@ static inline int smu_send_smc_msg(struct smu_context *smu, enum smu_message_typ#define smu_set_power_source (smu, power_src) \ ((smu)->ppt_funcs->set_power_source ? (smu)->ppt_funcs->set_power_source((smu), (power_src)) : 0) +int smu_powergate_vcn (struct smu_context *smu,bool gate); +int smu_powergate_jpeg (struct smu_context *smu,bool gate); +#endif drivers/gpu/drm/amd/powerplay/smu_v12_0.c +0
-23@@ -182,28 +182,6 @@ int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate)return smu_send_smc_msg (smu, SMU_MSG_PowerUpSdma,NULL ); } -int smu_v12_0_powergate_vcn (struct smu_context *smu,bool gate) -{ -if (!smu->is_apu) -return 0 ; - -if (gate) -return smu_send_smc_msg (smu, SMU_MSG_PowerDownVcn,NULL ); -else -return smu_send_smc_msg (smu, SMU_MSG_PowerUpVcn,NULL ); -} - -int smu_v12_0_powergate_jpeg (struct smu_context *smu,bool gate) -{ -if (!smu->is_apu) -return 0 ; - -if (gate) -return smu_send_smc_msg_with_param (smu, SMU_MSG_PowerDownJpeg,0 ,NULL ); -else -return smu_send_smc_msg_with_param (smu, SMU_MSG_PowerUpJpeg,0 ,NULL ); -} -int smu_v12_0_set_gfx_cgpg (struct smu_context *smu,bool enable) {if (!(smu->adev->pg_flags &AMD_PG_SUPPORT_GFX_PG )) --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx