err = media_entity_init(&sd->entity, npads, pads);
The pads array must have been previously initialized. There is no need to
-manually set the struct media_entity type and name fields, but the revision
-field must be initialized if needed.
+manually set the struct media_entity function and name fields, but the
+revision field must be initialized if needed.
A reference to the entity will be automatically acquired/released when the
subdev device node (if any) is opened/closed.
if (!entity->name)
return -ENOMEM;
- entity->type = MEDIA_ENT_T_DVB_TSOUT;
+ entity->function = MEDIA_ENT_T_DVB_TSOUT;
pads->flags = MEDIA_PAD_FL_SINK;
ret = media_entity_init(entity, 1, pads);
switch (type) {
case DVB_DEVICE_FRONTEND:
- dvbdev->entity->type = MEDIA_ENT_T_DVB_DEMOD;
+ dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMOD;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_DEMUX:
- dvbdev->entity->type = MEDIA_ENT_T_DVB_DEMUX;
+ dvbdev->entity->function = MEDIA_ENT_T_DVB_DEMUX;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
for (i = 1; i < npads; i++)
dvbdev->pads[i].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_CA:
- dvbdev->entity->type = MEDIA_ENT_T_DVB_CA;
+ dvbdev->entity->function = MEDIA_ENT_T_DVB_CA;
dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
dvbdev->pads[1].flags = MEDIA_PAD_FL_SOURCE;
break;
return 0;
media_device_for_each_entity(entity, mdev) {
- switch (entity->type) {
+ switch (entity->function) {
case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
tuner = entity;
break;
/* Create demux links for each ringbuffer/pad */
if (demux) {
media_device_for_each_entity(entity, mdev) {
- if (entity->type == MEDIA_ENT_T_DVB_TSOUT) {
+ if (entity->function == MEDIA_ENT_T_DVB_TSOUT) {
if (!strncmp(entity->name, DVR_TSOUT,
strlen(DVR_TSOUT))) {
ret = media_create_pad_link(demux,
}
media_device_for_each_entity(entity, mdev) {
- if (entity->type == MEDIA_ENT_T_DVB_TSOUT) {
+ if (entity->function == MEDIA_ENT_T_DVB_TSOUT) {
if (!strcmp(entity->name, DVR_TSOUT)) {
link = media_create_intf_link(entity,
intf,
state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
state->pads);
if (ret < 0)
goto free_and_quit;
- flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
return 0;
if (ret < 0)
goto done;
- flash->subdev.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
mutex_init(&flash->power_lock);
state->pads[CX25840_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
state->pads[CX25840_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
state->pads[CX25840_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_DECODER;
ret = media_entity_init(&sd->entity, ARRAY_SIZE(state->pads),
state->pads);
rval = media_entity_init(&flash->subdev_led[led_no].entity, 0, NULL);
if (rval < 0)
goto err_out;
- flash->subdev_led[led_no].entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev_led[led_no].entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
return rval;
rval = media_entity_init(&flash->subdev_led.entity, 0, NULL);
if (rval < 0)
goto err_out;
- flash->subdev_led.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ flash->subdev_led.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
return rval;
err_out:
ret = media_entity_init(&sd->entity, 1, &info->pad);
if (ret < 0)
return ret;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
init_waitqueue_head(&info->irq_waitq);
mutex_init(&info->lock);
goto np_err;
info->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &info->pad);
if (ret < 0)
goto np_err;
#if defined(CONFIG_MEDIA_CONTROLLER)
ov2659->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &ov2659->pad);
if (ret < 0) {
v4l2_ctrl_handler_free(&ov2659->ctrls);
return ret;
ov965x->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &ov965x->pad);
if (ret < 0)
return ret;
state->sensor_pads[S5C73M3_JPEG_PAD].flags = MEDIA_PAD_FL_SOURCE;
state->sensor_pads[S5C73M3_ISP_PAD].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, S5C73M3_NUM_PADS,
state->sensor_pads);
state->oif_pads[OIF_ISP_PAD].flags = MEDIA_PAD_FL_SINK;
state->oif_pads[OIF_JPEG_PAD].flags = MEDIA_PAD_FL_SINK;
state->oif_pads[OIF_SOURCE_PAD].flags = MEDIA_PAD_FL_SOURCE;
- oif_sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
+ oif_sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
ret = media_entity_init(&oif_sd->entity, OIF_NUM_PADS,
state->oif_pads);
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
priv->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &priv->pad);
if (ret)
return ret;
static inline bool s5k5baf_is_cis_subdev(struct v4l2_subdev *sd)
{
- return sd->entity.type == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ return sd->entity.function == MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
}
static inline struct s5k5baf *to_s5k5baf(struct v4l2_subdev *sd)
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
state->cis_pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, NUM_CIS_PADS, &state->cis_pad);
if (ret < 0)
goto err;
state->pads[PAD_CIS].flags = MEDIA_PAD_FL_SINK;
state->pads[PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
ret = media_entity_init(&sd->entity, NUM_ISP_PADS, state->pads);
if (!ret)
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
s5k6aa->pad.flags = MEDIA_PAD_FL_SOURCE;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
ret = media_entity_init(&sd->entity, 1, &s5k6aa->pad);
if (ret)
return ret;
dev_dbg(&client->dev, "profile %d\n", sensor->minfo.smiapp_profile);
- sensor->pixel_array->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
+ sensor->pixel_array->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
/* final steps */
smiapp_read_frame_fmt(sensor);
u_ent.id = media_entity_id(ent);
if (ent->name)
strlcpy(u_ent.name, ent->name, sizeof(u_ent.name));
- u_ent.type = ent->type;
+ u_ent.type = ent->function;
u_ent.revision = ent->revision;
u_ent.flags = ent->flags;
u_ent.group_id = ent->group_id;
{
int i;
- if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN ||
- entity->type == MEDIA_ENT_T_UNKNOWN)
+ if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN ||
+ entity->function == MEDIA_ENT_T_UNKNOWN)
dev_warn(mdev->dev,
"Entity type for entity %s was not initialized!\n",
entity->name);
while ((entity = media_entity_graph_walk_next(&graph))) {
struct xvip_dma *dma;
- if (entity->type != MEDIA_ENT_T_V4L2_VIDEO)
+ if (entity->function != MEDIA_ENT_T_V4L2_VIDEO)
continue;
dma = to_xvip_dma(media_entity_to_video_device(entity));
return 0;
media_device_for_each_entity(entity, mdev) {
- switch (entity->type) {
+ switch (entity->function) {
case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
tuner = entity;
break;
switch (AUVI_INPUT(i).type) {
case AU0828_VMUX_COMPOSITE:
- ent->type = MEDIA_ENT_T_CONN_COMPOSITE;
+ ent->function = MEDIA_ENT_T_CONN_COMPOSITE;
break;
case AU0828_VMUX_SVIDEO:
- ent->type = MEDIA_ENT_T_CONN_SVIDEO;
+ ent->function = MEDIA_ENT_T_CONN_SVIDEO;
break;
case AU0828_VMUX_CABLE:
case AU0828_VMUX_TELEVISION:
case AU0828_VMUX_DVB:
- ent->type = MEDIA_ENT_T_CONN_RF;
+ ent->function = MEDIA_ENT_T_CONN_RF;
break;
default: /* AU0828_VMUX_DEBUG */
- ent->type = MEDIA_ENT_T_CONN_TEST;
+ ent->function = MEDIA_ENT_T_CONN_TEST;
break;
}
return 0;
media_device_for_each_entity(entity, mdev) {
- switch (entity->type) {
+ switch (entity->function) {
case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
tuner = entity;
break;
* this should be enough for the actual needs.
*/
media_device_for_each_entity(entity, mdev) {
- if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
+ if (entity->function == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
decoder = entity;
break;
}
#if defined(CONFIG_MEDIA_CONTROLLER)
t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
t->pad[TUNER_PAD_IF_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
- t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
+ t->sd.entity.function = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
t->sd.entity.name = t->name;
ret = media_entity_init(&t->sd.entity, TUNER_NUM_PADS, &t->pad[0]);
if (v4l2_dev->mdev) {
/* Remove interfaces and interface links */
media_devnode_remove(vdev->intf_devnode);
- if (vdev->entity.type != MEDIA_ENT_T_UNKNOWN)
+ if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN)
media_device_unregister_entity(&vdev->entity);
}
#endif
if (!vdev->v4l2_dev->mdev)
return 0;
- vdev->entity.type = MEDIA_ENT_T_UNKNOWN;
+ vdev->entity.function = MEDIA_ENT_T_UNKNOWN;
switch (type) {
case VFL_TYPE_GRABBER:
intf_type = MEDIA_INTF_T_V4L_VIDEO;
- vdev->entity.type = MEDIA_ENT_T_V4L2_VIDEO;
+ vdev->entity.function = MEDIA_ENT_T_V4L2_VIDEO;
break;
case VFL_TYPE_VBI:
intf_type = MEDIA_INTF_T_V4L_VBI;
- vdev->entity.type = MEDIA_ENT_T_V4L2_VBI;
+ vdev->entity.function = MEDIA_ENT_T_V4L2_VBI;
break;
case VFL_TYPE_SDR:
intf_type = MEDIA_INTF_T_V4L_SWRADIO;
- vdev->entity.type = MEDIA_ENT_T_V4L2_SWRADIO;
+ vdev->entity.function = MEDIA_ENT_T_V4L2_SWRADIO;
break;
case VFL_TYPE_RADIO:
intf_type = MEDIA_INTF_T_V4L_RADIO;
return 0;
}
- if (vdev->entity.type != MEDIA_ENT_T_UNKNOWN) {
+ if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) {
vdev->entity.name = vdev->name;
/* Needed just for backward compatibility with legacy MC API */
return -ENOMEM;
}
- if (vdev->entity.type != MEDIA_ENT_T_UNKNOWN) {
+ if (vdev->entity.function != MEDIA_ENT_T_UNKNOWN) {
struct media_link *link;
link = media_create_intf_link(&vdev->entity,
if (ret < 0)
return ERR_PTR(ret);
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_FLASH;
ret = v4l2_flash_init_controls(v4l2_flash, config);
if (ret < 0)
return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
}
- WARN(pad->entity->type != MEDIA_ENT_T_V4L2_VIDEO,
+ WARN(pad->entity->function != MEDIA_ENT_T_V4L2_VIDEO,
"Driver bug! Wrong media entity type 0x%08x, entity %s\n",
- pad->entity->type, pad->entity->name);
+ pad->entity->function, pad->entity->name);
return -EINVAL;
}
sd->host_priv = NULL;
#if defined(CONFIG_MEDIA_CONTROLLER)
sd->entity.name = sd->name;
- sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
+ sd->entity.function = MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN;
#endif
}
EXPORT_SYMBOL(v4l2_subdev_init);
*
* @graph_obj: Embedded structure containing the media object common data.
* @name: Entity name.
- * @type: Entity type, as defined in uapi/media.h (MEDIA_ENT_T_*)
+ * @function: Entity main function, as defined in uapi/media.h
+ * (MEDIA_ENT_F_*)
* @revision: Entity revision - OBSOLETE - should be removed soon.
* @flags: Entity flags, as defined in uapi/media.h (MEDIA_ENT_FL_*)
* @group_id: Entity group ID - OBSOLETE - should be removed soon.
struct media_entity {
struct media_gobj graph_obj; /* must be first field in struct */
const char *name;
- u32 type;
+ u32 function;
u32 revision;
unsigned long flags;
u32 group_id;
if (!entity)
return false;
- switch (entity->type) {
+ switch (entity->function) {
case MEDIA_ENT_T_V4L2_VIDEO:
case MEDIA_ENT_T_V4L2_VBI:
case MEDIA_ENT_T_V4L2_SWRADIO:
if (!entity)
return false;
- switch (entity->type) {
+ switch (entity->function) {
case MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN:
case MEDIA_ENT_T_V4L2_SUBDEV_SENSOR:
case MEDIA_ENT_T_V4L2_SUBDEV_FLASH: