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

Commit f41f3447 authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: mailbox: tcs: Support mbox controller ->is_idle()" into msm-4.8

parents 49ef9cde 0d81e947
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -485,6 +485,29 @@ static void __tcs_buffer_write(void __iomem *base, int d, int m, int n,
	}
}

/**
 * tcs_drv_is_idle: Check if any of the AMCs are busy.
 *
 * @mbox: The mailbox controller.
 *
 * Returns true if the AMCs are not engaged or absent.
 */
static bool tcs_drv_is_idle(struct mbox_controller *mbox)
{
	int m;
	struct tcs_drv *drv = container_of(mbox, struct tcs_drv, mbox);
	struct tcs_mbox *tcs = get_tcs_of_type(drv, ACTIVE_TCS);

	if (IS_ERR(tcs))
		return true;

	for (m = tcs->tcs_offset; m < tcs->tcs_offset + tcs->num_tcs; m++)
		if (!tcs_is_free(drv->reg_base, m))
			return false;

	return true;
}

static void wait_for_req_inflight(struct tcs_drv *drv, struct tcs_mbox *tcs,
						struct tcs_mbox_msg *msg)
{
@@ -997,6 +1020,7 @@ static int tcs_drv_probe(struct platform_device *pdev)
	drv->mbox.num_chans = num_chans;
	drv->mbox.txdone_irq = true;
	drv->mbox.of_xlate = of_tcs_mbox_xlate;
	drv->mbox.is_idle = tcs_drv_is_idle;
	drv->num_tcs = st;
	drv->pdev = pdev;

+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,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?
 * @is_idle:		Return if the controller is idle.
 * @poll_hrt:		API private. hrtimer used to poll for TXDONE on all
 *			channels.
 * @node:		API private. To hook into list of controllers.