1
0
Fork 0

[media] media: add macros to check if subdev or V4L2 DMA

As we'll be removing entity subtypes from the Kernel, we need
to provide a way for drivers and core to check if a given
entity is represented by a V4L2 subdev or if it is an V4L2
I/O entity (typically with DMA).

Drivers that create entities that don't belong to any defined subdev
category should use MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
steinar/wifi_calib_4_9_kernel
Mauro Carvalho Chehab 2015-08-21 12:17:40 -03:00
parent fef486a07d
commit fa17b46a6a
2 changed files with 37 additions and 0 deletions

View File

@ -220,6 +220,40 @@ static inline u32 media_gobj_gen_id(enum media_gobj_type type, u32 local_id)
return id;
}
static inline bool is_media_entity_v4l2_io(struct media_entity *entity)
{
if (!entity)
return false;
switch (entity->type) {
case MEDIA_ENT_T_V4L2_VIDEO:
case MEDIA_ENT_T_V4L2_VBI:
case MEDIA_ENT_T_V4L2_SWRADIO:
return true;
default:
return false;
}
}
static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
{
if (!entity)
return false;
switch (entity->type) {
case MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN:
case MEDIA_ENT_T_V4L2_SUBDEV_SENSOR:
case MEDIA_ENT_T_V4L2_SUBDEV_FLASH:
case MEDIA_ENT_T_V4L2_SUBDEV_LENS:
case MEDIA_ENT_T_V4L2_SUBDEV_DECODER:
case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
return true;
default:
return false;
}
}
#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
#define MEDIA_ENTITY_ENUM_MAX_ID 64

View File

@ -75,6 +75,9 @@ struct media_device_info {
#define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6)
/* V4L2 Sub-device entities */
#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)
#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2)
#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)