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

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

Merge "drivers: mailbox: Write data to the controller without sending" into msm-4.8

parents 6239b824 c525b8d3
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -281,6 +281,34 @@ int mbox_send_message(struct mbox_chan *chan, void *mssg)
}
EXPORT_SYMBOL_GPL(mbox_send_message);

/**
 * mbox_send_controller_data-	For client to submit a message to be
 *				sent only to the controller.
 * @chan: Mailbox channel assigned to this client.
 * @mssg: Client specific message typecasted.
 *
 * For client to submit data to the controller. There is no ACK expected
 * from the controller. This request is not buffered in the mailbox framework.
 *
 * Return: Non-negative integer for successful submission (non-blocking mode)
 *	or transmission over chan (blocking mode).
 *	Negative value denotes failure.
 */
int mbox_send_controller_data(struct mbox_chan *chan, void *mssg)
{
	unsigned long flags;
	int err;

	if (!chan || !chan->cl)
		return -EINVAL;

	spin_lock_irqsave(&chan->lock, flags);
	err = chan->mbox->ops->send_controller_data(chan, mssg);
	spin_unlock_irqrestore(&chan->lock, flags);

	return err;
}
EXPORT_SYMBOL(mbox_send_controller_data);

bool mbox_controller_is_idle(struct mbox_chan *chan)
{
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
					      const char *name);
struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
int mbox_send_message(struct mbox_chan *chan, void *mssg);
int mbox_send_controller_data(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 */
+7 −0
Original line number Diff line number Diff line
@@ -24,6 +24,12 @@ struct mbox_chan;
 *		transmission of data is reported by the controller via
 *		mbox_chan_txdone (if it has some TX ACK irq). It must not
 *		sleep.
 * @send_controller_data:
 *		Send data for the controller driver. This could be data to
 *		configure the controller or data that may be cached in the
 *		controller and not transmitted immediately. There is no ACK
 *		for this request and the request is not buffered in the
 *		controller. Must not sleep.
 * @startup:	Called when a client requests the chan. The controller
 *		could ask clients for additional parameters of communication
 *		to be provided via client's chan_data. This call may
@@ -46,6 +52,7 @@ struct mbox_chan;
 */
struct mbox_chan_ops {
	int (*send_data)(struct mbox_chan *chan, void *data);
	int (*send_controller_data)(struct mbox_chan *chan, void *data);
	int (*startup)(struct mbox_chan *chan);
	void (*shutdown)(struct mbox_chan *chan);
	bool (*last_tx_done)(struct mbox_chan *chan);