Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b813944 authored by Sagar Dharia's avatar Sagar Dharia
Browse files

slim_msm: Gracefully handle QMI timeout failures



QMI timeout can happen if other processor doesn't respond within the
time expected by slimbus driver on apps. It has been noticed that QMI
call to power-on slimbus rarely takes more than 500msec. Timeout
is increased to allow that possibility. Additionally, QMI channel is
drained out of left-over messages and runtime-PM state check is
modified to allow graceful handling of timeout if at all any timeout
still happens.

Change-Id: I392a4fa761735135a261fb543815823cee5eba41
Signed-off-by: default avatarSagar Dharia <sdharia@codeaurora.org>
parent 1acad2bb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ static int ngd_xfer_msg(struct slim_controller *ctrl, struct slim_msg_txn *txn)
		 * It also makes HW status cosistent with what SW has it here
		 */
		if ((pm_runtime_enabled(dev->dev) && ret < 0) ||
				dev->state == MSM_CTRL_DOWN) {
				dev->state >= MSM_CTRL_ASLEEP) {
			SLIM_ERR(dev, "slim ctrl vote failed ret:%d, state:%d",
					ret, dev->state);
			pm_runtime_set_suspended(dev->dev);
@@ -716,7 +716,7 @@ static int ngd_bulk_wr(struct slim_controller *ctrl, u8 la, u8 mt, u8 mc,
	mutex_lock(&dev->tx_lock);

	if ((pm_runtime_enabled(dev->dev) && ret < 0) ||
			dev->state == MSM_CTRL_DOWN) {
			dev->state >= MSM_CTRL_ASLEEP) {
		SLIM_WARN(dev, "vote failed/SSR in-progress ret:%d, state:%d",
				ret, dev->state);
		pm_runtime_set_suspended(dev->dev);
+6 −3
Original line number Diff line number Diff line
@@ -1404,9 +1404,12 @@ static void msm_slim_qmi_recv_msg(struct kthread_work *work)
	struct msm_slim_qmi *qmi =
			container_of(work, struct msm_slim_qmi, kwork);

	/* Drain all packets received */
	do {
		rc = qmi_recv_msg(qmi->handle);
	if (rc < 0)
		pr_err("%s: Error receiving QMI message\n", __func__);
	} while (rc == 0);
	if (rc != -ENOMSG)
		pr_err("%s: Error receiving QMI message:%d\n", __func__, rc);
}

static void msm_slim_qmi_notify(struct qmi_handle *handle,
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@
#define SLIMBUS_QMI_INS_ID 0

/* QMI response timeout of 500ms */
#define SLIM_QMI_RESP_TOUT 500
#define SLIM_QMI_RESP_TOUT 1000

#define PGD_THIS_EE(r, v) ((v) ? PGD_THIS_EE_V2(r) : PGD_THIS_EE_V1(r))
#define PGD_PORT(r, p, v) ((v) ? PGD_PORT_V2(r, p) : PGD_PORT_V1(r, p))