Browse Source

drm/amdgpu: handle uvd pg flags properly

Don't attempt to start/stop the uvd block if pg is disabled.

Reviewed-by: Eric Huang <JinHuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Alex Deucher 9 years ago
parent
commit
b6df77fc5c

+ 4 - 1
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c

@@ -848,7 +848,10 @@ static int uvd_v4_2_set_powergating_state(void *handle,
 	 * revisit this when there is a cleaner line between
 	 * revisit this when there is a cleaner line between
 	 * the smc and the hw blocks
 	 * the smc and the hw blocks
 	 */
 	 */
-	 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+
+	if (!(adev->pg_flags & AMDGPU_PG_SUPPORT_UVD))
+		return 0;
 
 
 	if (state == AMD_PG_STATE_GATE) {
 	if (state == AMD_PG_STATE_GATE) {
 		uvd_v4_2_stop(adev);
 		uvd_v4_2_stop(adev);

+ 3 - 0
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c

@@ -789,6 +789,9 @@ static int uvd_v5_0_set_powergating_state(void *handle,
 	 */
 	 */
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 
+	if (!(adev->pg_flags & AMDGPU_PG_SUPPORT_UVD))
+		return 0;
+
 	if (state == AMD_PG_STATE_GATE) {
 	if (state == AMD_PG_STATE_GATE) {
 		uvd_v5_0_stop(adev);
 		uvd_v5_0_stop(adev);
 		return 0;
 		return 0;

+ 3 - 0
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c

@@ -1030,6 +1030,9 @@ static int uvd_v6_0_set_powergating_state(void *handle,
 	 */
 	 */
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 
+	if (!(adev->pg_flags & AMDGPU_PG_SUPPORT_UVD))
+		return 0;
+
 	if (state == AMD_PG_STATE_GATE) {
 	if (state == AMD_PG_STATE_GATE) {
 		uvd_v6_0_stop(adev);
 		uvd_v6_0_stop(adev);
 		return 0;
 		return 0;