All of lore.kernel.org
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org
Cc: linux-arm-msm@vger.kernel.org, Loic Poulain <loic.poulain@linaro.org>
Subject: [PATCH] bus: mhi: pm: Change mhi_pm_resume timeout value
Date: Fri,  5 Mar 2021 15:09:07 +0100	[thread overview]
Message-ID: <1614953347-10192-1-git-send-email-loic.poulain@linaro.org> (raw)

mhi_cntrl->timeout_ms is set by the controller and indicates the
maximum amount of time the controller device will take to be ready.
In case of PCI modems, this value is quite high given modems can take
up to 15 seconds from cold boot to be ready.

Reusing this value in mhi_pm_resume can cause huge resuming latency
and delay the whole system resume (in case of system wide suspend/
resume), leading to bad use experience.

This change adjusts the resume timeout to a fixed 2s value, which is
more than enough for any MHI device for exiting M3.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/bus/mhi/core/pm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 0cd6445..e2d83a9 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -17,6 +17,8 @@
 #include <linux/wait.h>
 #include "internal.h"
 
+#define MHI_PM_RESUME_TIMEOUT_MS 2000
+
 /*
  * Not all MHI state transitions are synchronous. Transitions like Linkdown,
  * SYS_ERR, and shutdown can happen anytime asynchronously. This function will
@@ -942,7 +944,7 @@ int mhi_pm_resume(struct mhi_controller *mhi_cntrl)
 	ret = wait_event_timeout(mhi_cntrl->state_event,
 				 mhi_cntrl->dev_state == MHI_STATE_M0 ||
 				 MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state),
-				 msecs_to_jiffies(mhi_cntrl->timeout_ms));
+				 msecs_to_jiffies(MHI_PM_RESUME_TIMEOUT_MS));
 
 	if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
 		dev_err(dev,
-- 
2.7.4


             reply	other threads:[~2021-03-05 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 14:09 Loic Poulain [this message]
2021-03-05 14:49 ` [PATCH] bus: mhi: pm: Change mhi_pm_resume timeout value Jeffrey Hugo
2021-03-05 15:08   ` Loic Poulain
2021-03-05 15:09     ` Jeffrey Hugo
2021-03-05 15:34       ` Loic Poulain
2021-03-05 16:16         ` Loic Poulain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1614953347-10192-1-git-send-email-loic.poulain@linaro.org \
    --to=loic.poulain@linaro.org \
    --cc=hemantk@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.