From: Suman Anna <s-anna@ti.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-omap@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Suman Anna <s-anna@ti.com>
Subject: [PATCH 3/4] mailbox/omap: check for any unread messages during suspend
Date: Wed, 6 Apr 2016 18:37:19 -0500 [thread overview]
Message-ID: <1459985840-1106-4-git-send-email-s-anna@ti.com> (raw)
In-Reply-To: <1459985840-1106-1-git-send-email-s-anna@ti.com>
The OMAP mailbox driver is used by clients to communicate with remote
processors in general. The mailbox clients are expected to have stopped
communicating with these remote processors during a system suspend. The
OMAP mailbox fifos are expected to not have any messages as such. Add a
check for any pending unprocessed messages in the suspend callback, to
detect any communication protocol issues of the mailbox clients. The
system suspend is aborted if any messages are found.
Signed-off-by: Suman Anna <s-anna@ti.com>
---
drivers/mailbox/omap-mailbox.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index 1b90eb380d44..b61c6e8654b5 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -655,11 +655,19 @@ static const struct mbox_chan_ops omap_mbox_chan_ops = {
static int omap_mbox_suspend(struct device *dev)
{
struct omap_mbox_device *mdev = dev_get_drvdata(dev);
- u32 usr, reg;
+ u32 usr, fifo, reg;
if (pm_runtime_status_suspended(dev))
return 0;
+ for (fifo = 0; fifo < mdev->num_fifos; fifo++) {
+ if (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo))) {
+ dev_err(mdev->dev, "fifo %d has unexpected unread messages\n",
+ fifo);
+ return -EBUSY;
+ }
+ }
+
for (usr = 0; usr < mdev->num_users; usr++) {
reg = MAILBOX_IRQENABLE(mdev->intr_type, usr);
mdev->irq_ctx[usr] = mbox_read_reg(mdev, reg);
--
2.7.4
next prev parent reply other threads:[~2016-04-06 23:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 23:37 [PATCH 0/4] OMAP mailbox suspend/resume support Suman Anna
2016-04-06 23:37 ` [PATCH 1/4] mailbox/omap: store mailbox interrupt type in omap_mbox_device Suman Anna
2016-04-07 10:32 ` Grygorii Strashko
2016-04-07 12:24 ` Suman Anna
2016-04-07 12:39 ` Grygorii Strashko
2016-04-06 23:37 ` [PATCH 2/4] mailbox/omap: add support for suspend/resume Suman Anna
2016-04-06 23:37 ` Suman Anna [this message]
2016-04-06 23:37 ` [PATCH 4/4] mailbox/omap: kill omap_mbox_{save/restore}_ctx() functions Suman Anna
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=1459985840-1106-4-git-send-email-s-anna@ti.com \
--to=s-anna@ti.com \
--cc=jassisinghbrar@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.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 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®