summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/media/media-entity.h34
-rw-r--r--include/uapi/linux/media.h3
2 files changed, 37 insertions, 0 deletions
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index ca35e07d9348..2596878f4b9f 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -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
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 8e9896820bee..c9314645d933 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -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)