.. | .. |
---|
2 | 2 | /* |
---|
3 | 3 | * Remote processor messaging |
---|
4 | 4 | * |
---|
| 5 | + * Copyright (c) 2020 The Linux Foundation. |
---|
5 | 6 | * Copyright (C) 2011 Texas Instruments, Inc. |
---|
6 | 7 | * Copyright (C) 2011 Google, Inc. |
---|
7 | 8 | * All rights reserved. |
---|
.. | .. |
---|
60 | 61 | }; |
---|
61 | 62 | |
---|
62 | 63 | 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); |
---|
63 | 65 | |
---|
64 | 66 | /** |
---|
65 | 67 | * struct rpmsg_endpoint - binds a local rpmsg address to its user |
---|
.. | .. |
---|
67 | 69 | * @refcount: when this drops to zero, the ept is deallocated |
---|
68 | 70 | * @cb: rx callback handler |
---|
69 | 71 | * @cb_lock: must be taken before accessing/changing @cb |
---|
| 72 | + * @sig_cb: rx serial signal handler |
---|
70 | 73 | * @addr: local rpmsg address |
---|
71 | 74 | * @priv: private data for the driver's use |
---|
72 | 75 | * |
---|
.. | .. |
---|
89 | 92 | struct kref refcount; |
---|
90 | 93 | rpmsg_rx_cb_t cb; |
---|
91 | 94 | struct mutex cb_lock; |
---|
| 95 | + rpmsg_rx_sig_t sig_cb; |
---|
92 | 96 | u32 addr; |
---|
93 | 97 | void *priv; |
---|
94 | 98 | |
---|
.. | .. |
---|
102 | 106 | * @probe: invoked when a matching rpmsg channel (i.e. device) is found |
---|
103 | 107 | * @remove: invoked when the rpmsg channel is removed |
---|
104 | 108 | * @callback: invoked when an inbound message is received on the channel |
---|
| 109 | + * @signals: invoked when a serial signal change is received on the channel |
---|
105 | 110 | */ |
---|
106 | 111 | struct rpmsg_driver { |
---|
107 | 112 | struct device_driver drv; |
---|
.. | .. |
---|
109 | 114 | int (*probe)(struct rpmsg_device *dev); |
---|
110 | 115 | void (*remove)(struct rpmsg_device *dev); |
---|
111 | 116 | int (*callback)(struct rpmsg_device *, void *, int, void *, u32); |
---|
| 117 | + int (*signals)(struct rpmsg_device *rpdev, |
---|
| 118 | + void *priv, u32 old, u32 new); |
---|
112 | 119 | }; |
---|
113 | 120 | |
---|
114 | 121 | #if IS_ENABLED(CONFIG_RPMSG) |
---|
.. | .. |
---|
134 | 141 | |
---|
135 | 142 | __poll_t rpmsg_poll(struct rpmsg_endpoint *ept, struct file *filp, |
---|
136 | 143 | 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); |
---|
137 | 149 | |
---|
138 | 150 | #else |
---|
139 | 151 | |
---|
.. | .. |
---|
242 | 254 | return 0; |
---|
243 | 255 | } |
---|
244 | 256 | |
---|
| 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 | + |
---|
245 | 282 | #endif /* IS_ENABLED(CONFIG_RPMSG) */ |
---|
246 | 283 | |
---|
247 | 284 | /* use a macro to avoid include chaining to get THIS_MODULE */ |
---|