From e2bb50da93408e03716a572f69d8c4035a85b03e Mon Sep 17 00:00:00 2001 From: Bhaumik Bhatt Date: Thu, 21 May 2020 15:13:03 -0700 Subject: [PATCH] mhi: core: Move power down check within the RDDM image support If a controller supports RDDM, there is no need to process a SYS_ERROR. Hence, we can safely move the power down state check to reside within an RDDM supported controller as it allows for other controllers to handle scenarios such as receiving an early SYS_ERROR when in the PBL execution environment. Change-Id: I5c63a861b9dd178f5c967bdf252da9c47d3a2b56 Signed-off-by: Bhaumik Bhatt --- drivers/bus/mhi/core/mhi_main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/bus/mhi/core/mhi_main.c b/drivers/bus/mhi/core/mhi_main.c index 191b5f707ec1..b577f9477edf 100644 --- a/drivers/bus/mhi/core/mhi_main.c +++ b/drivers/bus/mhi/core/mhi_main.c @@ -1638,20 +1638,20 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev) TO_MHI_EXEC_STR(ee), TO_MHI_STATE_STR(state)); - if (mhi_cntrl->power_down) { - write_unlock_irq(&mhi_cntrl->pm_lock); - goto exit_intvec; - } - if (state == MHI_STATE_SYS_ERR) { MHI_ERR("MHI system error detected\n"); pm_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_SYS_ERR_DETECT); } - write_unlock_irq(&mhi_cntrl->pm_lock); - if (ee == MHI_EE_RDDM) { - write_lock_irq(&mhi_cntrl->pm_lock); + if (mhi_cntrl->rddm_supported) { + /* exit as power down is already initiated */ + if (mhi_cntrl->power_down || ee != MHI_EE_RDDM) { + write_unlock_irq(&mhi_cntrl->pm_lock); + goto exit_intvec; + } + + /* prevent multiple entries for RDDM execution environment */ if (mhi_cntrl->ee == MHI_EE_RDDM) { write_unlock_irq(&mhi_cntrl->pm_lock); goto exit_intvec; @@ -1670,6 +1670,8 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev) goto exit_intvec; } + write_unlock_irq(&mhi_cntrl->pm_lock); + /* if device is in RDDM, don't bother processing SYS_ERR */ if (ee != MHI_EE_RDDM && pm_state == MHI_PM_SYS_ERR_DETECT) { wake_up_all(&mhi_cntrl->state_event);