On Tue, Nov 12, 2019 at 1:04 PM Leo Liu <leo.liu@xxxxxxx> wrote: > > By using its own enabling function > > Signed-off-by: Leo Liu <leo.liu@xxxxxxx> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 8 ++++++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h | 1 + > drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 10 +++++++++- > 3 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > index f205f56e3358..b7150171e8d7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c > @@ -2718,6 +2718,14 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev) > > } > > +void amdgpu_dpm_enable_jpeg(struct amdgpu_device *adev, bool enable) > +{ I would add an "if (is_support_sw_smu(adev))" check here in case this ever gets called on older asics. Other than that, the series (with the v2 patches) is: Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx> > + int ret = smu_dpm_set_power_gate(&adev->smu, AMD_IP_BLOCK_TYPE_JPEG, enable); > + if (ret) > + DRM_ERROR("[SW SMU]: dpm enable jpeg failed, state = %s, ret = %d. \n", > + enable ? "true" : "false", ret); > +} > + > int amdgpu_pm_virt_sysfs_init(struct amdgpu_device *adev) > { > int ret = 0; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h > index ef31448ee8d8..3da1da277805 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h > @@ -41,5 +41,6 @@ void amdgpu_pm_compute_clocks(struct amdgpu_device *adev); > void amdgpu_dpm_thermal_work_handler(struct work_struct *work); > void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable); > void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable); > +void amdgpu_dpm_enable_jpeg(struct amdgpu_device *adev, bool enable); > > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c > index 3869730b2331..a78292d84854 100644 > --- a/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c > +++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c > @@ -333,6 +333,9 @@ static int jpeg_v2_0_start(struct amdgpu_device *adev) > struct amdgpu_ring *ring = &adev->jpeg.inst->ring_dec; > int r; > > + if (adev->pm.dpm_enabled) > + amdgpu_dpm_enable_jpeg(adev, true); > + > /* disable power gating */ > r = jpeg_v2_0_disable_power_gating(adev); > if (r) > @@ -388,8 +391,13 @@ static int jpeg_v2_0_stop(struct amdgpu_device *adev) > > /* enable power gating */ > r = jpeg_v2_0_enable_power_gating(adev); > + if (r) > + return r; > > - return r; > + if (adev->pm.dpm_enabled) > + amdgpu_dpm_enable_jpeg(adev, false); > + > + return 0; > } > > /** > -- > 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