Lines Matching full:apr
13 #include <linux/soc/qcom/apr.h>
48 * apr_send_pkt() - Send a apr message from apr device
50 * @adev: Pointer to previously registered apr device.
51 * @pkt: Pointer to apr packet to send
57 struct packet_router *apr = dev_get_drvdata(adev->dev.parent); in apr_send_pkt() local
70 ret = rpmsg_trysend(apr->ch, pkt, hdr->pkt_size); in apr_send_pkt()
164 struct packet_router *apr = dev_get_drvdata(&rpdev->dev); in apr_callback() local
169 dev_err(apr->dev, "APR: Improper apr pkt received:%p %d\n", in apr_callback()
181 spin_lock_irqsave(&apr->rx_lock, flags); in apr_callback()
182 list_add_tail(&abuf->node, &apr->rx_list); in apr_callback()
183 spin_unlock_irqrestore(&apr->rx_lock, flags); in apr_callback()
185 queue_work(apr->rxwq, &apr->rx_work); in apr_callback()
190 static int apr_do_rx_callback(struct packet_router *apr, struct apr_rx_buf *abuf) in apr_do_rx_callback() argument
209 dev_err(apr->dev, "APR: Wrong hdr size:%d\n", hdr_size); in apr_do_rx_callback()
214 dev_err(apr->dev, "APR: Wrong packet size\n"); in apr_do_rx_callback()
220 dev_err(apr->dev, "APR: Wrong message type: %d\n", msg_type); in apr_do_rx_callback()
228 dev_err(apr->dev, "APR: Wrong APR header\n"); in apr_do_rx_callback()
233 spin_lock_irqsave(&apr->svcs_lock, flags); in apr_do_rx_callback()
234 svc = idr_find(&apr->svcs_idr, svc_id); in apr_do_rx_callback()
239 spin_unlock_irqrestore(&apr->svcs_lock, flags); in apr_do_rx_callback()
242 dev_err(apr->dev, "APR: service is not registered (%d)\n", in apr_do_rx_callback()
317 struct packet_router *apr = container_of(work, struct packet_router, rx_work); in apr_rxwq() local
321 if (!list_empty(&apr->rx_list)) { in apr_rxwq()
322 list_for_each_entry_safe(abuf, b, &apr->rx_list, node) { in apr_rxwq()
323 switch (apr->type) { in apr_rxwq()
325 apr_do_rx_callback(apr, abuf); in apr_rxwq()
328 gpr_do_rx_callback(apr, abuf); in apr_rxwq()
333 spin_lock_irqsave(&apr->rx_lock, flags); in apr_rxwq()
335 spin_unlock_irqrestore(&apr->rx_lock, flags); in apr_rxwq()
381 struct packet_router *apr = dev_get_drvdata(adev->dev.parent); in apr_device_remove() local
385 spin_lock(&apr->svcs_lock); in apr_device_remove()
386 idr_remove(&apr->svcs_idr, adev->svc.id); in apr_device_remove()
387 spin_unlock(&apr->svcs_lock); in apr_device_remove()
399 return add_uevent_var(env, "MODALIAS=apr:%s", adev->name); in apr_uevent()
414 struct packet_router *apr = dev_get_drvdata(dev); in apr_add_device() local
427 svc->pr = apr; in apr_add_device()
437 switch (apr->type) { in apr_add_device()
456 spin_lock(&apr->svcs_lock); in apr_add_device()
457 idr_alloc(&apr->svcs_idr, svc, svc_id, svc_id + 1, GFP_ATOMIC); in apr_add_device()
458 spin_unlock(&apr->svcs_lock); in apr_add_device()
463 dev_info(dev, "Adding APR/GPR dev: %s\n", dev_name(&adev->dev)); in apr_add_device()
477 struct packet_router *apr = dev_get_drvdata(dev); in of_apr_add_pd_lookups() local
496 pds = pdr_add_lookup(apr->pdr, service_name, service_path); in of_apr_add_pd_lookups()
509 struct packet_router *apr = dev_get_drvdata(dev); in of_register_apr_devices() local
520 * apr_probe(), in which case we register any apr devices in of_register_apr_devices()
526 * this case we register any apr devices with a matching in of_register_apr_devices()
533 /* skip APR services that are PD independent */ in of_register_apr_devices()
537 /* skip APR services whose PD paths don't match */ in of_register_apr_devices()
541 /* skip APR services whose PD lookups are registered */ in of_register_apr_devices()
549 domain_id = apr->dest_domain_id; in of_register_apr_devices()
552 dev_err(dev, "Failed to add apr %d svc\n", svc_id); in of_register_apr_devices()
572 struct packet_router *apr = (struct packet_router *)priv; in apr_pd_status() local
576 of_register_apr_devices(apr->dev, svc_path); in apr_pd_status()
579 device_for_each_child(apr->dev, svc_path, apr_remove_device); in apr_pd_status()
587 struct packet_router *apr; in apr_probe() local
590 apr = devm_kzalloc(dev, sizeof(*apr), GFP_KERNEL); in apr_probe()
591 if (!apr) in apr_probe()
594 ret = of_property_read_u32(dev->of_node, "qcom,domain", &apr->dest_domain_id); in apr_probe()
597 apr->type = PR_TYPE_GPR; in apr_probe()
599 if (ret) /* try deprecated apr-domain property */ in apr_probe()
600 ret = of_property_read_u32(dev->of_node, "qcom,apr-domain", in apr_probe()
601 &apr->dest_domain_id); in apr_probe()
602 apr->type = PR_TYPE_APR; in apr_probe()
610 dev_set_drvdata(dev, apr); in apr_probe()
611 apr->ch = rpdev->ept; in apr_probe()
612 apr->dev = dev; in apr_probe()
613 apr->rxwq = create_singlethread_workqueue("qcom_apr_rx"); in apr_probe()
614 if (!apr->rxwq) { in apr_probe()
615 dev_err(apr->dev, "Failed to start Rx WQ\n"); in apr_probe()
618 INIT_WORK(&apr->rx_work, apr_rxwq); in apr_probe()
620 apr->pdr = pdr_handle_alloc(apr_pd_status, apr); in apr_probe()
621 if (IS_ERR(apr->pdr)) { in apr_probe()
623 ret = PTR_ERR(apr->pdr); in apr_probe()
627 INIT_LIST_HEAD(&apr->rx_list); in apr_probe()
628 spin_lock_init(&apr->rx_lock); in apr_probe()
629 spin_lock_init(&apr->svcs_lock); in apr_probe()
630 idr_init(&apr->svcs_idr); in apr_probe()
641 pdr_handle_release(apr->pdr); in apr_probe()
643 destroy_workqueue(apr->rxwq); in apr_probe()
649 struct packet_router *apr = dev_get_drvdata(&rpdev->dev); in apr_remove() local
651 pdr_handle_release(apr->pdr); in apr_remove()
653 destroy_workqueue(apr->rxwq); in apr_remove()
686 { .compatible = "qcom,apr"},
687 { .compatible = "qcom,apr-v2"},
698 .name = "qcom,apr",
726 MODULE_DESCRIPTION("Qualcomm APR Bus");