drivers: mailbox: query controller idle status

Power drivers that are interested in knowing the current state of the
controller so they can turn down idle states may do so using the
->is_idle() callback on the controller. The call will default to false,
if the controller does not support the ->is_idle callback.

Change-Id: Idf4290d3a651604c8637425abfa25cedc9a02d10
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 4a36632..36029fb 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -281,6 +281,16 @@
 }
 EXPORT_SYMBOL_GPL(mbox_send_message);
 
+
+bool mbox_controller_is_idle(struct mbox_chan *chan)
+{
+	if (!chan || !chan->cl || !chan->mbox->is_idle)
+		return false;
+
+	return chan->mbox->is_idle(chan->mbox);
+}
+EXPORT_SYMBOL(mbox_controller_is_idle);
+
 /**
  * mbox_request_channel - Request a mailbox channel.
  * @cl: Identity of the client requesting the channel.