2 * Copyright (C) 2014 Linaro Ltd.
3 * Author: Jassi Brar <jassisinghbrar@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #ifndef __MAILBOX_CLIENT_H
11 #define __MAILBOX_CLIENT_H
18 * struct mbox_client - User of a mailbox
19 * @dev: The client device
20 * @chan_name: The "controller:channel" this client wants
21 * @rx_callback: Atomic callback to provide client the data received
22 * @tx_done: Atomic callback to tell client of data transmission
23 * @tx_block: If the mbox_send_message should block until data is
25 * @tx_tout: Max block period in ms before TX is assumed failure
26 * @knows_txdone: if the client could run the TX state machine. Usually
27 * if the client receives some ACK packet for transmission.
28 * Unused if the controller already has TX_Done/RTR IRQ.
32 const char *chan_name;
33 void (*rx_callback)(struct mbox_client *cl, void *mssg);
34 void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
36 unsigned long tx_tout;
40 struct mbox_chan *mbox_request_channel(struct mbox_client *cl);
41 int mbox_send_message(struct mbox_chan *chan, void *mssg);
42 void mbox_client_txdone(struct mbox_chan *chan, int r);
43 bool mbox_client_peek_data(struct mbox_chan *chan);
44 void mbox_free_channel(struct mbox_chan *chan);
46 #endif /* __MAILBOX_CLIENT_H */