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 /Documentation | |
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 'Documentation')
-rw-r--r-- | Documentation/DocBook/media-entities.tmpl | 2 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/media-controller.xml | 1 | ||||
-rw-r--r-- | Documentation/DocBook/v4l/media-ioc-setup-link.xml | 90 | ||||
-rw-r--r-- | Documentation/media-framework.txt | 42 |
4 files changed, 135 insertions, 0 deletions
diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index 2bd7b27f8553..121db1549244 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl | |||
@@ -94,6 +94,7 @@ | |||
94 | <!ENTITY MEDIA-IOC-DEVICE-INFO "<link linkend='media-ioc-device-info'><constant>MEDIA_IOC_DEVICE_INFO</constant></link>"> | 94 | <!ENTITY MEDIA-IOC-DEVICE-INFO "<link linkend='media-ioc-device-info'><constant>MEDIA_IOC_DEVICE_INFO</constant></link>"> |
95 | <!ENTITY MEDIA-IOC-ENUM-ENTITIES "<link linkend='media-ioc-enum-entities'><constant>MEDIA_IOC_ENUM_ENTITIES</constant></link>"> | 95 | <!ENTITY MEDIA-IOC-ENUM-ENTITIES "<link linkend='media-ioc-enum-entities'><constant>MEDIA_IOC_ENUM_ENTITIES</constant></link>"> |
96 | <!ENTITY MEDIA-IOC-ENUM-LINKS "<link linkend='media-ioc-enum-links'><constant>MEDIA_IOC_ENUM_LINKS</constant></link>"> | 96 | <!ENTITY MEDIA-IOC-ENUM-LINKS "<link linkend='media-ioc-enum-links'><constant>MEDIA_IOC_ENUM_LINKS</constant></link>"> |
97 | <!ENTITY MEDIA-IOC-SETUP-LINK "<link linkend='media-ioc-setup-link'><constant>MEDIA_IOC_SETUP_LINK</constant></link>"> | ||
97 | 98 | ||
98 | <!-- Types --> | 99 | <!-- Types --> |
99 | <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> | 100 | <!ENTITY v4l2-std-id "<link linkend='v4l2-std-id'>v4l2_std_id</link>"> |
@@ -348,6 +349,7 @@ | |||
348 | <!ENTITY sub-media-ioc-device-info SYSTEM "v4l/media-ioc-device-info.xml"> | 349 | <!ENTITY sub-media-ioc-device-info SYSTEM "v4l/media-ioc-device-info.xml"> |
349 | <!ENTITY sub-media-ioc-enum-entities SYSTEM "v4l/media-ioc-enum-entities.xml"> | 350 | <!ENTITY sub-media-ioc-enum-entities SYSTEM "v4l/media-ioc-enum-entities.xml"> |
350 | <!ENTITY sub-media-ioc-enum-links SYSTEM "v4l/media-ioc-enum-links.xml"> | 351 | <!ENTITY sub-media-ioc-enum-links SYSTEM "v4l/media-ioc-enum-links.xml"> |
352 | <!ENTITY sub-media-ioc-setup-link SYSTEM "v4l/media-ioc-setup-link.xml"> | ||
351 | 353 | ||
352 | <!-- Function Reference --> | 354 | <!-- Function Reference --> |
353 | <!ENTITY close SYSTEM "v4l/func-close.xml"> | 355 | <!ENTITY close SYSTEM "v4l/func-close.xml"> |
diff --git a/Documentation/DocBook/v4l/media-controller.xml b/Documentation/DocBook/v4l/media-controller.xml index 2c4fd2b27683..2dc25e1d4089 100644 --- a/Documentation/DocBook/v4l/media-controller.xml +++ b/Documentation/DocBook/v4l/media-controller.xml | |||
@@ -85,4 +85,5 @@ | |||
85 | &sub-media-ioc-device-info; | 85 | &sub-media-ioc-device-info; |
86 | &sub-media-ioc-enum-entities; | 86 | &sub-media-ioc-enum-entities; |
87 | &sub-media-ioc-enum-links; | 87 | &sub-media-ioc-enum-links; |
88 | &sub-media-ioc-setup-link; | ||
88 | </appendix> | 89 | </appendix> |
diff --git a/Documentation/DocBook/v4l/media-ioc-setup-link.xml b/Documentation/DocBook/v4l/media-ioc-setup-link.xml new file mode 100644 index 000000000000..09ab3d2b3a52 --- /dev/null +++ b/Documentation/DocBook/v4l/media-ioc-setup-link.xml | |||
@@ -0,0 +1,90 @@ | |||
1 | <refentry id="media-ioc-setup-link"> | ||
2 | <refmeta> | ||
3 | <refentrytitle>ioctl MEDIA_IOC_SETUP_LINK</refentrytitle> | ||
4 | &manvol; | ||
5 | </refmeta> | ||
6 | |||
7 | <refnamediv> | ||
8 | <refname>MEDIA_IOC_SETUP_LINK</refname> | ||
9 | <refpurpose>Modify the properties of a link</refpurpose> | ||
10 | </refnamediv> | ||
11 | |||
12 | <refsynopsisdiv> | ||
13 | <funcsynopsis> | ||
14 | <funcprototype> | ||
15 | <funcdef>int <function>ioctl</function></funcdef> | ||
16 | <paramdef>int <parameter>fd</parameter></paramdef> | ||
17 | <paramdef>int <parameter>request</parameter></paramdef> | ||
18 | <paramdef>struct media_link_desc *<parameter>argp</parameter></paramdef> | ||
19 | </funcprototype> | ||
20 | </funcsynopsis> | ||
21 | </refsynopsisdiv> | ||
22 | |||
23 | <refsect1> | ||
24 | <title>Arguments</title> | ||
25 | |||
26 | <variablelist> | ||
27 | <varlistentry> | ||
28 | <term><parameter>fd</parameter></term> | ||
29 | <listitem> | ||
30 | <para>File descriptor returned by | ||
31 | <link linkend='media-func-open'><function>open()</function></link>.</para> | ||
32 | </listitem> | ||
33 | </varlistentry> | ||
34 | <varlistentry> | ||
35 | <term><parameter>request</parameter></term> | ||
36 | <listitem> | ||
37 | <para>MEDIA_IOC_ENUM_LINKS</para> | ||
38 | </listitem> | ||
39 | </varlistentry> | ||
40 | <varlistentry> | ||
41 | <term><parameter>argp</parameter></term> | ||
42 | <listitem> | ||
43 | <para></para> | ||
44 | </listitem> | ||
45 | </varlistentry> | ||
46 | </variablelist> | ||
47 | </refsect1> | ||
48 | |||
49 | <refsect1> | ||
50 | <title>Description</title> | ||
51 | |||
52 | <para>To change link properties applications fill a &media-link-desc; with | ||
53 | link identification information (source and sink pad) and the new requested | ||
54 | link flags. They then call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to | ||
55 | that structure.</para> | ||
56 | <para>The only configurable property is the <constant>ENABLED</constant> | ||
57 | link flag to enable/disable a link. Links marked with the | ||
58 | <constant>IMMUTABLE</constant> link flag can not be enabled or disabled. | ||
59 | </para> | ||
60 | <para>Link configuration has no side effect on other links. If an enabled | ||
61 | link at the sink pad prevents the link from being enabled, the driver | ||
62 | returns with an &EBUSY;.</para> | ||
63 | <para>If the specified link can't be found the driver returns with an | ||
64 | &EINVAL;.</para> | ||
65 | </refsect1> | ||
66 | |||
67 | <refsect1> | ||
68 | &return-value; | ||
69 | |||
70 | <variablelist> | ||
71 | <varlistentry> | ||
72 | <term><errorcode>EBUSY</errorcode></term> | ||
73 | <listitem> | ||
74 | <para>The link properties can't be changed because the link is | ||
75 | currently busy. This can be caused, for instance, by an active media | ||
76 | stream (audio or video) on the link. The ioctl shouldn't be retried if | ||
77 | no other action is performed before to fix the problem.</para> | ||
78 | </listitem> | ||
79 | </varlistentry> | ||
80 | <varlistentry> | ||
81 | <term><errorcode>EINVAL</errorcode></term> | ||
82 | <listitem> | ||
83 | <para>The &media-link-desc; references a non-existing link, or the | ||
84 | link is immutable and an attempt to modify its configuration was made. | ||
85 | </para> | ||
86 | </listitem> | ||
87 | </varlistentry> | ||
88 | </variablelist> | ||
89 | </refsect1> | ||
90 | </refentry> | ||
diff --git a/Documentation/media-framework.txt b/Documentation/media-framework.txt index 78ae02095372..4809221c0ff9 100644 --- a/Documentation/media-framework.txt +++ b/Documentation/media-framework.txt | |||
@@ -259,6 +259,16 @@ When the graph traversal is complete the function will return NULL. | |||
259 | Graph traversal can be interrupted at any moment. No cleanup function call is | 259 | Graph traversal can be interrupted at any moment. No cleanup function call is |
260 | required and the graph structure can be freed normally. | 260 | required and the graph structure can be freed normally. |
261 | 261 | ||
262 | Helper functions can be used to find a link between two given pads, or a pad | ||
263 | connected to another pad through an enabled link | ||
264 | |||
265 | media_entity_find_link(struct media_pad *source, | ||
266 | struct media_pad *sink); | ||
267 | |||
268 | media_entity_remote_source(struct media_pad *pad); | ||
269 | |||
270 | Refer to the kerneldoc documentation for more information. | ||
271 | |||
262 | 272 | ||
263 | Use count and power handling | 273 | Use count and power handling |
264 | ---------------------------- | 274 | ---------------------------- |
@@ -271,3 +281,35 @@ track the number of users of every entity for power management needs. | |||
271 | The use_count field is owned by media drivers and must not be touched by entity | 281 | The use_count field is owned by media drivers and must not be touched by entity |
272 | drivers. Access to the field must be protected by the media device graph_mutex | 282 | drivers. Access to the field must be protected by the media device graph_mutex |
273 | lock. | 283 | lock. |
284 | |||
285 | |||
286 | Links setup | ||
287 | ----------- | ||
288 | |||
289 | Link properties can be modified at runtime by calling | ||
290 | |||
291 | media_entity_setup_link(struct media_link *link, u32 flags); | ||
292 | |||
293 | The flags argument contains the requested new link flags. | ||
294 | |||
295 | The only configurable property is the ENABLED link flag to enable/disable a | ||
296 | link. Links marked with the IMMUTABLE link flag can not be enabled or disabled. | ||
297 | |||
298 | When a link is enabled or disabled, the media framework calls the | ||
299 | link_setup operation for the two entities at the source and sink of the link, | ||
300 | in that order. If the second link_setup call fails, another link_setup call is | ||
301 | made on the first entity to restore the original link flags. | ||
302 | |||
303 | Media device drivers can be notified of link setup operations by setting the | ||
304 | media_device::link_notify pointer to a callback function. If provided, the | ||
305 | notification callback will be called before enabling and after disabling | ||
306 | links. | ||
307 | |||
308 | Entity drivers must implement the link_setup operation if any of their links | ||
309 | is non-immutable. The operation must either configure the hardware or store | ||
310 | the configuration information to be applied later. | ||
311 | |||
312 | Link configuration must not have any side effect on other links. If an enabled | ||
313 | link at a sink pad prevents another link at the same pad from being disabled, | ||
314 | the link_setup operation must return -EBUSY and can't implicitly disable the | ||
315 | first enabled link. | ||