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()
230 * This function checks the interdependency inside the entity between @pad0
236 * to check the dependency inside the entity between @pad0 and @pad1. If the
237 * has_pad_interdep operation is not implemented, all pads of the entity are
240 static bool media_entity_has_pad_interdep(struct media_entity *entity, in media_entity_has_pad_interdep() argument
243 if (pad0 >= entity->num_pads || pad1 >= entity->num_pads) in media_entity_has_pad_interdep()
246 if (entity->pads[pad0].flags & entity->pads[pad1].flags & in media_entity_has_pad_interdep()
250 if (!entity->ops || !entity->ops->has_pad_interdep) in media_entity_has_pad_interdep()
253 return entity->ops->has_pad_interdep(entity, pad0, pad1); in media_entity_has_pad_interdep()
257 media_entity_other(struct media_entity *entity, struct media_link *link) in media_entity_other() argument
259 if (link->source->entity == entity) in media_entity_other()
260 return link->sink->entity; in media_entity_other()
262 return link->source->entity; in media_entity_other()
265 /* push an entity to traversal stack */
267 struct media_entity *entity) in stack_push() argument
274 graph->stack[graph->top].link = entity->links.next; in stack_push()
275 graph->stack[graph->top].entity = entity; in stack_push()
280 struct media_entity *entity; in stack_pop() local
282 entity = graph->stack[graph->top].entity; in stack_pop()
285 return entity; in stack_pop()
289 #define stack_top(en) ((en)->stack[(en)->top].entity)
320 struct media_entity *entity) in media_graph_walk_start() argument
323 media_entity_enum_set(&graph->ent_enum, entity); in media_graph_walk_start()
326 graph->stack[graph->top].entity = NULL; in media_graph_walk_start()
327 stack_push(graph, entity); in media_graph_walk_start()
328 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_start()
329 "begin graph walk at '%s'\n", entity->name); in media_graph_walk_start()
335 struct media_entity *entity = stack_top(graph); in media_graph_walk_iter() local
350 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_iter()
352 link->source->entity->name, link->source->index, in media_graph_walk_iter()
353 link->sink->entity->name, link->sink->index); in media_graph_walk_iter()
357 /* Get the entity at the other end of the link. */ in media_graph_walk_iter()
358 next = media_entity_other(entity, link); in media_graph_walk_iter()
360 /* Has the entity already been visited? */ in media_graph_walk_iter()
363 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_iter()
364 "walk: skipping entity '%s' (already seen)\n", in media_graph_walk_iter()
369 /* Push the new entity to stack and start over. */ in media_graph_walk_iter()
372 dev_dbg(entity->graph_obj.mdev->dev, "walk: pushing '%s' on stack\n", in media_graph_walk_iter()
374 lockdep_assert_held(&entity->graph_obj.mdev->graph_mutex); in media_graph_walk_iter()
379 struct media_entity *entity; in media_graph_walk_next() local
385 * Depth first search. Push entity to stack and continue from in media_graph_walk_next()
392 entity = stack_pop(graph); in media_graph_walk_next()
393 dev_dbg(entity->graph_obj.mdev->dev, in media_graph_walk_next()
394 "walk: returning entity '%s'\n", entity->name); in media_graph_walk_next()
396 return entity; in media_graph_walk_next()
408 * points to the incoming pad and the first link of the entity.
411 * internal pad dependencies in the entity, and then links in the graph. It
412 * does so by iterating over all links of the entity, and following enabled
501 entry->links = pad->entity->links.next; in media_pipeline_walk_push()
505 walk->stack.top, pad->entity->name, pad->index); in media_pipeline_walk_push()
523 if (entry->links->next == &entry->pad->entity->links) { in media_pipeline_walk_pop()
556 pad->entity->name, pad->index); in media_pipeline_add_pad()
572 pad->entity->name, pad->index); in media_pipeline_add_pad()
577 /* Explore the next link of the entity at the top of the stack. */
594 link->source->entity->name, link->source->index, in media_pipeline_explore_next_link()
595 link->sink->entity->name, link->sink->index); in media_pipeline_explore_next_link()
605 if (link->source->entity == pad->entity) { in media_pipeline_explore_next_link()
615 * that is not connected internally in the entity to the incoming pad. in media_pipeline_explore_next_link()
618 !media_entity_has_pad_interdep(pad->entity, pad->index, local->index)) { in media_pipeline_explore_next_link()
688 ppad->pad->entity->name, ppad->pad->index); in media_pipeline_populate()
706 struct media_device *mdev = pad->entity->graph_obj.mdev; in __media_pipeline_start()
714 * If the entity is already part of a pipeline, that pipeline must in __media_pipeline_start()
745 struct media_entity *entity = pad->entity; in __media_pipeline_start() local
750 dev_dbg(mdev->dev, "Validating pad '%s':%u\n", pad->entity->name, in __media_pipeline_start()
759 pad->entity->name, pad->index); in __media_pipeline_start()
769 for_each_media_entity_data_link(entity, link) { in __media_pipeline_start()
789 if (!entity->ops || !entity->ops->link_validate) in __media_pipeline_start()
792 ret = entity->ops->link_validate(link); in __media_pipeline_start()
796 link->source->entity->name, in __media_pipeline_start()
798 link->sink->entity->name, in __media_pipeline_start()
805 link->source->entity->name, in __media_pipeline_start()
807 link->sink->entity->name, in __media_pipeline_start()
819 pad->entity->name, pad->index); in __media_pipeline_start()
854 struct media_device *mdev = pad->entity->graph_obj.mdev; in media_pipeline_start()
891 struct media_device *mdev = pad->entity->graph_obj.mdev; in media_pipeline_stop()
901 struct media_device *mdev = pad->entity->graph_obj.mdev; in media_pipeline_alloc_start()
909 * Is the entity already part of a pipeline? If not, we need to allocate in media_pipeline_alloc_start()
952 static void __media_entity_remove_link(struct media_entity *entity, in __media_entity_remove_link() argument
960 if (link->source->entity == entity) in __media_entity_remove_link()
961 remote = link->sink->entity; in __media_entity_remove_link()
963 remote = link->source->entity; in __media_entity_remove_link()
969 if (link->source->entity == entity) in __media_entity_remove_link()
987 int media_get_pad_index(struct media_entity *entity, bool is_sink, in media_get_pad_index() argument
993 if (!entity) in media_get_pad_index()
996 for (i = 0; i < entity->num_pads; i++) { in media_get_pad_index()
997 if (entity->pads[i].flags & MEDIA_PAD_FL_SINK) in media_get_pad_index()
999 else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE) in media_get_pad_index()
1006 if (entity->pads[i].sig_type == sig_type) in media_get_pad_index()
1080 struct media_entity *entity; in media_create_pad_links() local
1117 media_device_for_each_entity(entity, mdev) { in media_create_pad_links()
1118 if (entity->function != function) in media_create_pad_links()
1123 entity, sink_pad, flags); in media_create_pad_links()
1125 ret = media_create_pad_link(entity, source_pad, in media_create_pad_links()
1135 void __media_entity_remove_links(struct media_entity *entity) in __media_entity_remove_links() argument
1139 list_for_each_entry_safe(link, tmp, &entity->links, list) in __media_entity_remove_links()
1140 __media_entity_remove_link(entity, link); in __media_entity_remove_links()
1142 entity->num_links = 0; in __media_entity_remove_links()
1143 entity->num_backlinks = 0; in __media_entity_remove_links()
1147 void media_entity_remove_links(struct media_entity *entity) in media_entity_remove_links() argument
1149 struct media_device *mdev = entity->graph_obj.mdev; in media_entity_remove_links()
1151 /* Do nothing if the entity is not registered. */ in media_entity_remove_links()
1156 __media_entity_remove_links(entity); in media_entity_remove_links()
1166 ret = media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
1171 ret = media_entity_call(link->sink->entity, link_setup, in __media_entity_setup_link_notify()
1174 media_entity_call(link->source->entity, link_setup, in __media_entity_setup_link_notify()
1248 for_each_media_entity_data_link(source->entity, link) { in media_entity_find_link()
1249 if (link->source->entity == source->entity && in media_entity_find_link()
1251 link->sink->entity == sink->entity && in media_entity_find_link()
1264 for_each_media_entity_data_link(pad->entity, link) { in media_pad_remote_pad_first()
1281 media_entity_remote_pad_unique(const struct media_entity *entity, in media_entity_remote_pad_unique() argument
1287 list_for_each_entry(link, &entity->links, list) { in media_entity_remote_pad_unique()
1304 if (local_pad->entity == entity) { in media_entity_remote_pad_unique()
1324 list_for_each_entry(link, &pad->entity->links, list) { in media_pad_remote_pad_unique()
1350 int media_entity_get_fwnode_pad(struct media_entity *entity, in media_entity_get_fwnode_pad() argument
1358 if (!entity->ops || !entity->ops->get_fwnode_pad) { in media_entity_get_fwnode_pad()
1359 for (i = 0; i < entity->num_pads; i++) { in media_entity_get_fwnode_pad()
1360 if (entity->pads[i].flags & direction_flags) in media_entity_get_fwnode_pad()
1371 ret = entity->ops->get_fwnode_pad(entity, &endpoint); in media_entity_get_fwnode_pad()
1375 if (ret >= entity->num_pads) in media_entity_get_fwnode_pad()
1378 if (!(entity->pads[ret].flags & direction_flags)) in media_entity_get_fwnode_pad()
1385 struct media_pipeline *media_entity_pipeline(struct media_entity *entity) in media_entity_pipeline() argument
1389 media_entity_for_each_pad(entity, pad) { in media_entity_pipeline()
1446 struct media_link *media_create_intf_link(struct media_entity *entity, in media_create_intf_link() argument
1457 link->entity = entity; in media_create_intf_link()
1536 struct media_link *__media_entity_next_link(struct media_entity *entity, in __media_entity_next_link() argument
1541 : list_first_entry(&entity->links, typeof(*link), list); in __media_entity_next_link()
1543 list_for_each_entry_from(link, &entity->links, list) in __media_entity_next_link()