[PATCH 09/18] media controller: add macros to check if subdev or A/V DMA

Mauro Carvalho Chehab
2015-05-08T01:12:49Z

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 A/V
DMA.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index 0c003d817493..f15b48145711 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -113,6 +113,35 @@ static inline u32 media_entity_subtype(struct media_entity *entity)
return entity->type & MEDIA_ENT_SUBTYPE_MASK;
}

+static inline bool is_media_entity_av_dma(struct media_entity *entity)
+{
+ if (!entity)
+ return false;
+
+ if (entity->type == MEDIA_ENT_T_AV_DMA)
+ return true;
+
+ 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_CAM_SENSOR:
+ case MEDIA_ENT_T_CAM_FLASH:
+ case MEDIA_ENT_T_CAM_LENS:
+ case MEDIA_ENT_T_ATV_DECODER:
+ case MEDIA_ENT_T_TUNER:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
#define MEDIA_ENTITY_ENUM_MAX_ID 64

--
2.1.0