From a4fdef4c120bbdf44f54156013d25a6a3af795e4 Mon Sep 17 00:00:00 2001 From: Jayaprakash Madisetty Date: Mon, 23 Jan 2023 22:57:06 +0530 Subject: [PATCH] disp: msm: sde: drop suspend state if commit is skipped Drop refcount on pm_suspend commit state if atomic commit is skipped due to failure. It will avoid frame trigger during pm_resume call. Change-Id: Iecd98b106454c82c81a1ef9faaf1af4be2bf19e6 Signed-off-by: Dhaval Patel Signed-off-by: Jayaprakash Madisetty --- msm/sde/sde_kms.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 534aafd834e2..9f7a815c9227 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark @@ -3907,6 +3907,7 @@ retry: DRM_ERROR("failed to get crtc %d state\n", conn->state->crtc->base.id); drm_connector_list_iter_end(&conn_iter); + ret = -EINVAL; goto unlock; } @@ -3945,6 +3946,12 @@ unlock: drm_modeset_backoff(&ctx); goto retry; } + + if ((ret || !num_crtcs) && sde_kms->suspend_state) { + drm_atomic_state_put(sde_kms->suspend_state); + sde_kms->suspend_state = NULL; + } + drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); @@ -3985,7 +3992,8 @@ static int sde_kms_pm_resume(struct device *dev) SDE_EVT32(sde_kms->suspend_state != NULL); - drm_mode_config_reset(ddev); + if (sde_kms->suspend_state) + drm_mode_config_reset(ddev); drm_modeset_acquire_init(&ctx, 0); retry: