Merge cherrypicks of ['partner-android-review.googlesource.com/2771271'] into android13-msm-pixelwatch-5.15-p11-release.

Change-Id: I43f6bd8237777d4e121006fa7065d4c0c26fe5af
Signed-off-by: Coastguard Worker <android-build-coastguard-worker@google.com>
diff --git a/tma525c/pt_core.c b/tma525c/pt_core.c
index 96f220c..41dc908 100644
--- a/tma525c/pt_core.c
+++ b/tma525c/pt_core.c
@@ -17343,12 +17343,17 @@
 	struct pt_core_data *cd = container_of(work,
 				struct pt_core_data, watchdog_work);
 
+	pm_stay_awake(cd->dev);
 	/*
-	 * if found the current sleep_state is SS_SLEEPING
+	 * if found
+	 * 1. the current sleep_state is SS_SLEEPING or
+	 * 2. PM is going to be suspended
 	 * then no need to request_exclusive, directly return
 	 */
-	if (cd->sleep_state == SS_SLEEPING)
+	if (cd->sleep_state == SS_SLEEPING || !cd->irq_enabled) {
+		pm_relax(cd->dev);
 		return;
+	}
 
 #ifdef TTDL_DIAGNOSTICS
 	cd->watchdog_count++;
@@ -17400,8 +17405,10 @@
 			__func__, cd->startup_retry_count);
 
 		/* Already tried FW upgrade because of watchdog but failed */
-		if (cd->startup_retry_count > PT_WATCHDOG_RETRY_COUNT)
+		if (cd->startup_retry_count > PT_WATCHDOG_RETRY_COUNT) {
+			pm_relax(cd->dev);
 			return;
+		}
 
 		if (cd->startup_retry_count++ < PT_WATCHDOG_RETRY_COUNT) {
 			/*
@@ -17487,6 +17494,7 @@
 	}
 
 exit:
+	pm_relax(cd->dev);
 	pt_start_wd_timer(cd);
 }