diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-09 06:40:01 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:53:14 -0400 |
commit | 1651333b09743887bc2dd3d158a11853a2be3fe7 (patch) | |
tree | 965dd31e8fbd0c866bbcd47b86baccc238101ef7 /include/linux/media.h | |
parent | 140d88165c25137e871f9559e67986ed89251105 (diff) |
[media] media: Entities, pads and links enumeration
Create the following two ioctls and implement them at the media device
level to enumerate entities, pads and links.
- MEDIA_IOC_ENUM_ENTITIES: Enumerate entities and their properties
- MEDIA_IOC_ENUM_LINKS: Enumerate all pads and links for a given entity
Entity IDs can be non-contiguous. Userspace applications should
enumerate entities using the MEDIA_ENT_ID_FLAG_NEXT flag. When the flag
is set in the entity ID, the MEDIA_IOC_ENUM_ENTITIES will return the
next entity with an ID bigger than the requested one.
Only forward links that originate at one of the entity's source pads are
returned during the enumeration process.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/linux/media.h')
-rw-r--r-- | include/linux/media.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/media.h b/include/linux/media.h index 64090db3c1fc..17c93a413677 100644 --- a/include/linux/media.h +++ b/include/linux/media.h | |||
@@ -40,6 +40,91 @@ struct media_device_info { | |||
40 | __u32 reserved[31]; | 40 | __u32 reserved[31]; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) | ||
44 | |||
45 | #define MEDIA_ENT_TYPE_SHIFT 16 | ||
46 | #define MEDIA_ENT_TYPE_MASK 0x00ff0000 | ||
47 | #define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff | ||
48 | |||
49 | #define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) | ||
50 | #define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) | ||
51 | #define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) | ||
52 | #define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) | ||
53 | #define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) | ||
54 | |||
55 | #define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) | ||
56 | #define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) | ||
57 | #define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) | ||
58 | #define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) | ||
59 | |||
60 | #define MEDIA_ENT_FL_DEFAULT (1 << 0) | ||
61 | |||
62 | struct media_entity_desc { | ||
63 | __u32 id; | ||
64 | char name[32]; | ||
65 | __u32 type; | ||
66 | __u32 revision; | ||
67 | __u32 flags; | ||
68 | __u32 group_id; | ||
69 | __u16 pads; | ||
70 | __u16 links; | ||
71 | |||
72 | __u32 reserved[4]; | ||
73 | |||
74 | union { | ||
75 | /* Node specifications */ | ||
76 | struct { | ||
77 | __u32 major; | ||
78 | __u32 minor; | ||
79 | } v4l; | ||
80 | struct { | ||
81 | __u32 major; | ||
82 | __u32 minor; | ||
83 | } fb; | ||
84 | struct { | ||
85 | __u32 card; | ||
86 | __u32 device; | ||
87 | __u32 subdevice; | ||
88 | } alsa; | ||
89 | int dvb; | ||
90 | |||
91 | /* Sub-device specifications */ | ||
92 | /* Nothing needed yet */ | ||
93 | __u8 raw[184]; | ||
94 | }; | ||
95 | }; | ||
96 | |||
97 | #define MEDIA_PAD_FL_SINK (1 << 0) | ||
98 | #define MEDIA_PAD_FL_SOURCE (1 << 1) | ||
99 | |||
100 | struct media_pad_desc { | ||
101 | __u32 entity; /* entity ID */ | ||
102 | __u16 index; /* pad index */ | ||
103 | __u32 flags; /* pad flags */ | ||
104 | __u32 reserved[2]; | ||
105 | }; | ||
106 | |||
107 | #define MEDIA_LNK_FL_ENABLED (1 << 0) | ||
108 | #define MEDIA_LNK_FL_IMMUTABLE (1 << 1) | ||
109 | |||
110 | struct media_link_desc { | ||
111 | struct media_pad_desc source; | ||
112 | struct media_pad_desc sink; | ||
113 | __u32 flags; | ||
114 | __u32 reserved[2]; | ||
115 | }; | ||
116 | |||
117 | struct media_links_enum { | ||
118 | __u32 entity; | ||
119 | /* Should have enough room for pads elements */ | ||
120 | struct media_pad_desc __user *pads; | ||
121 | /* Should have enough room for links elements */ | ||
122 | struct media_link_desc __user *links; | ||
123 | __u32 reserved[4]; | ||
124 | }; | ||
125 | |||
43 | #define MEDIA_IOC_DEVICE_INFO _IOWR('M', 1, struct media_device_info) | 126 | #define MEDIA_IOC_DEVICE_INFO _IOWR('M', 1, struct media_device_info) |
127 | #define MEDIA_IOC_ENUM_ENTITIES _IOWR('M', 2, struct media_entity_desc) | ||
128 | #define MEDIA_IOC_ENUM_LINKS _IOWR('M', 3, struct media_links_enum) | ||
44 | 129 | ||
45 | #endif /* __LINUX_MEDIA_H */ | 130 | #endif /* __LINUX_MEDIA_H */ |