diff options
| author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-09 06:40:03 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:53:16 -0400 |
| commit | 97548ed4c4661502cdfd1aabd5d3876fa4f5cc2e (patch) | |
| tree | c85b85954f53e3a97b6590de8d5d5396e7c43358 /include | |
| parent | 1651333b09743887bc2dd3d158a11853a2be3fe7 (diff) | |
[media] media: Links setup
Create the following ioctl and implement it at the media device level to
setup links.
- MEDIA_IOC_SETUP_LINK: Modify the properties of a given link
The only property that can currently be modified is the ENABLED link
flag to enable/disable a link. Links marked with the IMMUTABLE link flag
can not be enabled or disabled.
Enabling or disabling a link has effects on entities' use count. Those
changes are automatically propagated through the graph.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.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')
| -rw-r--r-- | include/linux/media.h | 1 | ||||
| -rw-r--r-- | include/media/media-device.h | 3 | ||||
| -rw-r--r-- | include/media/media-entity.h | 17 |
3 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/media.h b/include/linux/media.h index 17c93a413677..7c69913c0ad2 100644 --- a/include/linux/media.h +++ b/include/linux/media.h | |||
| @@ -126,5 +126,6 @@ struct media_links_enum { | |||
| 126 | #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) | 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) | 128 | #define MEDIA_IOC_ENUM_LINKS _IOWR('M', 3, struct media_links_enum) |
| 129 | #define MEDIA_IOC_SETUP_LINK _IOWR('M', 4, struct media_link_desc) | ||
| 129 | 130 | ||
| 130 | #endif /* __LINUX_MEDIA_H */ | 131 | #endif /* __LINUX_MEDIA_H */ |
diff --git a/include/media/media-device.h b/include/media/media-device.h index 5d2bff4fc9e0..6a27d916c250 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h | |||
| @@ -73,6 +73,9 @@ struct media_device { | |||
| 73 | spinlock_t lock; | 73 | spinlock_t lock; |
| 74 | /* Serializes graph operations. */ | 74 | /* Serializes graph operations. */ |
| 75 | struct mutex graph_mutex; | 75 | struct mutex graph_mutex; |
| 76 | |||
| 77 | int (*link_notify)(struct media_pad *source, | ||
| 78 | struct media_pad *sink, u32 flags); | ||
| 76 | }; | 79 | }; |
| 77 | 80 | ||
| 78 | /* media_devnode to media_device */ | 81 | /* media_devnode to media_device */ |
diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 51bdafce72c7..d889dcc67d0d 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h | |||
| @@ -39,6 +39,12 @@ struct media_pad { | |||
| 39 | unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */ | 39 | unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */ |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct media_entity_operations { | ||
| 43 | int (*link_setup)(struct media_entity *entity, | ||
| 44 | const struct media_pad *local, | ||
| 45 | const struct media_pad *remote, u32 flags); | ||
| 46 | }; | ||
| 47 | |||
| 42 | struct media_entity { | 48 | struct media_entity { |
| 43 | struct list_head list; | 49 | struct list_head list; |
| 44 | struct media_device *parent; /* Media device this entity belongs to*/ | 50 | struct media_device *parent; /* Media device this entity belongs to*/ |
| @@ -59,6 +65,8 @@ struct media_entity { | |||
| 59 | struct media_pad *pads; /* Pads array (num_pads elements) */ | 65 | struct media_pad *pads; /* Pads array (num_pads elements) */ |
| 60 | struct media_link *links; /* Links array (max_links elements)*/ | 66 | struct media_link *links; /* Links array (max_links elements)*/ |
| 61 | 67 | ||
| 68 | const struct media_entity_operations *ops; /* Entity operations */ | ||
| 69 | |||
| 62 | /* Reference counts must never be negative, but are signed integers on | 70 | /* Reference counts must never be negative, but are signed integers on |
| 63 | * purpose: a simple WARN_ON(<0) check can be used to detect reference | 71 | * purpose: a simple WARN_ON(<0) check can be used to detect reference |
| 64 | * count bugs that would make them negative. | 72 | * count bugs that would make them negative. |
| @@ -112,6 +120,11 @@ int media_entity_init(struct media_entity *entity, u16 num_pads, | |||
| 112 | void media_entity_cleanup(struct media_entity *entity); | 120 | void media_entity_cleanup(struct media_entity *entity); |
| 113 | int media_entity_create_link(struct media_entity *source, u16 source_pad, | 121 | int media_entity_create_link(struct media_entity *source, u16 source_pad, |
| 114 | struct media_entity *sink, u16 sink_pad, u32 flags); | 122 | struct media_entity *sink, u16 sink_pad, u32 flags); |
| 123 | int __media_entity_setup_link(struct media_link *link, u32 flags); | ||
| 124 | int media_entity_setup_link(struct media_link *link, u32 flags); | ||
| 125 | struct media_link *media_entity_find_link(struct media_pad *source, | ||
| 126 | struct media_pad *sink); | ||
| 127 | struct media_pad *media_entity_remote_source(struct media_pad *pad); | ||
| 115 | 128 | ||
| 116 | struct media_entity *media_entity_get(struct media_entity *entity); | 129 | struct media_entity *media_entity_get(struct media_entity *entity); |
| 117 | void media_entity_put(struct media_entity *entity); | 130 | void media_entity_put(struct media_entity *entity); |
| @@ -121,4 +134,8 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph, | |||
| 121 | struct media_entity * | 134 | struct media_entity * |
| 122 | media_entity_graph_walk_next(struct media_entity_graph *graph); | 135 | media_entity_graph_walk_next(struct media_entity_graph *graph); |
| 123 | 136 | ||
| 137 | #define media_entity_call(entity, operation, args...) \ | ||
| 138 | (((entity)->ops && (entity)->ops->operation) ? \ | ||
| 139 | (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) | ||
| 140 | |||
| 124 | #endif | 141 | #endif |
