Lines Matching refs:xdev
55 xvip_graph_find_entity(struct xvip_composite_device *xdev, in xvip_graph_find_entity() argument
60 list_for_each_entry(entity, &xdev->entities, list) { in xvip_graph_find_entity()
68 static int xvip_graph_build_one(struct xvip_composite_device *xdev, in xvip_graph_build_one() argument
82 dev_dbg(xdev->dev, "creating links for entity %s\n", local->name); in xvip_graph_build_one()
93 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name); in xvip_graph_build_one()
97 dev_err(xdev->dev, "failed to parse link for %s\n", in xvip_graph_build_one()
106 dev_err(xdev->dev, "invalid port number %u on %s\n", in xvip_graph_build_one()
116 dev_dbg(xdev->dev, "skipping sink port %s:%u\n", in xvip_graph_build_one()
123 if (link.remote_node == xdev->dev->of_node) { in xvip_graph_build_one()
124 dev_dbg(xdev->dev, "skipping DMA port %s:%u\n", in xvip_graph_build_one()
131 ent = xvip_graph_find_entity(xdev, link.remote_node); in xvip_graph_build_one()
133 dev_err(xdev->dev, "no entity found for %s\n", in xvip_graph_build_one()
143 dev_err(xdev->dev, "invalid port number %u on %s\n", in xvip_graph_build_one()
155 dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n", in xvip_graph_build_one()
163 dev_err(xdev->dev, in xvip_graph_build_one()
176 xvip_graph_find_dma(struct xvip_composite_device *xdev, unsigned int port) in xvip_graph_find_dma() argument
180 list_for_each_entry(dma, &xdev->dmas, list) { in xvip_graph_find_dma()
188 static int xvip_graph_build_dma(struct xvip_composite_device *xdev) in xvip_graph_build_dma() argument
191 struct device_node *node = xdev->dev->of_node; in xvip_graph_build_dma()
203 dev_dbg(xdev->dev, "creating links for DMA engines\n"); in xvip_graph_build_dma()
214 dev_dbg(xdev->dev, "processing endpoint %s\n", ep->full_name); in xvip_graph_build_dma()
218 dev_err(xdev->dev, "failed to parse link for %s\n", in xvip_graph_build_dma()
224 dma = xvip_graph_find_dma(xdev, link.local_port); in xvip_graph_build_dma()
226 dev_err(xdev->dev, "no DMA engine found for port %u\n", in xvip_graph_build_dma()
233 dev_dbg(xdev->dev, "creating link for DMA engine %s\n", in xvip_graph_build_dma()
237 ent = xvip_graph_find_entity(xdev, link.remote_node); in xvip_graph_build_dma()
239 dev_err(xdev->dev, "no entity found for %s\n", in xvip_graph_build_dma()
247 dev_err(xdev->dev, "invalid port number %u on %s\n", in xvip_graph_build_dma()
269 dev_dbg(xdev->dev, "creating %s:%u -> %s:%u link\n", in xvip_graph_build_dma()
277 dev_err(xdev->dev, in xvip_graph_build_dma()
291 struct xvip_composite_device *xdev = in xvip_graph_notify_complete() local
296 dev_dbg(xdev->dev, "notify complete, all subdevs registered\n"); in xvip_graph_notify_complete()
299 list_for_each_entry(entity, &xdev->entities, list) { in xvip_graph_notify_complete()
300 ret = xvip_graph_build_one(xdev, entity); in xvip_graph_notify_complete()
306 ret = xvip_graph_build_dma(xdev); in xvip_graph_notify_complete()
310 ret = v4l2_device_register_subdev_nodes(&xdev->v4l2_dev); in xvip_graph_notify_complete()
312 dev_err(xdev->dev, "failed to register subdev nodes\n"); in xvip_graph_notify_complete()
321 struct xvip_composite_device *xdev = in xvip_graph_notify_bound() local
328 list_for_each_entry(entity, &xdev->entities, list) { in xvip_graph_notify_bound()
333 dev_err(xdev->dev, "duplicate subdev for node %s\n", in xvip_graph_notify_bound()
338 dev_dbg(xdev->dev, "subdev %s bound\n", subdev->name); in xvip_graph_notify_bound()
344 dev_err(xdev->dev, "no entity for subdev %s\n", subdev->name); in xvip_graph_notify_bound()
348 static int xvip_graph_parse_one(struct xvip_composite_device *xdev, in xvip_graph_parse_one() argument
357 dev_dbg(xdev->dev, "parsing node %s\n", node->full_name); in xvip_graph_parse_one()
367 dev_dbg(xdev->dev, "handling endpoint %s\n", ep->full_name); in xvip_graph_parse_one()
376 if (remote == xdev->dev->of_node || in xvip_graph_parse_one()
377 xvip_graph_find_entity(xdev, remote)) { in xvip_graph_parse_one()
382 entity = devm_kzalloc(xdev->dev, sizeof(*entity), GFP_KERNEL); in xvip_graph_parse_one()
392 list_add_tail(&entity->list, &xdev->entities); in xvip_graph_parse_one()
393 xdev->num_subdevs++; in xvip_graph_parse_one()
400 static int xvip_graph_parse(struct xvip_composite_device *xdev) in xvip_graph_parse() argument
411 ret = xvip_graph_parse_one(xdev, xdev->dev->of_node); in xvip_graph_parse()
415 list_for_each_entry(entity, &xdev->entities, list) { in xvip_graph_parse()
416 ret = xvip_graph_parse_one(xdev, entity->node); in xvip_graph_parse()
424 static int xvip_graph_dma_init_one(struct xvip_composite_device *xdev, in xvip_graph_dma_init_one() argument
446 dma = devm_kzalloc(xdev->dev, sizeof(*dma), GFP_KERNEL); in xvip_graph_dma_init_one()
450 ret = xvip_dma_init(xdev, dma, type, index); in xvip_graph_dma_init_one()
452 dev_err(xdev->dev, "%s initialization failed\n", in xvip_graph_dma_init_one()
457 list_add_tail(&dma->list, &xdev->dmas); in xvip_graph_dma_init_one()
459 xdev->v4l2_caps |= type == V4L2_BUF_TYPE_VIDEO_CAPTURE in xvip_graph_dma_init_one()
465 static int xvip_graph_dma_init(struct xvip_composite_device *xdev) in xvip_graph_dma_init() argument
471 ports = of_get_child_by_name(xdev->dev->of_node, "ports"); in xvip_graph_dma_init()
473 dev_err(xdev->dev, "ports node not present\n"); in xvip_graph_dma_init()
478 ret = xvip_graph_dma_init_one(xdev, port); in xvip_graph_dma_init()
486 static void xvip_graph_cleanup(struct xvip_composite_device *xdev) in xvip_graph_cleanup() argument
493 v4l2_async_notifier_unregister(&xdev->notifier); in xvip_graph_cleanup()
495 list_for_each_entry_safe(entity, entityp, &xdev->entities, list) { in xvip_graph_cleanup()
500 list_for_each_entry_safe(dma, dmap, &xdev->dmas, list) { in xvip_graph_cleanup()
506 static int xvip_graph_init(struct xvip_composite_device *xdev) in xvip_graph_init() argument
515 ret = xvip_graph_dma_init(xdev); in xvip_graph_init()
517 dev_err(xdev->dev, "DMA initialization failed\n"); in xvip_graph_init()
522 ret = xvip_graph_parse(xdev); in xvip_graph_init()
524 dev_err(xdev->dev, "graph parsing failed\n"); in xvip_graph_init()
528 if (!xdev->num_subdevs) { in xvip_graph_init()
529 dev_err(xdev->dev, "no subdev found in graph\n"); in xvip_graph_init()
534 num_subdevs = xdev->num_subdevs; in xvip_graph_init()
535 subdevs = devm_kzalloc(xdev->dev, sizeof(*subdevs) * num_subdevs, in xvip_graph_init()
543 list_for_each_entry(entity, &xdev->entities, list) in xvip_graph_init()
546 xdev->notifier.subdevs = subdevs; in xvip_graph_init()
547 xdev->notifier.num_subdevs = num_subdevs; in xvip_graph_init()
548 xdev->notifier.bound = xvip_graph_notify_bound; in xvip_graph_init()
549 xdev->notifier.complete = xvip_graph_notify_complete; in xvip_graph_init()
551 ret = v4l2_async_notifier_register(&xdev->v4l2_dev, &xdev->notifier); in xvip_graph_init()
553 dev_err(xdev->dev, "notifier registration failed\n"); in xvip_graph_init()
561 xvip_graph_cleanup(xdev); in xvip_graph_init()
570 static void xvip_composite_v4l2_cleanup(struct xvip_composite_device *xdev) in xvip_composite_v4l2_cleanup() argument
572 v4l2_device_unregister(&xdev->v4l2_dev); in xvip_composite_v4l2_cleanup()
573 media_device_unregister(&xdev->media_dev); in xvip_composite_v4l2_cleanup()
576 static int xvip_composite_v4l2_init(struct xvip_composite_device *xdev) in xvip_composite_v4l2_init() argument
580 xdev->media_dev.dev = xdev->dev; in xvip_composite_v4l2_init()
581 strlcpy(xdev->media_dev.model, "Xilinx Video Composite Device", in xvip_composite_v4l2_init()
582 sizeof(xdev->media_dev.model)); in xvip_composite_v4l2_init()
583 xdev->media_dev.hw_revision = 0; in xvip_composite_v4l2_init()
585 ret = media_device_register(&xdev->media_dev); in xvip_composite_v4l2_init()
587 dev_err(xdev->dev, "media device registration failed (%d)\n", in xvip_composite_v4l2_init()
592 xdev->v4l2_dev.mdev = &xdev->media_dev; in xvip_composite_v4l2_init()
593 ret = v4l2_device_register(xdev->dev, &xdev->v4l2_dev); in xvip_composite_v4l2_init()
595 dev_err(xdev->dev, "V4L2 device registration failed (%d)\n", in xvip_composite_v4l2_init()
597 media_device_unregister(&xdev->media_dev); in xvip_composite_v4l2_init()
610 struct xvip_composite_device *xdev; in xvip_composite_probe() local
613 xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); in xvip_composite_probe()
614 if (!xdev) in xvip_composite_probe()
617 xdev->dev = &pdev->dev; in xvip_composite_probe()
618 INIT_LIST_HEAD(&xdev->entities); in xvip_composite_probe()
619 INIT_LIST_HEAD(&xdev->dmas); in xvip_composite_probe()
621 ret = xvip_composite_v4l2_init(xdev); in xvip_composite_probe()
625 ret = xvip_graph_init(xdev); in xvip_composite_probe()
629 platform_set_drvdata(pdev, xdev); in xvip_composite_probe()
631 dev_info(xdev->dev, "device registered\n"); in xvip_composite_probe()
636 xvip_composite_v4l2_cleanup(xdev); in xvip_composite_probe()
642 struct xvip_composite_device *xdev = platform_get_drvdata(pdev); in xvip_composite_remove() local
644 xvip_graph_cleanup(xdev); in xvip_composite_remove()
645 xvip_composite_v4l2_cleanup(xdev); in xvip_composite_remove()