Re: [PATCH] drm/amd/powerplay: use existed smu_dpm_set* interfaces to implement powergate functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 1, 2020 at 10:08 AM Huang Rui <ray.huang@xxxxxxx> wrote:
>
> Abstract powergate_vcn/jpeg functions, using smu_dpm_set* to implement it.
>
> Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
> Reviewed-by: Kevin Wang <kevin1.wang@xxxxxxx>

Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  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(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index 3bb6ab4..846d099 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -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);
> +}
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> index ae2c318..e68d554 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
> @@ -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);
> diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> index 95eb445..6241d2e 100644
> --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
> @@ -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,
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> index 40c35bc..2889eb2 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_internal.h
> +++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h
> @@ -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
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
> index 4fc68d4..7c3da532 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c
> @@ -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
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux