mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
To: <khilman@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, Nishanth Menon <nm@ti.com>,
	Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
Subject: [PATCH v1 2/2] PM / AVS: SmartReflex: disable spamming interrupts
Date: Fri, 12 Jul 2013 16:52:03 +0300	[thread overview]
Message-ID: <1373637123-1152-3-git-send-email-andrii.tseglytskyi@ti.com> (raw)
In-Reply-To: <1373637123-1152-1-git-send-email-andrii.tseglytskyi@ti.com>

From: Nishanth Menon <nm@ti.com>

At times with bad SR configurations, especially during silicon bring-ups,
we could get continuous spurious interrupts which end up hanging the
platform in the form of an ISR call for status bits that are
automatically enabled by the hardware without any software clearing
option.

If we detect scenarios where ISR was called without the corresponding
notification bit being set, instead of hanging up the system,
we will disable interrupt after noting the event in the system log
to try and keep system sanity and allow developer to debug and fix
the condition.

The same condition applies when a notifier does not exist OR is unable
to handle the interrupt as well.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
---
 drivers/power/avs/smartreflex.c |   23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index 5b2b703..185098f 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -120,8 +120,27 @@ static irqreturn_t sr_interrupt(int irq, void *data)
 		return IRQ_NONE;
 	}
 
-	if (sr_class->notify)
-		sr_class->notify(sr_info, status);
+	/* Attempt some resemblance of recovery! */
+	if (!status) {
+		dev_err(&sr_info->pdev->dev,
+			"%s: Spurious interrupt!status = 0x%08x."
+			"Disabling to prevent spamming!!\n",
+			__func__, status);
+		disable_irq_nosync(sr_info->irq);
+	} else {
+		/*
+		 * If the notifier does not exist OR reports inability to
+		 * handle, disable as well
+		 */
+		if (!sr_class->notify ||
+		    sr_class->notify(sr_info, status)) {
+			dev_err(&sr_info->pdev->dev,
+				"%s: Callback cant handle int status=0x%08x."
+				"Disabling to prevent spam!!\n",
+				__func__, status);
+			disable_irq_nosync(sr_info->irq);
+		}
+	}
 
 	return IRQ_HANDLED;
 }
-- 
1.7.9.5


  parent reply	other threads:[~2013-07-12 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-12 13:52 [PATCH v1 0/2] PM / AVS: interrupt handling fixes Andrii Tseglytskyi
2013-07-12 13:52 ` [PATCH v1 1/2] PM / AVS: SmartReflex: fix interrupt disable sequence Andrii Tseglytskyi
2013-07-12 13:52 ` Andrii Tseglytskyi [this message]
2013-08-05 16:24 ` [PATCH v1 0/2] PM / AVS: interrupt handling fixes Kevin Hilman

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=1373637123-1152-3-git-send-email-andrii.tseglytskyi@ti.com \
    --to=andrii.tseglytskyi@ti.com \
    --cc=khilman@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®