| .. | .. |
|---|
| 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); |
|---|
| 137 | 147 | |
|---|
| 138 | 148 | #else |
|---|
| 139 | 149 | |
|---|
| .. | .. |
|---|
| 242 | 252 | return 0; |
|---|
| 243 | 253 | } |
|---|
| 244 | 254 | |
|---|
| 255 | +static inline int rpmsg_get_signals(struct rpmsg_endpoint *ept) |
|---|
| 256 | +{ |
|---|
| 257 | + /* This shouldn't be possible */ |
|---|
| 258 | + WARN_ON(1); |
|---|
| 259 | + |
|---|
| 260 | + return -ENXIO; |
|---|
| 261 | +} |
|---|
| 262 | + |
|---|
| 263 | +static inline int rpmsg_set_signals(struct rpmsg_endpoint *ept, |
|---|
| 264 | + u32 set, u32 clear) |
|---|
| 265 | +{ |
|---|
| 266 | + /* This shouldn't be possible */ |
|---|
| 267 | + WARN_ON(1); |
|---|
| 268 | + |
|---|
| 269 | + return -ENXIO; |
|---|
| 270 | +} |
|---|
| 271 | + |
|---|
| 245 | 272 | #endif /* IS_ENABLED(CONFIG_RPMSG) */ |
|---|
| 246 | 273 | |
|---|
| 247 | 274 | /* use a macro to avoid include chaining to get THIS_MODULE */ |
|---|