Lines Matching full:entity
3 * vsp1_entity.c -- R-Car VSP1 Base Entity
13 #include <media/media-entity.h>
23 void vsp1_entity_route_setup(struct vsp1_entity *entity, in vsp1_entity_route_setup() argument
30 if (entity->type == VSP1_ENTITY_HGO) { in vsp1_entity_route_setup()
37 source = entity->sources[0]; in vsp1_entity_route_setup()
38 smppt = (pipe->output->entity.index << VI6_DPR_SMPPT_TGW_SHIFT) in vsp1_entity_route_setup()
43 } else if (entity->type == VSP1_ENTITY_HGT) { in vsp1_entity_route_setup()
50 source = entity->sources[0]; in vsp1_entity_route_setup()
51 smppt = (pipe->output->entity.index << VI6_DPR_SMPPT_TGW_SHIFT) in vsp1_entity_route_setup()
58 source = entity; in vsp1_entity_route_setup()
72 void vsp1_entity_configure_stream(struct vsp1_entity *entity, in vsp1_entity_configure_stream() argument
78 if (entity->ops->configure_stream) in vsp1_entity_configure_stream()
79 entity->ops->configure_stream(entity, state, pipe, dl, dlb); in vsp1_entity_configure_stream()
82 void vsp1_entity_configure_frame(struct vsp1_entity *entity, in vsp1_entity_configure_frame() argument
87 if (entity->ops->configure_frame) in vsp1_entity_configure_frame()
88 entity->ops->configure_frame(entity, pipe, dl, dlb); in vsp1_entity_configure_frame()
91 void vsp1_entity_configure_partition(struct vsp1_entity *entity, in vsp1_entity_configure_partition() argument
97 if (entity->ops->configure_partition) in vsp1_entity_configure_partition()
98 entity->ops->configure_partition(entity, pipe, partition, in vsp1_entity_configure_partition()
107 * vsp1_entity_get_state - Get the subdev state for an entity
108 * @entity: the entity
113 * the entity lock to access the returned configuration.
117 * returned when requested. The ACTIVE state comes from the entity structure.
120 vsp1_entity_get_state(struct vsp1_entity *entity, in vsp1_entity_get_state() argument
126 return entity->state; in vsp1_entity_get_state()
146 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_get_pad_format() local
149 state = vsp1_entity_get_state(entity, sd_state, fmt->which); in vsp1_subdev_get_pad_format()
153 mutex_lock(&entity->lock); in vsp1_subdev_get_pad_format()
155 mutex_unlock(&entity->lock); in vsp1_subdev_get_pad_format()
178 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_enum_mbus_code() local
190 * The entity can't perform format conversion, the sink format in vsp1_subdev_enum_mbus_code()
196 state = vsp1_entity_get_state(entity, sd_state, code->which); in vsp1_subdev_enum_mbus_code()
200 mutex_lock(&entity->lock); in vsp1_subdev_enum_mbus_code()
203 mutex_unlock(&entity->lock); in vsp1_subdev_enum_mbus_code()
230 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_enum_frame_size() local
235 state = vsp1_entity_get_state(entity, sd_state, fse->which); in vsp1_subdev_enum_frame_size()
241 mutex_lock(&entity->lock); in vsp1_subdev_enum_frame_size()
265 mutex_unlock(&entity->lock); in vsp1_subdev_enum_frame_size()
294 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_set_pad_format() local
301 mutex_lock(&entity->lock); in vsp1_subdev_set_pad_format()
303 state = vsp1_entity_get_state(entity, sd_state, fmt->which); in vsp1_subdev_set_pad_format()
311 if (fmt->pad == entity->source_pad) { in vsp1_subdev_set_pad_format()
337 format = v4l2_subdev_state_get_format(state, entity->source_pad); in vsp1_subdev_set_pad_format()
354 mutex_unlock(&entity->lock); in vsp1_subdev_set_pad_format()
364 for (pad = 0; pad < subdev->entity.num_pads - 1; ++pad) { in vsp1_entity_init_state()
386 media_entity_to_vsp1_entity(struct media_entity *entity) in media_entity_to_vsp1_entity() argument
388 return container_of(entity, struct vsp1_entity, subdev.entity); in media_entity_to_vsp1_entity()
397 source = media_entity_to_vsp1_entity(source_pad->entity); in vsp1_entity_link_setup_source()
404 = media_entity_to_vsp1_entity(sink_pad->entity); in vsp1_entity_link_setup_source()
432 sink = media_entity_to_vsp1_entity(sink_pad->entity); in vsp1_entity_link_setup_sink()
433 source = media_entity_to_vsp1_entity(source_pad->entity); in vsp1_entity_link_setup_sink()
448 int vsp1_entity_link_setup(struct media_entity *entity, in vsp1_entity_link_setup() argument
479 list_for_each_entry(link, &pad->entity->links, list) { in vsp1_entity_remote_pad()
480 struct vsp1_entity *entity; in vsp1_entity_remote_pad() local
493 if (!is_media_entity_v4l2_subdev(link->sink->entity)) in vsp1_entity_remote_pad()
496 entity = media_entity_to_vsp1_entity(link->sink->entity); in vsp1_entity_remote_pad()
497 if (entity->type != VSP1_ENTITY_HGO && in vsp1_entity_remote_pad()
498 entity->type != VSP1_ENTITY_HGT) in vsp1_entity_remote_pad()
562 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, in vsp1_entity_init() argument
572 if (vsp1_routes[i].type == entity->type && in vsp1_entity_init()
573 vsp1_routes[i].index == entity->index) { in vsp1_entity_init()
574 entity->route = &vsp1_routes[i]; in vsp1_entity_init()
582 mutex_init(&entity->lock); in vsp1_entity_init()
584 entity->vsp1 = vsp1; in vsp1_entity_init()
585 entity->source_pad = num_pads - 1; in vsp1_entity_init()
588 entity->pads = devm_kcalloc(vsp1->dev, in vsp1_entity_init()
589 num_pads, sizeof(*entity->pads), in vsp1_entity_init()
591 if (entity->pads == NULL) in vsp1_entity_init()
595 entity->pads[i].flags = MEDIA_PAD_FL_SINK; in vsp1_entity_init()
597 entity->sources = devm_kcalloc(vsp1->dev, max(num_pads - 1, 1U), in vsp1_entity_init()
598 sizeof(*entity->sources), GFP_KERNEL); in vsp1_entity_init()
599 if (entity->sources == NULL) in vsp1_entity_init()
603 entity->pads[num_pads - 1].flags = num_pads > 1 ? MEDIA_PAD_FL_SOURCE in vsp1_entity_init()
606 /* Initialize the media entity. */ in vsp1_entity_init()
607 ret = media_entity_pads_init(&entity->subdev.entity, num_pads, in vsp1_entity_init()
608 entity->pads); in vsp1_entity_init()
613 subdev = &entity->subdev; in vsp1_entity_init()
617 subdev->entity.function = function; in vsp1_entity_init()
618 subdev->entity.ops = &vsp1->media_ops; in vsp1_entity_init()
634 entity->state = __v4l2_subdev_state_alloc(&entity->subdev, in vsp1_entity_init()
636 if (IS_ERR(entity->state)) { in vsp1_entity_init()
637 media_entity_cleanup(&entity->subdev.entity); in vsp1_entity_init()
638 return PTR_ERR(entity->state); in vsp1_entity_init()
644 void vsp1_entity_destroy(struct vsp1_entity *entity) in vsp1_entity_destroy() argument
646 if (entity->ops && entity->ops->destroy) in vsp1_entity_destroy()
647 entity->ops->destroy(entity); in vsp1_entity_destroy()
648 if (entity->subdev.ctrl_handler) in vsp1_entity_destroy()
649 v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); in vsp1_entity_destroy()
650 __v4l2_subdev_state_free(entity->state); in vsp1_entity_destroy()
651 media_entity_cleanup(&entity->subdev.entity); in vsp1_entity_destroy()