hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/linux/rpmsg.h
....@@ -2,6 +2,7 @@
22 /*
33 * Remote processor messaging
44 *
5
+ * Copyright (c) 2020 The Linux Foundation.
56 * Copyright (C) 2011 Texas Instruments, Inc.
67 * Copyright (C) 2011 Google, Inc.
78 * All rights reserved.
....@@ -60,6 +61,7 @@
6061 };
6162
6263 typedef int (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32);
64
+typedef int (*rpmsg_rx_sig_t)(struct rpmsg_device *, void *, u32, u32);
6365
6466 /**
6567 * struct rpmsg_endpoint - binds a local rpmsg address to its user
....@@ -67,6 +69,7 @@
6769 * @refcount: when this drops to zero, the ept is deallocated
6870 * @cb: rx callback handler
6971 * @cb_lock: must be taken before accessing/changing @cb
72
+ * @sig_cb: rx serial signal handler
7073 * @addr: local rpmsg address
7174 * @priv: private data for the driver's use
7275 *
....@@ -89,6 +92,7 @@
8992 struct kref refcount;
9093 rpmsg_rx_cb_t cb;
9194 struct mutex cb_lock;
95
+ rpmsg_rx_sig_t sig_cb;
9296 u32 addr;
9397 void *priv;
9498
....@@ -102,6 +106,7 @@
102106 * @probe: invoked when a matching rpmsg channel (i.e. device) is found
103107 * @remove: invoked when the rpmsg channel is removed
104108 * @callback: invoked when an inbound message is received on the channel
109
+ * @signals: invoked when a serial signal change is received on the channel
105110 */
106111 struct rpmsg_driver {
107112 struct device_driver drv;
....@@ -109,6 +114,8 @@
109114 int (*probe)(struct rpmsg_device *dev);
110115 void (*remove)(struct rpmsg_device *dev);
111116 int (*callback)(struct rpmsg_device *, void *, int, void *, u32);
117
+ int (*signals)(struct rpmsg_device *rpdev,
118
+ void *priv, u32 old, u32 new);
112119 };
113120
114121 #if IS_ENABLED(CONFIG_RPMSG)
....@@ -134,6 +141,11 @@
134141
135142 __poll_t rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp,
136143 poll_table *wait);
144
+
145
+int rpmsg_get_signals(struct rpmsg_endpoint *ept);
146
+int rpmsg_set_signals(struct rpmsg_endpoint *ept, u32 set, u32 clear);
147
+
148
+ssize_t rpmsg_get_mtu(struct rpmsg_endpoint *ept);
137149
138150 #else
139151
....@@ -242,6 +254,31 @@
242254 return 0;
243255 }
244256
257
+static inline int rpmsg_get_signals(struct rpmsg_endpoint *ept)
258
+{
259
+ /* This shouldn't be possible */
260
+ WARN_ON(1);
261
+
262
+ return -ENXIO;
263
+}
264
+
265
+static inline int rpmsg_set_signals(struct rpmsg_endpoint *ept,
266
+ u32 set, u32 clear)
267
+{
268
+ /* This shouldn't be possible */
269
+ WARN_ON(1);
270
+
271
+ return -ENXIO;
272
+}
273
+
274
+static inline ssize_t rpmsg_get_mtu(struct rpmsg_endpoint *ept)
275
+{
276
+ /* This shouldn't be possible */
277
+ WARN_ON(1);
278
+
279
+ return -ENXIO;
280
+}
281
+
245282 #endif /* IS_ENABLED(CONFIG_RPMSG) */
246283
247284 /* use a macro to avoid include chaining to get THIS_MODULE */