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
77 if (entity->ops->configure_stream) in vsp1_entity_configure_stream()
78 entity->ops->configure_stream(entity, pipe, dl, dlb); in vsp1_entity_configure_stream()
81 void vsp1_entity_configure_frame(struct vsp1_entity *entity, in vsp1_entity_configure_frame() argument
86 if (entity->ops->configure_frame) in vsp1_entity_configure_frame()
87 entity->ops->configure_frame(entity, pipe, dl, dlb); in vsp1_entity_configure_frame()
90 void vsp1_entity_configure_partition(struct vsp1_entity *entity, in vsp1_entity_configure_partition() argument
95 if (entity->ops->configure_partition) in vsp1_entity_configure_partition()
96 entity->ops->configure_partition(entity, pipe, dl, dlb); in vsp1_entity_configure_partition()
104 * vsp1_entity_get_pad_config - Get the pad configuration for an entity
105 * @entity: the entity
110 * the entity lock to access the returned configuration.
115 * entity structure.
118 vsp1_entity_get_pad_config(struct vsp1_entity *entity, in vsp1_entity_get_pad_config() argument
124 return entity->config; in vsp1_entity_get_pad_config()
132 * vsp1_entity_get_pad_format - Get a pad format from storage for an entity
133 * @entity: the entity
137 * Return the format stored in the given configuration for an entity's pad. The
141 vsp1_entity_get_pad_format(struct vsp1_entity *entity, in vsp1_entity_get_pad_format() argument
145 return v4l2_subdev_get_try_format(&entity->subdev, sd_state, pad); in vsp1_entity_get_pad_format()
149 * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity
150 * @entity: the entity
156 * entity's pad. The configuration can be an ACTIVE or TRY configuration. The
160 vsp1_entity_get_pad_selection(struct vsp1_entity *entity, in vsp1_entity_get_pad_selection() argument
166 return v4l2_subdev_get_try_compose(&entity->subdev, sd_state, in vsp1_entity_get_pad_selection()
169 return v4l2_subdev_get_try_crop(&entity->subdev, sd_state, in vsp1_entity_get_pad_selection()
190 for (pad = 0; pad < subdev->entity.num_pads - 1; ++pad) { in vsp1_entity_init_cfg()
216 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_get_pad_format() local
219 config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); in vsp1_subdev_get_pad_format()
223 mutex_lock(&entity->lock); in vsp1_subdev_get_pad_format()
224 fmt->format = *vsp1_entity_get_pad_format(entity, config, fmt->pad); in vsp1_subdev_get_pad_format()
225 mutex_unlock(&entity->lock); in vsp1_subdev_get_pad_format()
248 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_enum_mbus_code() local
260 * The entity can't perform format conversion, the sink format in vsp1_subdev_enum_mbus_code()
266 config = vsp1_entity_get_pad_config(entity, sd_state, in vsp1_subdev_enum_mbus_code()
271 mutex_lock(&entity->lock); in vsp1_subdev_enum_mbus_code()
272 format = vsp1_entity_get_pad_format(entity, config, 0); in vsp1_subdev_enum_mbus_code()
274 mutex_unlock(&entity->lock); in vsp1_subdev_enum_mbus_code()
301 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_enum_frame_size() local
306 config = vsp1_entity_get_pad_config(entity, sd_state, fse->which); in vsp1_subdev_enum_frame_size()
310 format = vsp1_entity_get_pad_format(entity, config, fse->pad); in vsp1_subdev_enum_frame_size()
312 mutex_lock(&entity->lock); in vsp1_subdev_enum_frame_size()
336 mutex_unlock(&entity->lock); in vsp1_subdev_enum_frame_size()
365 struct vsp1_entity *entity = to_vsp1_entity(subdev); in vsp1_subdev_set_pad_format() local
372 mutex_lock(&entity->lock); in vsp1_subdev_set_pad_format()
374 config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); in vsp1_subdev_set_pad_format()
380 format = vsp1_entity_get_pad_format(entity, config, fmt->pad); in vsp1_subdev_set_pad_format()
382 if (fmt->pad == entity->source_pad) { in vsp1_subdev_set_pad_format()
408 format = vsp1_entity_get_pad_format(entity, config, entity->source_pad); in vsp1_subdev_set_pad_format()
412 selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, in vsp1_subdev_set_pad_format()
419 selection = vsp1_entity_get_pad_selection(entity, config, fmt->pad, in vsp1_subdev_set_pad_format()
427 mutex_unlock(&entity->lock); in vsp1_subdev_set_pad_format()
436 media_entity_to_vsp1_entity(struct media_entity *entity) in media_entity_to_vsp1_entity() argument
438 return container_of(entity, struct vsp1_entity, subdev.entity); in media_entity_to_vsp1_entity()
447 source = media_entity_to_vsp1_entity(source_pad->entity); in vsp1_entity_link_setup_source()
454 = media_entity_to_vsp1_entity(sink_pad->entity); in vsp1_entity_link_setup_source()
482 sink = media_entity_to_vsp1_entity(sink_pad->entity); in vsp1_entity_link_setup_sink()
483 source = media_entity_to_vsp1_entity(source_pad->entity); in vsp1_entity_link_setup_sink()
498 int vsp1_entity_link_setup(struct media_entity *entity, in vsp1_entity_link_setup() argument
529 list_for_each_entry(link, &pad->entity->links, list) { in vsp1_entity_remote_pad()
530 struct vsp1_entity *entity; in vsp1_entity_remote_pad() local
543 if (!is_media_entity_v4l2_subdev(link->sink->entity)) in vsp1_entity_remote_pad()
546 entity = media_entity_to_vsp1_entity(link->sink->entity); in vsp1_entity_remote_pad()
547 if (entity->type != VSP1_ENTITY_HGO && in vsp1_entity_remote_pad()
548 entity->type != VSP1_ENTITY_HGT) in vsp1_entity_remote_pad()
612 int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, in vsp1_entity_init() argument
622 if (vsp1_routes[i].type == entity->type && in vsp1_entity_init()
623 vsp1_routes[i].index == entity->index) { in vsp1_entity_init()
624 entity->route = &vsp1_routes[i]; in vsp1_entity_init()
632 mutex_init(&entity->lock); in vsp1_entity_init()
634 entity->vsp1 = vsp1; in vsp1_entity_init()
635 entity->source_pad = num_pads - 1; in vsp1_entity_init()
638 entity->pads = devm_kcalloc(vsp1->dev, in vsp1_entity_init()
639 num_pads, sizeof(*entity->pads), in vsp1_entity_init()
641 if (entity->pads == NULL) in vsp1_entity_init()
645 entity->pads[i].flags = MEDIA_PAD_FL_SINK; in vsp1_entity_init()
647 entity->sources = devm_kcalloc(vsp1->dev, max(num_pads - 1, 1U), in vsp1_entity_init()
648 sizeof(*entity->sources), GFP_KERNEL); in vsp1_entity_init()
649 if (entity->sources == NULL) in vsp1_entity_init()
653 entity->pads[num_pads - 1].flags = num_pads > 1 ? MEDIA_PAD_FL_SOURCE in vsp1_entity_init()
656 /* Initialize the media entity. */ in vsp1_entity_init()
657 ret = media_entity_pads_init(&entity->subdev.entity, num_pads, in vsp1_entity_init()
658 entity->pads); in vsp1_entity_init()
663 subdev = &entity->subdev; in vsp1_entity_init()
666 subdev->entity.function = function; in vsp1_entity_init()
667 subdev->entity.ops = &vsp1->media_ops; in vsp1_entity_init()
683 entity->config = __v4l2_subdev_state_alloc(&entity->subdev, in vsp1_entity_init()
685 if (IS_ERR(entity->config)) { in vsp1_entity_init()
686 media_entity_cleanup(&entity->subdev.entity); in vsp1_entity_init()
687 return PTR_ERR(entity->config); in vsp1_entity_init()
693 void vsp1_entity_destroy(struct vsp1_entity *entity) in vsp1_entity_destroy() argument
695 if (entity->ops && entity->ops->destroy) in vsp1_entity_destroy()
696 entity->ops->destroy(entity); in vsp1_entity_destroy()
697 if (entity->subdev.ctrl_handler) in vsp1_entity_destroy()
698 v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); in vsp1_entity_destroy()
699 __v4l2_subdev_state_free(entity->config); in vsp1_entity_destroy()
700 media_entity_cleanup(&entity->subdev.entity); in vsp1_entity_destroy()