Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit adafdfa9 authored by Lina Iyer's avatar Lina Iyer
Browse files

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: default avatarLina Iyer <ilina@codeaurora.org>
parent c5c9ce5f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -283,6 +283,16 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
}
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.
+1 −0
Original line number Diff line number Diff line
@@ -47,5 +47,6 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg);
void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
bool mbox_controller_is_idle(struct mbox_chan *chan); /* atomic */

#endif /* __MAILBOX_CLIENT_H */
+2 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ struct mbox_chan_ops {
 * @txpoll_period:	If 'txdone_poll' is in effect, the API polls for
 *			last TX's status after these many millisecs
 * @of_xlate:		Controller driver specific mapping of channel via DT
 * @is_idle:		Is the controller idle?
 * @poll_hrt:		API private. hrtimer used to poll for TXDONE on all
 *			channels.
 * @node:		API private. To hook into list of controllers.
@@ -81,6 +82,7 @@ struct mbox_controller {
	unsigned txpoll_period;
	struct mbox_chan *(*of_xlate)(struct mbox_controller *mbox,
				      const struct of_phandle_args *sp);
	bool (*is_idle)(struct mbox_controller *mbox);
	/* Internal to API */
	struct hrtimer poll_hrt;
	struct list_head node;