summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-08-21 11:17:40 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 09:18:49 -0500
commitfa17b46a6a01013f48c33934c09e02f51f099f2b (patch)
tree393357396df1b838139c53315c61550c235f92c2
parentfef486a07d69cbcae81bf65a6817ff7383104a24 (diff)
[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>
-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)
220 return id; 220 return id;
221} 221}
222 222
223static inline bool is_media_entity_v4l2_io(struct media_entity *entity)
224{
225 if (!entity)
226 return false;
227
228 switch (entity->type) {
229 case MEDIA_ENT_T_V4L2_VIDEO:
230 case MEDIA_ENT_T_V4L2_VBI:
231 case MEDIA_ENT_T_V4L2_SWRADIO:
232 return true;
233 default:
234 return false;
235 }
236}
237
238static inline bool is_media_entity_v4l2_subdev(struct media_entity *entity)
239{
240 if (!entity)
241 return false;
242
243 switch (entity->type) {
244 case MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN:
245 case MEDIA_ENT_T_V4L2_SUBDEV_SENSOR:
246 case MEDIA_ENT_T_V4L2_SUBDEV_FLASH:
247 case MEDIA_ENT_T_V4L2_SUBDEV_LENS:
248 case MEDIA_ENT_T_V4L2_SUBDEV_DECODER:
249 case MEDIA_ENT_T_V4L2_SUBDEV_TUNER:
250 return true;
251
252 default:
253 return false;
254 }
255}
256
223#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16 257#define MEDIA_ENTITY_ENUM_MAX_DEPTH 16
224#define MEDIA_ENTITY_ENUM_MAX_ID 64 258#define MEDIA_ENTITY_ENUM_MAX_ID 64
225 259
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 {
75#define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6) 75#define MEDIA_ENT_T_V4L2_SWRADIO (MEDIA_ENT_T_V4L2_BASE + 6)
76 76
77/* V4L2 Sub-device entities */ 77/* V4L2 Sub-device entities */
78
79#define MEDIA_ENT_T_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_T_V4L2_SUBDEV_BASE
80
78#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1) 81#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 1)
79#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2) 82#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 2)
80#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3) 83#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV_BASE + 3)