Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Media entity |
| 3 | * |
| 4 | * Copyright (C) 2010 Nokia Corporation |
| 5 | * |
| 6 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| 7 | * Sakari Ailus <sakari.ailus@iki.fi> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #ifndef _MEDIA_ENTITY_H |
| 24 | #define _MEDIA_ENTITY_H |
| 25 | |
Laurent Pinchart | 5c7b25b | 2013-06-07 12:45:11 -0300 | [diff] [blame] | 26 | #include <linux/bitops.h> |
Sakari Ailus | 0149a2e | 2013-12-13 08:58:37 -0300 | [diff] [blame] | 27 | #include <linux/kernel.h> |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 28 | #include <linux/list.h> |
Laurent Pinchart | 1651333 | 2009-12-09 08:40:01 -0300 | [diff] [blame] | 29 | #include <linux/media.h> |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 30 | |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 31 | /* Enums used internally at the media controller to represent graphs */ |
| 32 | |
| 33 | /** |
| 34 | * enum media_gobj_type - type of a graph object |
| 35 | * |
Mauro Carvalho Chehab | bfab2aac | 2015-08-14 12:47:48 -0300 | [diff] [blame] | 36 | * @MEDIA_GRAPH_ENTITY: Identify a media entity |
Mauro Carvalho Chehab | 18710dc | 2015-08-14 12:50:08 -0300 | [diff] [blame] | 37 | * @MEDIA_GRAPH_PAD: Identify a media pad |
Mauro Carvalho Chehab | 6b6a427 | 2015-08-14 12:54:36 -0300 | [diff] [blame] | 38 | * @MEDIA_GRAPH_LINK: Identify a media link |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 39 | * @MEDIA_GRAPH_INTF_DEVNODE: Identify a media Kernel API interface via |
| 40 | * a device node |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 41 | */ |
| 42 | enum media_gobj_type { |
Mauro Carvalho Chehab | bfab2aac | 2015-08-14 12:47:48 -0300 | [diff] [blame] | 43 | MEDIA_GRAPH_ENTITY, |
Mauro Carvalho Chehab | 18710dc | 2015-08-14 12:50:08 -0300 | [diff] [blame] | 44 | MEDIA_GRAPH_PAD, |
Mauro Carvalho Chehab | 6b6a427 | 2015-08-14 12:54:36 -0300 | [diff] [blame] | 45 | MEDIA_GRAPH_LINK, |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 46 | MEDIA_GRAPH_INTF_DEVNODE, |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | #define MEDIA_BITS_PER_TYPE 8 |
| 50 | #define MEDIA_BITS_PER_LOCAL_ID (32 - MEDIA_BITS_PER_TYPE) |
| 51 | #define MEDIA_LOCAL_ID_MASK GENMASK(MEDIA_BITS_PER_LOCAL_ID - 1, 0) |
| 52 | |
| 53 | /* Structs to represent the objects that belong to a media graph */ |
| 54 | |
| 55 | /** |
| 56 | * struct media_gobj - Define a graph object. |
| 57 | * |
| 58 | * @id: Non-zero object ID identifier. The ID should be unique |
| 59 | * inside a media_device, as it is composed by |
| 60 | * MEDIA_BITS_PER_TYPE to store the type plus |
| 61 | * MEDIA_BITS_PER_LOCAL_ID to store a per-type ID |
| 62 | * (called as "local ID"). |
| 63 | * |
| 64 | * All objects on the media graph should have this struct embedded |
| 65 | */ |
| 66 | struct media_gobj { |
Mauro Carvalho Chehab | 39a956c | 2015-08-13 14:42:42 -0300 | [diff] [blame] | 67 | struct media_device *mdev; |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 68 | u32 id; |
| 69 | }; |
| 70 | |
| 71 | |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 72 | struct media_pipeline { |
| 73 | }; |
| 74 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 75 | struct media_link { |
Mauro Carvalho Chehab | 6b6a427 | 2015-08-14 12:54:36 -0300 | [diff] [blame] | 76 | struct media_gobj graph_obj; |
Mauro Carvalho Chehab | 57208e5 | 2015-08-07 06:55:40 -0300 | [diff] [blame] | 77 | struct list_head list; |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 78 | union { |
| 79 | struct media_gobj *gobj0; |
| 80 | struct media_pad *source; |
Mauro Carvalho Chehab | 86e2662 | 2015-08-07 10:36:25 -0300 | [diff] [blame] | 81 | struct media_interface *intf; |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 82 | }; |
| 83 | union { |
| 84 | struct media_gobj *gobj1; |
| 85 | struct media_pad *sink; |
Mauro Carvalho Chehab | 86e2662 | 2015-08-07 10:36:25 -0300 | [diff] [blame] | 86 | struct media_entity *entity; |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 87 | }; |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 88 | struct media_link *reverse; /* Link in the reverse direction */ |
| 89 | unsigned long flags; /* Link flags (MEDIA_LNK_FL_*) */ |
| 90 | }; |
| 91 | |
| 92 | struct media_pad { |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 93 | struct media_gobj graph_obj; /* must be first field in struct */ |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 94 | struct media_entity *entity; /* Entity this pad belongs to */ |
| 95 | u16 index; /* Pad index in the entity pads array */ |
| 96 | unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */ |
| 97 | }; |
| 98 | |
Laurent Pinchart | 5a5394b | 2014-03-26 00:01:44 -0300 | [diff] [blame] | 99 | /** |
| 100 | * struct media_entity_operations - Media entity operations |
| 101 | * @link_setup: Notify the entity of link changes. The operation can |
| 102 | * return an error, in which case link setup will be |
| 103 | * cancelled. Optional. |
| 104 | * @link_validate: Return whether a link is valid from the entity point of |
| 105 | * view. The media_entity_pipeline_start() function |
| 106 | * validates all links by calling this operation. Optional. |
| 107 | */ |
Laurent Pinchart | 97548ed | 2009-12-09 08:40:03 -0300 | [diff] [blame] | 108 | struct media_entity_operations { |
| 109 | int (*link_setup)(struct media_entity *entity, |
| 110 | const struct media_pad *local, |
| 111 | const struct media_pad *remote, u32 flags); |
Sakari Ailus | af88be3 | 2012-01-11 06:25:15 -0300 | [diff] [blame] | 112 | int (*link_validate)(struct media_link *link); |
Laurent Pinchart | 97548ed | 2009-12-09 08:40:03 -0300 | [diff] [blame] | 113 | }; |
| 114 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 115 | struct media_entity { |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 116 | struct media_gobj graph_obj; /* must be first field in struct */ |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 117 | struct list_head list; |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 118 | const char *name; /* Entity name */ |
| 119 | u32 type; /* Entity type (MEDIA_ENT_T_*) */ |
| 120 | u32 revision; /* Entity revision, driver specific */ |
| 121 | unsigned long flags; /* Entity flags (MEDIA_ENT_FL_*) */ |
| 122 | u32 group_id; /* Entity group ID */ |
| 123 | |
| 124 | u16 num_pads; /* Number of sink and source pads */ |
| 125 | u16 num_links; /* Number of existing links, both |
| 126 | * enabled and disabled */ |
| 127 | u16 num_backlinks; /* Number of backlinks */ |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 128 | |
Mauro Carvalho Chehab | 57208e5 | 2015-08-07 06:55:40 -0300 | [diff] [blame] | 129 | struct media_pad *pads; /* Pads array (num_pads objects) */ |
Mauro Carvalho Chehab | 4b8a3c0 | 2015-08-20 09:10:07 -0300 | [diff] [blame] | 130 | struct list_head links; /* Pad-to-pad links list */ |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 131 | |
Laurent Pinchart | 97548ed | 2009-12-09 08:40:03 -0300 | [diff] [blame] | 132 | const struct media_entity_operations *ops; /* Entity operations */ |
| 133 | |
Laurent Pinchart | 503c3d82 | 2010-03-07 15:04:59 -0300 | [diff] [blame] | 134 | /* Reference counts must never be negative, but are signed integers on |
| 135 | * purpose: a simple WARN_ON(<0) check can be used to detect reference |
| 136 | * count bugs that would make them negative. |
| 137 | */ |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 138 | int stream_count; /* Stream count for the entity. */ |
Laurent Pinchart | 503c3d82 | 2010-03-07 15:04:59 -0300 | [diff] [blame] | 139 | int use_count; /* Use count for the entity. */ |
| 140 | |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 141 | struct media_pipeline *pipe; /* Pipeline this entity belongs to. */ |
| 142 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 143 | union { |
| 144 | /* Node specifications */ |
| 145 | struct { |
| 146 | u32 major; |
| 147 | u32 minor; |
Mauro Carvalho Chehab | e31a0ba | 2015-01-02 12:18:23 -0300 | [diff] [blame] | 148 | } dev; |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 149 | |
| 150 | /* Sub-device specifications */ |
| 151 | /* Nothing needed yet */ |
Clemens Ladisch | fa5034c | 2011-11-05 18:42:01 -0300 | [diff] [blame] | 152 | } info; |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 153 | }; |
| 154 | |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 155 | /** |
| 156 | * struct media_intf_devnode - Define a Kernel API interface |
| 157 | * |
| 158 | * @graph_obj: embedded graph object |
Mauro Carvalho Chehab | 57cf79b | 2015-08-21 09:23:22 -0300 | [diff] [blame] | 159 | * @list: Linked list used to find other interfaces that belong |
| 160 | * to the same media controller |
Mauro Carvalho Chehab | 86e2662 | 2015-08-07 10:36:25 -0300 | [diff] [blame] | 161 | * @links: List of links pointing to graph entities |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 162 | * @type: Type of the interface as defined at the |
| 163 | * uapi/media/media.h header, e. g. |
| 164 | * MEDIA_INTF_T_* |
| 165 | * @flags: Interface flags as defined at uapi/media/media.h |
| 166 | */ |
| 167 | struct media_interface { |
| 168 | struct media_gobj graph_obj; |
Mauro Carvalho Chehab | 57cf79b | 2015-08-21 09:23:22 -0300 | [diff] [blame] | 169 | struct list_head list; |
Mauro Carvalho Chehab | 86e2662 | 2015-08-07 10:36:25 -0300 | [diff] [blame] | 170 | struct list_head links; |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 171 | u32 type; |
| 172 | u32 flags; |
| 173 | }; |
| 174 | |
| 175 | /** |
| 176 | * struct media_intf_devnode - Define a Kernel API interface via a device node |
| 177 | * |
| 178 | * @intf: embedded interface object |
| 179 | * @major: Major number of a device node |
| 180 | * @minor: Minor number of a device node |
| 181 | */ |
| 182 | struct media_intf_devnode { |
| 183 | struct media_interface intf; |
| 184 | u32 major; |
| 185 | u32 minor; |
| 186 | }; |
| 187 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 188 | static inline u32 media_entity_type(struct media_entity *entity) |
| 189 | { |
| 190 | return entity->type & MEDIA_ENT_TYPE_MASK; |
| 191 | } |
| 192 | |
| 193 | static inline u32 media_entity_subtype(struct media_entity *entity) |
| 194 | { |
| 195 | return entity->type & MEDIA_ENT_SUBTYPE_MASK; |
| 196 | } |
| 197 | |
Mauro Carvalho Chehab | fa76239 | 2015-08-14 10:42:05 -0300 | [diff] [blame] | 198 | static inline u32 media_entity_id(struct media_entity *entity) |
| 199 | { |
Mauro Carvalho Chehab | bfab2aac | 2015-08-14 12:47:48 -0300 | [diff] [blame] | 200 | return entity->graph_obj.id; |
Mauro Carvalho Chehab | fa76239 | 2015-08-14 10:42:05 -0300 | [diff] [blame] | 201 | } |
| 202 | |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 203 | static inline enum media_gobj_type media_type(struct media_gobj *gobj) |
| 204 | { |
| 205 | return gobj->id >> MEDIA_BITS_PER_LOCAL_ID; |
| 206 | } |
| 207 | |
| 208 | static inline u32 media_localid(struct media_gobj *gobj) |
| 209 | { |
| 210 | return gobj->id & MEDIA_LOCAL_ID_MASK; |
| 211 | } |
| 212 | |
| 213 | static inline u32 media_gobj_gen_id(enum media_gobj_type type, u32 local_id) |
| 214 | { |
| 215 | u32 id; |
| 216 | |
| 217 | id = type << MEDIA_BITS_PER_LOCAL_ID; |
| 218 | id |= local_id & MEDIA_LOCAL_ID_MASK; |
| 219 | |
| 220 | return id; |
| 221 | } |
| 222 | |
Mauro Carvalho Chehab | fa17b46 | 2015-08-21 12:17:40 -0300 | [diff] [blame^] | 223 | static 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 | |
| 238 | static 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 | |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 257 | #define MEDIA_ENTITY_ENUM_MAX_DEPTH 16 |
Laurent Pinchart | 5c7b25b | 2013-06-07 12:45:11 -0300 | [diff] [blame] | 258 | #define MEDIA_ENTITY_ENUM_MAX_ID 64 |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 259 | |
Mauro Carvalho Chehab | ef69ee1 | 2015-10-01 18:07:53 -0300 | [diff] [blame] | 260 | /* |
| 261 | * The number of pads can't be bigger than the number of entities, |
| 262 | * as the worse-case scenario is to have one entity linked up to |
| 263 | * MEDIA_ENTITY_ENUM_MAX_ID - 1 entities. |
| 264 | */ |
| 265 | #define MEDIA_ENTITY_MAX_PADS (MEDIA_ENTITY_ENUM_MAX_ID - 1) |
| 266 | |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 267 | struct media_entity_graph { |
| 268 | struct { |
| 269 | struct media_entity *entity; |
Mauro Carvalho Chehab | 57208e5 | 2015-08-07 06:55:40 -0300 | [diff] [blame] | 270 | struct list_head *link; |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 271 | } stack[MEDIA_ENTITY_ENUM_MAX_DEPTH]; |
Laurent Pinchart | 5c7b25b | 2013-06-07 12:45:11 -0300 | [diff] [blame] | 272 | |
| 273 | DECLARE_BITMAP(entities, MEDIA_ENTITY_ENUM_MAX_ID); |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 274 | int top; |
| 275 | }; |
| 276 | |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 277 | #define gobj_to_entity(gobj) \ |
| 278 | container_of(gobj, struct media_entity, graph_obj) |
| 279 | |
Mauro Carvalho Chehab | 39a956c | 2015-08-13 14:42:42 -0300 | [diff] [blame] | 280 | #define gobj_to_pad(gobj) \ |
| 281 | container_of(gobj, struct media_pad, graph_obj) |
| 282 | |
| 283 | #define gobj_to_link(gobj) \ |
| 284 | container_of(gobj, struct media_link, graph_obj) |
| 285 | |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 286 | #define gobj_to_link(gobj) \ |
| 287 | container_of(gobj, struct media_link, graph_obj) |
| 288 | |
| 289 | #define gobj_to_pad(gobj) \ |
| 290 | container_of(gobj, struct media_pad, graph_obj) |
| 291 | |
| 292 | #define gobj_to_intf(gobj) \ |
| 293 | container_of(gobj, struct media_interface, graph_obj) |
| 294 | |
| 295 | #define intf_to_devnode(intf) \ |
| 296 | container_of(intf, struct media_intf_devnode, intf) |
| 297 | |
Mauro Carvalho Chehab | ec6e4c9 | 2015-08-25 10:28:36 -0300 | [diff] [blame] | 298 | void media_gobj_init(struct media_device *mdev, |
| 299 | enum media_gobj_type type, |
| 300 | struct media_gobj *gobj); |
| 301 | void media_gobj_remove(struct media_gobj *gobj); |
| 302 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 303 | int media_entity_init(struct media_entity *entity, u16 num_pads, |
Mauro Carvalho Chehab | 57208e5 | 2015-08-07 06:55:40 -0300 | [diff] [blame] | 304 | struct media_pad *pads); |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 305 | void media_entity_cleanup(struct media_entity *entity); |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 306 | |
Mauro Carvalho Chehab | 8df00a1 | 2015-08-07 08:14:38 -0300 | [diff] [blame] | 307 | int media_create_pad_link(struct media_entity *source, u16 source_pad, |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 308 | struct media_entity *sink, u16 sink_pad, u32 flags); |
Sylwester Nawrocki | 7349cec | 2013-05-09 08:29:32 -0300 | [diff] [blame] | 309 | void __media_entity_remove_links(struct media_entity *entity); |
| 310 | void media_entity_remove_links(struct media_entity *entity); |
| 311 | |
Laurent Pinchart | 97548ed | 2009-12-09 08:40:03 -0300 | [diff] [blame] | 312 | int __media_entity_setup_link(struct media_link *link, u32 flags); |
| 313 | int media_entity_setup_link(struct media_link *link, u32 flags); |
| 314 | struct media_link *media_entity_find_link(struct media_pad *source, |
| 315 | struct media_pad *sink); |
Andrzej Hajda | 1bddf1b | 2013-06-03 05:16:13 -0300 | [diff] [blame] | 316 | struct media_pad *media_entity_remote_pad(struct media_pad *pad); |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 317 | |
Laurent Pinchart | 503c3d82 | 2010-03-07 15:04:59 -0300 | [diff] [blame] | 318 | struct media_entity *media_entity_get(struct media_entity *entity); |
| 319 | void media_entity_put(struct media_entity *entity); |
| 320 | |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 321 | void media_entity_graph_walk_start(struct media_entity_graph *graph, |
| 322 | struct media_entity *entity); |
| 323 | struct media_entity * |
| 324 | media_entity_graph_walk_next(struct media_entity_graph *graph); |
Sakari Ailus | af88be3 | 2012-01-11 06:25:15 -0300 | [diff] [blame] | 325 | __must_check int media_entity_pipeline_start(struct media_entity *entity, |
| 326 | struct media_pipeline *pipe); |
Laurent Pinchart | e02188c | 2010-08-25 09:00:41 -0300 | [diff] [blame] | 327 | void media_entity_pipeline_stop(struct media_entity *entity); |
Sakari Ailus | a5ccc48 | 2010-03-07 16:14:14 -0300 | [diff] [blame] | 328 | |
Mauro Carvalho Chehab | 27e543f | 2015-08-20 09:07:34 -0300 | [diff] [blame] | 329 | struct media_intf_devnode *media_devnode_create(struct media_device *mdev, |
| 330 | u32 type, u32 flags, |
| 331 | u32 major, u32 minor, |
| 332 | gfp_t gfp_flags); |
| 333 | void media_devnode_remove(struct media_intf_devnode *devnode); |
Mauro Carvalho Chehab | 86e2662 | 2015-08-07 10:36:25 -0300 | [diff] [blame] | 334 | struct media_link *media_create_intf_link(struct media_entity *entity, |
| 335 | struct media_interface *intf, |
| 336 | u32 flags); |
| 337 | void media_remove_intf_link(struct media_link *link); |
| 338 | |
Laurent Pinchart | 97548ed | 2009-12-09 08:40:03 -0300 | [diff] [blame] | 339 | #define media_entity_call(entity, operation, args...) \ |
| 340 | (((entity)->ops && (entity)->ops->operation) ? \ |
| 341 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) |
| 342 | |
Laurent Pinchart | 53e269c | 2009-12-09 08:40:00 -0300 | [diff] [blame] | 343 | #endif |