On Renior, both SMU_MSG_PowerDownJpeg and SMU_MSG_PowerUpJpeg need an argument. > -----Original Message----- > From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Leo Liu > Sent: Wednesday, November 13, 2019 2:03 AM > To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx > Cc: Liu, Leo <Leo.Liu@xxxxxxx> > Subject: [PATCH 13/21] drm/amd/powerplay: add Powergate JPEG for Renoir > > Similar to SDMA, VCN etc. > > Signed-off-by: Leo Liu <leo.liu@xxxxxxx> > --- > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ > drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h | 2 ++ > drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 1 + > drivers/gpu/drm/amd/powerplay/smu_internal.h | 2 ++ > drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 11 +++++++++++ > 5 files changed, 18 insertions(+) > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > index 69243a858dd5..211934521d37 100644 > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > @@ -1229,6 +1229,7 @@ static int smu_hw_init(void *handle) > if (adev->flags & AMD_IS_APU) { > smu_powergate_sdma(&adev->smu, false); > smu_powergate_vcn(&adev->smu, false); > + smu_powergate_jpeg(&adev->smu, false); > smu_set_gfx_cgpg(&adev->smu, true); > } > > @@ -1287,6 +1288,7 @@ static int smu_hw_fini(void *handle) > if (adev->flags & AMD_IS_APU) { > smu_powergate_sdma(&adev->smu, true); > smu_powergate_vcn(&adev->smu, true); > + smu_powergate_jpeg(&adev->smu, true); > } > > ret = smu_stop_thermal_control(smu); > diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h > b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h > index 9b9f5df0911c..1745e0146fba 100644 > --- a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h > +++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h > @@ -58,6 +58,8 @@ int smu_v12_0_powergate_sdma(struct smu_context > *smu, bool gate); > > int smu_v12_0_powergate_vcn(struct smu_context *smu, bool gate); > > +int smu_v12_0_powergate_jpeg(struct smu_context *smu, bool gate); > + > int smu_v12_0_set_gfx_cgpg(struct smu_context *smu, bool enable); > > uint32_t smu_v12_0_get_gfxoff_status(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 04daf7e9fe05..492a201554e8 100644 > --- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c > +++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c > @@ -697,6 +697,7 @@ static const struct pptable_funcs renoir_ppt_funcs = { > .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 = smu_v12_0_send_msg, > .send_smc_msg_with_param = smu_v12_0_send_msg_with_param, > .read_smc_arg = smu_v12_0_read_arg, > diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h > b/drivers/gpu/drm/amd/powerplay/smu_internal.h > index 8bcda7871309..70c4d66721cd 100644 > --- a/drivers/gpu/drm/amd/powerplay/smu_internal.h > +++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h > @@ -42,6 +42,8 @@ > ((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) diff --git > a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c > b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c > index 139dd737eaa5..f5d87110ec34 100644 > --- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c > +++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c > @@ -203,6 +203,17 @@ int smu_v12_0_powergate_vcn(struct smu_context > *smu, bool gate) > return smu_send_smc_msg(smu, SMU_MSG_PowerUpVcn); } > > +int smu_v12_0_powergate_jpeg(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_PowerDownJpeg); > + else > + return smu_send_smc_msg(smu, SMU_MSG_PowerUpJpeg); } > + > int smu_v12_0_set_gfx_cgpg(struct smu_context *smu, bool enable) { > if (!(smu->adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) > -- > 2.17.1 > > _______________________________________________ > 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