Lines Matching full:entity

3  * Media entity
15 #include <media/media-entity.h>
99 "%s id %u: entity '%s'\n", in dev_dbg_obj()
123 pad->entity->name, pad->index); in dev_dbg_obj()
194 int media_entity_pads_init(struct media_entity *entity, u16 num_pads, in media_entity_pads_init() argument
197 struct media_device *mdev = entity->graph_obj.mdev; in media_entity_pads_init()
204 entity->num_pads = num_pads; in media_entity_pads_init()
205 entity->pads = pads; in media_entity_pads_init()
210 media_entity_for_each_pad(entity, iter) { in media_entity_pads_init()
211 iter->entity = entity; in media_entity_pads_init()
232 * @entity: The entity
236 * This function checks the interdependency inside the entity between @pad0
242 * to check the dependency inside the entity between @pad0 and @pad1. If the
243 * has_pad_interdep operation is not implemented, all pads of the entity are
249 * The caller must hold entity->graph_obj.mdev->mutex.
253 static bool media_entity_has_pad_interdep(struct media_entity *entity, in media_entity_has_pad_interdep() argument
256 if (pad0 >= entity->num_pads || pad1 >= entity->num_pads) in media_entity_has_pad_interdep()
259 if (entity->pads[pad0].flags & entity->pads[pad1].flags & in media_entity_has_pad_interdep()
263 if (!entity->ops || !entity->ops->has_pad_interdep) in media_entity_has_pad_interdep()
266 return entity->ops->has_pad_interdep(entity, pad0, pad1); in media_entity_has_pad_interdep()
270 media_entity_other(struct media_entity *entity, struct media_link *link) in media_entity_other() argument
272 if (link->source->entity == entity) in media_entity_other()
273 return link->sink->entity; in media_entity_other()
275 return link->source->entity; in media_entity_other()
278 /* push an entity to traversal stack */
280 struct media_entity *entity) in stack_push() argument
287 graph->stack[graph->top].link = entity->links.next; in stack_push()
288 graph->stack[graph->top].entity = entity; in stack_push()
293 struct media_entity *entity; in stack_pop() local
295 entity = graph->stack[graph->top].entity; in stack_pop()
298 return entity; in stack_pop()
302 #define stack_top(en) ((en)->stack[(en)->top].entity)
333 struct media_entity *entity) in media_graph_walk_start() argument
336 media_entity_enum_set(&graph->ent_enum, entity); in media_graph_walk_start()
339 graph->stack[graph->top].entity = NULL; in media_graph_walk_start()
340 stack_push(graph, entity); in media_graph_walk_start()
341 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_start()
342 "begin graph walk at '%s'\n", entity->name); in media_graph_walk_start()
348 struct media_entity *entity = stack_top(graph); in media_graph_walk_iter() local
363 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_iter()
365 link->source->entity->name, link->source->index, in media_graph_walk_iter()
366 link->sink->entity->name, link->sink->index); in media_graph_walk_iter()
370 /* Get the entity at the other end of the link. */ in media_graph_walk_iter()
371 next = media_entity_other(entity, link); in media_graph_walk_iter()
373 /* Has the entity already been visited? */ in media_graph_walk_iter()
376 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_iter()
377 "walk: skipping entity '%s' (already seen)\n", in media_graph_walk_iter()
382 /* Push the new entity to stack and start over. */ in media_graph_walk_iter()
385 dev_dbg(entity->graph_obj.mdev->dev, "walk: pushing '%s' on stack\n", in media_graph_walk_iter()
387 lockdep_assert_held(&entity->graph_obj.mdev->graph_mutex); in media_graph_walk_iter()
392 struct media_entity *entity; in media_graph_walk_next() local
398 * Depth first search. Push entity to stack and continue from in media_graph_walk_next()
405 entity = stack_pop(graph); in media_graph_walk_next()
406 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_next()
407 "walk: returning entity '%s'\n", entity->name); in media_graph_walk_next()
409 return entity; in media_graph_walk_next()
421 * points to the incoming pad and the first link of the entity.
424 * internal pad dependencies in the entity, and then links in the graph. It
425 * does so by iterating over all links of the entity, and following enabled
514 entry->links = pad->entity->links.next; in media_pipeline_walk_push()
518 walk->stack.top, pad->entity->name, pad->index); in media_pipeline_walk_push()
536 if (entry->links->next == &entry->pad->entity->links) { in media_pipeline_walk_pop()
569 pad->entity->name, pad->index); in media_pipeline_add_pad()
585 pad->entity->name, pad->index); in media_pipeline_add_pad()
590 /* Explore the next link of the entity at the top of the stack. */
607 link->source->entity->name, link->source->index, in media_pipeline_explore_next_link()
608 link->sink->entity->name, link->sink->index); in media_pipeline_explore_next_link()
618 if (link->source->entity == pad->entity) { in media_pipeline_explore_next_link()
628 * that is not connected internally in the entity to the incoming pad. in media_pipeline_explore_next_link()
631 !media_entity_has_pad_interdep(pad->entity, pad->index, local->index)) { in media_pipeline_explore_next_link()
701 ppad->pad->entity->name, ppad->pad->index); in media_pipeline_populate()
758 struct media_entity *entity = pad->entity; in __media_pipeline_start() local
763 dev_dbg(mdev->dev, "Validating pad '%s':%u\n", pad->entity->name, in __media_pipeline_start()
772 pad->entity->name, pad->index); in __media_pipeline_start()
782 for_each_media_entity_data_link(entity, link) { in __media_pipeline_start()
802 if (!entity->ops || !entity->ops->link_validate) in __media_pipeline_start()
805 ret = entity->ops->link_validate(link); in __media_pipeline_start()
809 link->source->entity->name, in __media_pipeline_start()
811 link->sink->entity->name, in __media_pipeline_start()
818 link->source->entity->name, in __media_pipeline_start()
820 link->sink->entity->name, in __media_pipeline_start()
832 pad->entity->name, pad->index); in __media_pipeline_start()
982 struct media_entity *entity) in __media_pipeline_entity_iter_next() argument
984 if (!entity) in __media_pipeline_entity_iter_next()
989 struct media_entity *entity; in __media_pipeline_entity_iter_next() local
992 entity = ppad->pad->entity; in __media_pipeline_entity_iter_next()
995 if (!media_entity_enum_test_and_set(&iter->ent_enum, entity)) in __media_pipeline_entity_iter_next()
996 return entity; in __media_pipeline_entity_iter_next()
1020 static void __media_entity_remove_link(struct media_entity *entity, in __media_entity_remove_link() argument
1028 if (link->source->entity == entity) in __media_entity_remove_link()
1029 remote = link->sink->entity; in __media_entity_remove_link()
1031 remote = link->source->entity; in __media_entity_remove_link()
1037 if (link->source->entity == entity) in __media_entity_remove_link()
1055 int media_get_pad_index(struct media_entity *entity, u32 pad_type, in media_get_pad_index() argument
1060 if (!entity) in media_get_pad_index()
1063 for (i = 0; i < entity->num_pads; i++) { in media_get_pad_index()
1064 if ((entity->pads[i].flags & in media_get_pad_index()
1068 if (entity->pads[i].sig_type == sig_type) in media_get_pad_index()
1142 struct media_entity *entity; in media_create_pad_links() local
1179 media_device_for_each_entity(entity, mdev) { in media_create_pad_links()
1180 if (entity->function != function) in media_create_pad_links()
1185 entity, sink_pad, flags); in media_create_pad_links()
1187 ret = media_create_pad_link(entity, source_pad, in media_create_pad_links()
1197 void __media_entity_remove_links(struct media_entity *entity) in __media_entity_remove_links() argument
1201 list_for_each_entry_safe(link, tmp, &entity->links, list) in __media_entity_remove_links()
1202 __media_entity_remove_link(entity, link); in __media_entity_remove_links()
1204 entity->num_links = 0; in __media_entity_remove_links()
1205 entity->num_backlinks = 0; in __media_entity_remove_links()
1209 void media_entity_remove_links(struct media_entity *entity) in media_entity_remove_links() argument
1211 struct media_device *mdev = entity->graph_obj.mdev; in media_entity_remove_links()
1213 /* Do nothing if the entity is not registered. */ in media_entity_remove_links()
1218 __media_entity_remove_links(entity); in media_entity_remove_links()
1228 ret = media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
1233 ret = media_entity_call(link->sink->entity, link_setup, in __media_entity_setup_link_notify()
1236 media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
1310 for_each_media_entity_data_link(source->entity, link) { in media_entity_find_link()
1311 if (link->source->entity == source->entity && in media_entity_find_link()
1313 link->sink->entity == sink->entity && in media_entity_find_link()
1326 for_each_media_entity_data_link(pad->entity, link) { in media_pad_remote_pad_first()
1343 media_entity_remote_pad_unique(const struct media_entity *entity, in media_entity_remote_pad_unique() argument
1349 list_for_each_entry(link, &entity->links, list) { in media_entity_remote_pad_unique()
1366 if (local_pad->entity == entity) { in media_entity_remote_pad_unique()
1386 list_for_each_entry(link, &pad->entity->links, list) { in media_pad_remote_pad_unique()
1412 int media_entity_get_fwnode_pad(struct media_entity *entity, in media_entity_get_fwnode_pad() argument
1420 if (!entity->ops || !entity->ops->get_fwnode_pad) { in media_entity_get_fwnode_pad()
1421 for (i = 0; i < entity->num_pads; i++) { in media_entity_get_fwnode_pad()
1422 if (entity->pads[i].flags & direction_flags) in media_entity_get_fwnode_pad()
1433 ret = entity->ops->get_fwnode_pad(entity, &endpoint); in media_entity_get_fwnode_pad()
1437 if (ret >= entity->num_pads) in media_entity_get_fwnode_pad()
1440 if (!(entity->pads[ret].flags & direction_flags)) in media_entity_get_fwnode_pad()
1447 struct media_pipeline *media_entity_pipeline(struct media_entity *entity) in media_entity_pipeline() argument
1451 media_entity_for_each_pad(entity, pad) { in media_entity_pipeline()
1508 struct media_link *media_create_intf_link(struct media_entity *entity, in media_create_intf_link() argument
1519 link->entity = entity; in media_create_intf_link()
1598 struct media_link *__media_entity_next_link(struct media_entity *entity, in __media_entity_next_link() argument
1603 : list_first_entry(&entity->links, typeof(*link), list); in __media_entity_next_link()
1605 list_for_each_entry_from(link, &entity->links, list) in __media_entity_next_link()