Lines Matching +full:remote +full:- +full:bus

1 // SPDX-License-Identifier: GPL-2.0
3 * remote processor messaging bus
8 * Ohad Ben-Cohen <ohad@wizery.com>
24 * rpmsg_create_ept() - create a new rpmsg_endpoint
31 * inbound messages arrive, they are dispatched by the rpmsg bus using the
40 * is already created for them when they are probed by the rpmsg bus
41 * (using the rx callback provided when they registered to the rpmsg bus).
54 * to the same remote processor their channel belongs to), an rx callback
70 return rpdev->ops->create_ept(rpdev, cb, priv, chinfo); in rpmsg_create_ept()
75 * rpmsg_destroy_ept() - destroy an existing rpmsg endpoint
84 if (ept && ept->ops) in rpmsg_destroy_ept()
85 ept->ops->destroy_ept(ept); in rpmsg_destroy_ept()
90 * rpmsg_send() - send a message across to the remote processor
96 * The message will be sent to the remote processor which the @ept
101 * happens, -ERESTARTSYS is returned.
110 return -EINVAL; in rpmsg_send()
111 if (!ept->ops->send) in rpmsg_send()
112 return -ENXIO; in rpmsg_send()
114 return ept->ops->send(ept, data, len); in rpmsg_send()
119 * rpmsg_sendto() - send a message across to the remote processor, specify dst
125 * This function sends @data of length @len to the remote @dst address.
126 * The message will be sent to the remote processor which the @ept
130 * happens, -ERESTARTSYS is returned.
139 return -EINVAL; in rpmsg_sendto()
140 if (!ept->ops->sendto) in rpmsg_sendto()
141 return -ENXIO; in rpmsg_sendto()
143 return ept->ops->sendto(ept, data, len, dst); in rpmsg_sendto()
148 * rpmsg_send_offchannel() - send a message using explicit src/dst addresses
155 * This function sends @data of length @len to the remote @dst address,
157 * The message will be sent to the remote processor which the @ept
161 * happens, -ERESTARTSYS is returned.
171 return -EINVAL; in rpmsg_send_offchannel()
172 if (!ept->ops->send_offchannel) in rpmsg_send_offchannel()
173 return -ENXIO; in rpmsg_send_offchannel()
175 return ept->ops->send_offchannel(ept, src, dst, data, len); in rpmsg_send_offchannel()
180 * rpmsg_trysend() - send a message across to the remote processor
186 * The message will be sent to the remote processor which the @ept
190 * return -ENOMEM without waiting until one becomes available.
199 return -EINVAL; in rpmsg_trysend()
200 if (!ept->ops->trysend) in rpmsg_trysend()
201 return -ENXIO; in rpmsg_trysend()
203 return ept->ops->trysend(ept, data, len); in rpmsg_trysend()
208 * rpmsg_trysendto() - send a message across to the remote processor, specify dst
214 * This function sends @data of length @len to the remote @dst address.
215 * The message will be sent to the remote processor which the @ept
218 * return -ENOMEM without waiting until one becomes available.
227 return -EINVAL; in rpmsg_trysendto()
228 if (!ept->ops->trysendto) in rpmsg_trysendto()
229 return -ENXIO; in rpmsg_trysendto()
231 return ept->ops->trysendto(ept, data, len, dst); in rpmsg_trysendto()
236 * rpmsg_poll() - poll the endpoint's send buffers
248 if (!ept->ops->poll) in rpmsg_poll()
251 return ept->ops->poll(ept, filp, wait); in rpmsg_poll()
256 * rpmsg_trysend_offchannel() - send a message using explicit src/dst addresses
263 * This function sends @data of length @len to the remote @dst address,
265 * The message will be sent to the remote processor which the @ept
268 * return -ENOMEM without waiting until one becomes available.
278 return -EINVAL; in rpmsg_trysend_offchannel()
279 if (!ept->ops->trysend_offchannel) in rpmsg_trysend_offchannel()
280 return -ENXIO; in rpmsg_trysend_offchannel()
282 return ept->ops->trysend_offchannel(ept, src, dst, data, len); in rpmsg_trysend_offchannel()
296 if (chinfo->src != RPMSG_ADDR_ANY && chinfo->src != rpdev->src) in rpmsg_device_match()
299 if (chinfo->dst != RPMSG_ADDR_ANY && chinfo->dst != rpdev->dst) in rpmsg_device_match()
302 if (strncmp(chinfo->name, rpdev->id.name, RPMSG_NAME_SIZE)) in rpmsg_device_match()
325 return sprintf(buf, format_string, rpdev->path); \
339 return -ENOMEM; \
343 old = rpdev->member; \
345 rpdev->member = new; \
348 rpdev->member = NULL; \
362 return sprintf(buf, "%s\n", rpdev->member); \
366 /* for more info, see Documentation/ABI/testing/sysfs-bus-rpmsg */
380 if (len != -ENODEV) in modalias_show()
383 return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name); in modalias_show()
402 return strncmp(id->name, rpdev->id.name, RPMSG_NAME_SIZE) == 0; in rpmsg_id_match()
410 const struct rpmsg_device_id *ids = rpdrv->id_table; in rpmsg_dev_match()
413 if (rpdev->driver_override) in rpmsg_dev_match()
414 return !strcmp(rpdev->driver_override, drv->name); in rpmsg_dev_match()
430 if (ret != -ENODEV) in rpmsg_uevent()
434 rpdev->id.name); in rpmsg_uevent()
442 * if we need to, we also announce about this channel to the remote
448 struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver); in rpmsg_dev_probe()
457 if (rpdrv->callback) { in rpmsg_dev_probe()
458 strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE); in rpmsg_dev_probe()
459 chinfo.src = rpdev->src; in rpmsg_dev_probe()
462 ept = rpmsg_create_ept(rpdev, rpdrv->callback, NULL, chinfo); in rpmsg_dev_probe()
465 err = -ENOMEM; in rpmsg_dev_probe()
469 rpdev->ept = ept; in rpmsg_dev_probe()
470 rpdev->src = ept->addr; in rpmsg_dev_probe()
473 err = rpdrv->probe(rpdev); in rpmsg_dev_probe()
481 if (ept && rpdev->ops->announce_create) in rpmsg_dev_probe()
482 err = rpdev->ops->announce_create(rpdev); in rpmsg_dev_probe()
490 struct rpmsg_driver *rpdrv = to_rpmsg_driver(rpdev->dev.driver); in rpmsg_dev_remove()
493 if (rpdev->ops->announce_destroy) in rpmsg_dev_remove()
494 err = rpdev->ops->announce_destroy(rpdev); in rpmsg_dev_remove()
496 if (rpdrv->remove) in rpmsg_dev_remove()
497 rpdrv->remove(rpdev); in rpmsg_dev_remove()
501 if (rpdev->ept) in rpmsg_dev_remove()
502 rpmsg_destroy_ept(rpdev->ept); in rpmsg_dev_remove()
518 struct device *dev = &rpdev->dev; in rpmsg_register_device()
521 dev_set_name(&rpdev->dev, "%s.%s.%d.%d", dev_name(dev->parent), in rpmsg_register_device()
522 rpdev->id.name, rpdev->src, rpdev->dst); in rpmsg_register_device()
524 rpdev->dev.bus = &rpmsg_bus; in rpmsg_register_device()
526 ret = device_register(&rpdev->dev); in rpmsg_register_device()
529 put_device(&rpdev->dev); in rpmsg_register_device()
547 return -EINVAL; in rpmsg_unregister_device()
558 * __register_rpmsg_driver() - register an rpmsg driver with the rpmsg bus
566 rpdrv->drv.bus = &rpmsg_bus; in __register_rpmsg_driver()
567 rpdrv->drv.owner = owner; in __register_rpmsg_driver()
568 return driver_register(&rpdrv->drv); in __register_rpmsg_driver()
573 * unregister_rpmsg_driver() - unregister an rpmsg driver from the rpmsg bus
580 driver_unregister(&rpdrv->drv); in unregister_rpmsg_driver()
591 pr_err("failed to register rpmsg bus: %d\n", ret); in rpmsg_init()
603 MODULE_DESCRIPTION("remote processor messaging bus");