1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __RPROC_QCOM_COMMON_H__
3 #define __RPROC_QCOM_COMMON_H__
4 
5 #include <linux/remoteproc.h>
6 #include "remoteproc_internal.h"
7 #include <linux/soc/qcom/qmi.h>
8 
9 struct qcom_sysmon;
10 
11 struct qcom_rproc_glink {
12 	struct rproc_subdev subdev;
13 
14 	const char *ssr_name;
15 
16 	struct device *dev;
17 	struct device_node *node;
18 	struct qcom_glink *edge;
19 };
20 
21 struct qcom_rproc_subdev {
22 	struct rproc_subdev subdev;
23 
24 	struct device *dev;
25 	struct device_node *node;
26 	struct qcom_smd_edge *edge;
27 };
28 
29 struct qcom_rproc_ssr {
30 	struct rproc_subdev subdev;
31 
32 	const char *name;
33 };
34 
35 void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
36 			   const char *ssr_name);
37 void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
38 
39 int qcom_register_dump_segments(struct rproc *rproc, const struct firmware *fw);
40 
41 void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);
42 void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);
43 
44 void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr,
45 			 const char *ssr_name);
46 void qcom_remove_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr);
47 
48 #if IS_ENABLED(CONFIG_QCOM_SYSMON)
49 struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
50 					   const char *name,
51 					   int ssctl_instance);
52 void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon);
53 #else
54 static inline struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
55 							 const char *name,
56 							 int ssctl_instance)
57 {
58 	return NULL;
59 }
60 
61 static inline void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon)
62 {
63 }
64 #endif
65 
66 #endif
67