]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mailbox/omap: check for any unread messages during suspend
authorSuman Anna <s-anna@ti.com>
Wed, 6 Apr 2016 23:37:19 +0000 (18:37 -0500)
committerJassi Brar <jaswinder.singh@linaro.org>
Tue, 26 Apr 2016 04:49:38 +0000 (10:19 +0530)
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>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/omap-mailbox.c

index e402aa23226d027824d1ee751d0a3696d800051a..d8d3a4bc5262ab9a8751c92837f54f9824d4b1fe 100644 (file)
@@ -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);