.. | .. |
---|
46 | 46 | * equals to the src address of their rpmsg channel), the driver's handler |
---|
47 | 47 | * is invoked to process it. |
---|
48 | 48 | * |
---|
49 | | - * That said, more complicated drivers might do need to allocate |
---|
| 49 | + * That said, more complicated drivers might need to allocate |
---|
50 | 50 | * additional rpmsg addresses, and bind them to different rx callbacks. |
---|
51 | 51 | * To accomplish that, those drivers need to call this function. |
---|
52 | 52 | * |
---|
.. | .. |
---|
81 | 81 | */ |
---|
82 | 82 | void rpmsg_destroy_ept(struct rpmsg_endpoint *ept) |
---|
83 | 83 | { |
---|
84 | | - if (ept) |
---|
| 84 | + if (ept && ept->ops) |
---|
85 | 85 | ept->ops->destroy_ept(ept); |
---|
86 | 86 | } |
---|
87 | 87 | EXPORT_SYMBOL(rpmsg_destroy_ept); |
---|
.. | .. |
---|
177 | 177 | EXPORT_SYMBOL(rpmsg_send_offchannel); |
---|
178 | 178 | |
---|
179 | 179 | /** |
---|
180 | | - * rpmsg_send() - send a message across to the remote processor |
---|
| 180 | + * rpmsg_trysend() - send a message across to the remote processor |
---|
181 | 181 | * @ept: the rpmsg endpoint |
---|
182 | 182 | * @data: payload of message |
---|
183 | 183 | * @len: length of payload |
---|
.. | .. |
---|
205 | 205 | EXPORT_SYMBOL(rpmsg_trysend); |
---|
206 | 206 | |
---|
207 | 207 | /** |
---|
208 | | - * rpmsg_sendto() - send a message across to the remote processor, specify dst |
---|
| 208 | + * rpmsg_trysendto() - send a message across to the remote processor, specify dst |
---|
209 | 209 | * @ept: the rpmsg endpoint |
---|
210 | 210 | * @data: payload of message |
---|
211 | 211 | * @len: length of payload |
---|
.. | .. |
---|
253 | 253 | EXPORT_SYMBOL(rpmsg_poll); |
---|
254 | 254 | |
---|
255 | 255 | /** |
---|
256 | | - * rpmsg_send_offchannel() - send a message using explicit src/dst addresses |
---|
| 256 | + * rpmsg_trysend_offchannel() - send a message using explicit src/dst addresses |
---|
257 | 257 | * @ept: the rpmsg endpoint |
---|
258 | 258 | * @src: source address |
---|
259 | 259 | * @dst: destination address |
---|
.. | .. |
---|
283 | 283 | } |
---|
284 | 284 | EXPORT_SYMBOL(rpmsg_trysend_offchannel); |
---|
285 | 285 | |
---|
| 286 | +/** |
---|
| 287 | + * rpmsg_get_signals() - get the signals for this endpoint |
---|
| 288 | + * @ept: the rpmsg endpoint |
---|
| 289 | + * |
---|
| 290 | + * Returns signal bits on success and an appropriate error value on failure. |
---|
| 291 | + */ |
---|
| 292 | +int rpmsg_get_signals(struct rpmsg_endpoint *ept) |
---|
| 293 | +{ |
---|
| 294 | + if (WARN_ON(!ept)) |
---|
| 295 | + return -EINVAL; |
---|
| 296 | + if (!ept->ops->get_signals) |
---|
| 297 | + return -ENXIO; |
---|
| 298 | + |
---|
| 299 | + return ept->ops->get_signals(ept); |
---|
| 300 | +} |
---|
| 301 | +EXPORT_SYMBOL(rpmsg_get_signals); |
---|
| 302 | + |
---|
| 303 | +/** |
---|
| 304 | + * rpmsg_set_signals() - set the remote signals for this endpoint |
---|
| 305 | + * @ept: the rpmsg endpoint |
---|
| 306 | + * @set: set mask for signals |
---|
| 307 | + * @clear: clear mask for signals |
---|
| 308 | + * |
---|
| 309 | + * Returns 0 on success and an appropriate error value on failure. |
---|
| 310 | + */ |
---|
| 311 | +int rpmsg_set_signals(struct rpmsg_endpoint *ept, u32 set, u32 clear) |
---|
| 312 | +{ |
---|
| 313 | + if (WARN_ON(!ept)) |
---|
| 314 | + return -EINVAL; |
---|
| 315 | + if (!ept->ops->set_signals) |
---|
| 316 | + return -ENXIO; |
---|
| 317 | + |
---|
| 318 | + return ept->ops->set_signals(ept, set, clear); |
---|
| 319 | +} |
---|
| 320 | +EXPORT_SYMBOL(rpmsg_set_signals); |
---|
| 321 | + |
---|
| 322 | +#ifdef CONFIG_NO_GKI |
---|
| 323 | +/** |
---|
| 324 | + * rpmsg_get_mtu() - get maximum transmission buffer size for sending message. |
---|
| 325 | + * @ept: the rpmsg endpoint |
---|
| 326 | + * |
---|
| 327 | + * This function returns maximum buffer size available for a single outgoing message. |
---|
| 328 | + * |
---|
| 329 | + * Return: the maximum transmission size on success and an appropriate error |
---|
| 330 | + * value on failure. |
---|
| 331 | + */ |
---|
| 332 | + |
---|
| 333 | +ssize_t rpmsg_get_mtu(struct rpmsg_endpoint *ept) |
---|
| 334 | +{ |
---|
| 335 | + if (WARN_ON(!ept)) |
---|
| 336 | + return -EINVAL; |
---|
| 337 | + if (!ept->ops->get_mtu) |
---|
| 338 | + return -ENOTSUPP; |
---|
| 339 | + |
---|
| 340 | + return ept->ops->get_mtu(ept); |
---|
| 341 | +} |
---|
| 342 | +EXPORT_SYMBOL(rpmsg_get_mtu); |
---|
| 343 | +#endif |
---|
| 344 | + |
---|
286 | 345 | /* |
---|
287 | | - * match an rpmsg channel with a channel info struct. |
---|
| 346 | + * match a rpmsg channel with a channel info struct. |
---|
288 | 347 | * this is used to make sure we're not creating rpmsg devices for channels |
---|
289 | 348 | * that already exist. |
---|
290 | 349 | */ |
---|
.. | .. |
---|
468 | 527 | |
---|
469 | 528 | rpdev->ept = ept; |
---|
470 | 529 | rpdev->src = ept->addr; |
---|
| 530 | + |
---|
| 531 | + if (rpdrv->signals) |
---|
| 532 | + ept->sig_cb = rpdrv->signals; |
---|
| 533 | + |
---|
471 | 534 | } |
---|
472 | 535 | |
---|
473 | 536 | err = rpdrv->probe(rpdev); |
---|
.. | .. |
---|
505 | 568 | if (rpdev->ops->announce_destroy) |
---|
506 | 569 | err = rpdev->ops->announce_destroy(rpdev); |
---|
507 | 570 | |
---|
508 | | - rpdrv->remove(rpdev); |
---|
| 571 | + if (rpdrv->remove) |
---|
| 572 | + rpdrv->remove(rpdev); |
---|
509 | 573 | |
---|
510 | 574 | dev_pm_domain_detach(dev, true); |
---|
511 | 575 | |
---|