Lines Matching full:link
25 return "link"; in gobj_type()
106 struct media_link *link = gobj_to_link(gobj); in dev_dbg_obj() local
109 "%s id %u: %s link id %u ==> id %u\n", in dev_dbg_obj()
111 media_type(link->gobj0) == MEDIA_GRAPH_PAD ? in dev_dbg_obj()
113 media_id(link->gobj0), in dev_dbg_obj()
114 media_id(link->gobj1)); in dev_dbg_obj()
232 media_entity_other(struct media_entity *entity, struct media_link *link) in media_entity_other() argument
234 if (link->source->entity == entity) in media_entity_other()
235 return link->sink->entity; in media_entity_other()
237 return link->source->entity; in media_entity_other()
249 graph->stack[graph->top].link = entity->links.next; in stack_push()
263 #define link_top(en) ((en)->stack[(en)->top].link)
311 struct media_link *link; in media_graph_walk_iter() local
314 link = list_entry(link_top(graph), typeof(*link), list); in media_graph_walk_iter()
316 /* The link is not enabled so we do not follow. */ in media_graph_walk_iter()
317 if (!(link->flags & MEDIA_LNK_FL_ENABLED)) { in media_graph_walk_iter()
320 "walk: skipping disabled link '%s':%u -> '%s':%u\n", in media_graph_walk_iter()
321 link->source->entity->name, link->source->index, in media_graph_walk_iter()
322 link->sink->entity->name, link->sink->index); in media_graph_walk_iter()
326 /* Get the entity in the other end of the link . */ in media_graph_walk_iter()
327 next = media_entity_other(entity, link); in media_graph_walk_iter()
413 struct media_link *link; in __media_pipeline_start() local
450 list_for_each_entry(link, &entity->links, list) { in __media_pipeline_start()
451 struct media_pad *pad = link->sink->entity == entity in __media_pipeline_start()
452 ? link->sink : link->source; in __media_pipeline_start()
454 /* Mark that a pad is connected by a link. */ in __media_pipeline_start()
459 * are connected through an enabled link are in __media_pipeline_start()
463 link->flags & MEDIA_LNK_FL_ENABLED) in __media_pipeline_start()
467 * Link validation will only take place for in __media_pipeline_start()
468 * sink ends of the link that are enabled. in __media_pipeline_start()
470 if (link->sink != pad || in __media_pipeline_start()
471 !(link->flags & MEDIA_LNK_FL_ENABLED)) in __media_pipeline_start()
474 ret = entity->ops->link_validate(link); in __media_pipeline_start()
477 "link validation failed for '%s':%u -> '%s':%u, error %d\n", in __media_pipeline_start()
478 link->source->entity->name, in __media_pipeline_start()
479 link->source->index, in __media_pipeline_start()
480 entity->name, link->sink->index, ret); in __media_pipeline_start()
491 "'%s':%u must be connected by an enabled link\n", in __media_pipeline_start()
503 * Link validation on graph failed. We revert what we did and in __media_pipeline_start()
590 struct media_link *link; in media_add_link() local
592 link = kzalloc(sizeof(*link), GFP_KERNEL); in media_add_link()
593 if (link == NULL) in media_add_link()
596 list_add_tail(&link->list, head); in media_add_link()
598 return link; in media_add_link()
602 struct media_link *link) in __media_entity_remove_link() argument
607 if (link->source->entity == entity) in __media_entity_remove_link()
608 remote = link->sink->entity; in __media_entity_remove_link()
610 remote = link->source->entity; in __media_entity_remove_link()
613 if (rlink != link->reverse) in __media_entity_remove_link()
616 if (link->source->entity == entity) in __media_entity_remove_link()
619 /* Remove the remote link */ in __media_entity_remove_link()
627 list_del(&link->list); in __media_entity_remove_link()
628 media_gobj_destroy(&link->graph_obj); in __media_entity_remove_link()
629 kfree(link); in __media_entity_remove_link()
662 struct media_link *link; in media_create_pad_link() local
674 link = media_add_link(&source->links); in media_create_pad_link()
675 if (link == NULL) in media_create_pad_link()
678 link->source = &source->pads[source_pad]; in media_create_pad_link()
679 link->sink = &sink->pads[sink_pad]; in media_create_pad_link()
680 link->flags = flags & ~MEDIA_LNK_FL_INTERFACE_LINK; in media_create_pad_link()
682 /* Initialize graph object embedded at the new link */ in media_create_pad_link()
684 &link->graph_obj); in media_create_pad_link()
691 __media_entity_remove_link(source, link); in media_create_pad_link()
700 /* Initialize graph object embedded at the new link */ in media_create_pad_link()
704 link->reverse = backlink; in media_create_pad_link()
705 backlink->reverse = link; in media_create_pad_link()
782 struct media_link *link, *tmp; in __media_entity_remove_links() local
784 list_for_each_entry_safe(link, tmp, &entity->links, list) in __media_entity_remove_links()
785 __media_entity_remove_link(entity, link); in __media_entity_remove_links()
806 static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) in __media_entity_setup_link_notify() argument
811 ret = media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
812 link->source, link->sink, flags); in __media_entity_setup_link_notify()
816 ret = media_entity_call(link->sink->entity, link_setup, in __media_entity_setup_link_notify()
817 link->sink, link->source, flags); in __media_entity_setup_link_notify()
819 media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
820 link->source, link->sink, link->flags); in __media_entity_setup_link_notify()
824 link->flags = flags; in __media_entity_setup_link_notify()
825 link->reverse->flags = link->flags; in __media_entity_setup_link_notify()
830 int __media_entity_setup_link(struct media_link *link, u32 flags) in __media_entity_setup_link() argument
837 if (link == NULL) in __media_entity_setup_link()
840 /* The non-modifiable link flags must not be modified. */ in __media_entity_setup_link()
841 if ((link->flags & ~mask) != (flags & ~mask)) in __media_entity_setup_link()
844 if (link->flags & MEDIA_LNK_FL_IMMUTABLE) in __media_entity_setup_link()
845 return link->flags == flags ? 0 : -EINVAL; in __media_entity_setup_link()
847 if (link->flags == flags) in __media_entity_setup_link()
850 source = link->source->entity; in __media_entity_setup_link()
851 sink = link->sink->entity; in __media_entity_setup_link()
853 if (!(link->flags & MEDIA_LNK_FL_DYNAMIC) && in __media_entity_setup_link()
860 ret = mdev->ops->link_notify(link, flags, in __media_entity_setup_link()
866 ret = __media_entity_setup_link_notify(link, flags); in __media_entity_setup_link()
869 mdev->ops->link_notify(link, flags, in __media_entity_setup_link()
876 int media_entity_setup_link(struct media_link *link, u32 flags) in media_entity_setup_link() argument
880 mutex_lock(&link->graph_obj.mdev->graph_mutex); in media_entity_setup_link()
881 ret = __media_entity_setup_link(link, flags); in media_entity_setup_link()
882 mutex_unlock(&link->graph_obj.mdev->graph_mutex); in media_entity_setup_link()
891 struct media_link *link; in media_entity_find_link() local
893 list_for_each_entry(link, &source->entity->links, list) { in media_entity_find_link()
894 if (link->source->entity == source->entity && in media_entity_find_link()
895 link->source->index == source->index && in media_entity_find_link()
896 link->sink->entity == sink->entity && in media_entity_find_link()
897 link->sink->index == sink->index) in media_entity_find_link()
898 return link; in media_entity_find_link()
907 struct media_link *link; in media_entity_remote_pad() local
909 list_for_each_entry(link, &pad->entity->links, list) { in media_entity_remote_pad()
910 if (!(link->flags & MEDIA_LNK_FL_ENABLED)) in media_entity_remote_pad()
913 if (link->source == pad) in media_entity_remote_pad()
914 return link->sink; in media_entity_remote_pad()
916 if (link->sink == pad) in media_entity_remote_pad()
917 return link->source; in media_entity_remote_pad()
971 struct media_link *link; in media_create_intf_link() local
973 link = media_add_link(&intf->links); in media_create_intf_link()
974 if (link == NULL) in media_create_intf_link()
977 link->intf = intf; in media_create_intf_link()
978 link->entity = entity; in media_create_intf_link()
979 link->flags = flags | MEDIA_LNK_FL_INTERFACE_LINK; in media_create_intf_link()
981 /* Initialize graph object embedded at the new link */ in media_create_intf_link()
983 &link->graph_obj); in media_create_intf_link()
985 return link; in media_create_intf_link()
989 void __media_remove_intf_link(struct media_link *link) in __media_remove_intf_link() argument
991 list_del(&link->list); in __media_remove_intf_link()
992 media_gobj_destroy(&link->graph_obj); in __media_remove_intf_link()
993 kfree(link); in __media_remove_intf_link()
997 void media_remove_intf_link(struct media_link *link) in media_remove_intf_link() argument
999 struct media_device *mdev = link->graph_obj.mdev; in media_remove_intf_link()
1006 __media_remove_intf_link(link); in media_remove_intf_link()
1013 struct media_link *link, *tmp; in __media_remove_intf_links() local
1015 list_for_each_entry_safe(link, tmp, &intf->links, list) in __media_remove_intf_links()
1016 __media_remove_intf_link(link); in __media_remove_intf_links()