tma525c: avoid watchdog sending i2c command if PM is suspended We should avoid watchdog send i2c commands if PM is suspended to avoid any unexpected HW Reset triggered. Bug: 329604457 Test: Manaully trigger suspending PM when watchdog is running, to verify there's no unexpected behavior triggered. Signed-off-by: Simon Wei <jentsewei@google.com> (cherry picked from commit 8e9df12d2949b075578ab55e7de796a6f567a167) (cherry picked from https://partner-android-review.googlesource.com/q/commit:5480094d5ad12fd069d7a47ea120659c5ef63f8d) Merged-In: I73aee9f30bb781ca65eaf0cdf44c1fa58cc2d84e Change-Id: I73aee9f30bb781ca65eaf0cdf44c1fa58cc2d84e
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); }