xref: /OK3568_Linux_fs/kernel/include/linux/rpmsg/mtk_rpmsg.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright 2019 Google LLC.
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #ifndef __LINUX_RPMSG_MTK_RPMSG_H
7*4882a593Smuzhiyun #define __LINUX_RPMSG_MTK_RPMSG_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/platform_device.h>
10*4882a593Smuzhiyun #include <linux/remoteproc.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun typedef void (*ipi_handler_t)(void *data, unsigned int len, void *priv);
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * struct mtk_rpmsg_info - IPI functions tied to the rpmsg device.
16*4882a593Smuzhiyun  * @register_ipi: register IPI handler for an IPI id.
17*4882a593Smuzhiyun  * @unregister_ipi: unregister IPI handler for a registered IPI id.
18*4882a593Smuzhiyun  * @send_ipi: send IPI to an IPI id. wait is the timeout (in msecs) to wait
19*4882a593Smuzhiyun  *            until response, or 0 if there's no timeout.
20*4882a593Smuzhiyun  * @ns_ipi_id: the IPI id used for name service, or -1 if name service isn't
21*4882a593Smuzhiyun  *             supported.
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun struct mtk_rpmsg_info {
24*4882a593Smuzhiyun 	int (*register_ipi)(struct platform_device *pdev, u32 id,
25*4882a593Smuzhiyun 			    ipi_handler_t handler, void *priv);
26*4882a593Smuzhiyun 	void (*unregister_ipi)(struct platform_device *pdev, u32 id);
27*4882a593Smuzhiyun 	int (*send_ipi)(struct platform_device *pdev, u32 id,
28*4882a593Smuzhiyun 			void *buf, unsigned int len, unsigned int wait);
29*4882a593Smuzhiyun 	int ns_ipi_id;
30*4882a593Smuzhiyun };
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun struct rproc_subdev *
33*4882a593Smuzhiyun mtk_rpmsg_create_rproc_subdev(struct platform_device *pdev,
34*4882a593Smuzhiyun 			      struct mtk_rpmsg_info *info);
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun void mtk_rpmsg_destroy_rproc_subdev(struct rproc_subdev *subdev);
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun #endif
39