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_glink_smem;
10 struct qcom_sysmon;
11 
12 struct qcom_rproc_glink {
13 	struct rproc_subdev subdev;
14 
15 	const char *ssr_name;
16 
17 	struct device *dev;
18 	struct device_node *node;
19 	struct qcom_glink_smem *edge;
20 };
21 
22 struct qcom_rproc_subdev {
23 	struct rproc_subdev subdev;
24 
25 	struct device *dev;
26 	struct device_node *node;
27 	struct qcom_smd_edge *edge;
28 };
29 
30 struct qcom_ssr_subsystem;
31 
32 struct qcom_rproc_ssr {
33 	struct rproc_subdev subdev;
34 	struct qcom_ssr_subsystem *info;
35 };
36 
37 void qcom_minidump(struct rproc *rproc, unsigned int minidump_id,
38 			void (*rproc_dumpfn_t)(struct rproc *rproc,
39 				struct rproc_dump_segment *segment, void *dest, size_t offset,
40 				size_t size));
41 
42 void qcom_add_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink,
43 			   const char *ssr_name);
44 void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink);
45 
46 int qcom_register_dump_segments(struct rproc *rproc, const struct firmware *fw);
47 
48 void qcom_add_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);
49 void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd);
50 
51 void qcom_add_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr,
52 			 const char *ssr_name);
53 void qcom_remove_ssr_subdev(struct rproc *rproc, struct qcom_rproc_ssr *ssr);
54 
55 #if IS_ENABLED(CONFIG_QCOM_SYSMON)
56 struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
57 					   const char *name,
58 					   int ssctl_instance);
59 void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon);
60 bool qcom_sysmon_shutdown_acked(struct qcom_sysmon *sysmon);
61 #else
62 static inline struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
63 							 const char *name,
64 							 int ssctl_instance)
65 {
66 	return NULL;
67 }
68 
69 static inline void qcom_remove_sysmon_subdev(struct qcom_sysmon *sysmon)
70 {
71 }
72 
73 static inline bool qcom_sysmon_shutdown_acked(struct qcom_sysmon *sysmon)
74 {
75 	return false;
76 }
77 #endif
78 
79 #endif
80