summaryrefslogtreecommitdiffstats
path: root/drivers/mailbox
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2016-04-06 19:37:19 -0400
committerJassi Brar <jaswinder.singh@linaro.org>2016-04-26 00:49:38 -0400
commit9f0cee984a25a34c169dac67a11d9c951727e47a (patch)
tree9f7c923daa8ca56e1be6162802f46f4a37a849d9 /drivers/mailbox
parentaf1d2f5cb9d24f0e477158dada6baf893a32ee04 (diff)
mailbox/omap: check for any unread messages during suspend
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>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r--drivers/mailbox/omap-mailbox.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index e402aa23226d..d8d3a4bc5262 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 = {
655static int omap_mbox_suspend(struct device *dev) 655static int omap_mbox_suspend(struct device *dev)
656{ 656{
657 struct omap_mbox_device *mdev = dev_get_drvdata(dev); 657 struct omap_mbox_device *mdev = dev_get_drvdata(dev);
658 u32 usr, reg; 658 u32 usr, fifo, reg;
659 659
660 if (pm_runtime_status_suspended(dev)) 660 if (pm_runtime_status_suspended(dev))
661 return 0; 661 return 0;
662 662
663 for (fifo = 0; fifo < mdev->num_fifos; fifo++) {
664 if (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo))) {
665 dev_err(mdev->dev, "fifo %d has unexpected unread messages\n",
666 fifo);
667 return -EBUSY;
668 }
669 }
670
663 for (usr = 0; usr < mdev->num_users; usr++) { 671 for (usr = 0; usr < mdev->num_users; usr++) {
664 reg = MAILBOX_IRQENABLE(mdev->intr_type, usr); 672 reg = MAILBOX_IRQENABLE(mdev->intr_type, usr);
665 mdev->irq_ctx[usr] = mbox_read_reg(mdev, reg); 673 mdev->irq_ctx[usr] = mbox_read_reg(mdev, reg);