xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: MC
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _media_ioc_setup_link:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun**************************
7*4882a593Smuzhiyunioctl MEDIA_IOC_SETUP_LINK
8*4882a593Smuzhiyun**************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunMEDIA_IOC_SETUP_LINK - Modify the properties of a link
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: MEDIA_IOC_SETUP_LINK
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, MEDIA_IOC_SETUP_LINK, struct media_link_desc *argp)``
21*4882a593Smuzhiyun
22*4882a593SmuzhiyunArguments
23*4882a593Smuzhiyun=========
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun``fd``
26*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun``argp``
29*4882a593Smuzhiyun    Pointer to struct :c:type:`media_link_desc`.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunDescription
32*4882a593Smuzhiyun===========
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunTo change link properties applications fill a struct
35*4882a593Smuzhiyun:c:type:`media_link_desc` with link identification
36*4882a593Smuzhiyuninformation (source and sink pad) and the new requested link flags. They
37*4882a593Smuzhiyunthen call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to that
38*4882a593Smuzhiyunstructure.
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunThe only configurable property is the ``ENABLED`` link flag to
41*4882a593Smuzhiyunenable/disable a link. Links marked with the ``IMMUTABLE`` link flag can
42*4882a593Smuzhiyunnot be enabled or disabled.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunLink configuration has no side effect on other links. If an enabled link
45*4882a593Smuzhiyunat the sink pad prevents the link from being enabled, the driver returns
46*4882a593Smuzhiyunwith an ``EBUSY`` error code.
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunOnly links marked with the ``DYNAMIC`` link flag can be enabled/disabled
49*4882a593Smuzhiyunwhile streaming media data. Attempting to enable or disable a streaming
50*4882a593Smuzhiyunnon-dynamic link will return an ``EBUSY`` error code.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunIf the specified link can't be found the driver returns with an ``EINVAL``
53*4882a593Smuzhiyunerror code.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunReturn Value
56*4882a593Smuzhiyun============
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
59*4882a593Smuzhiyunappropriately. The generic error codes are described at the
60*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
61*4882a593Smuzhiyun
62*4882a593SmuzhiyunEINVAL
63*4882a593Smuzhiyun    The struct :c:type:`media_link_desc` references a
64*4882a593Smuzhiyun    non-existing link, or the link is immutable and an attempt to modify
65*4882a593Smuzhiyun    its configuration was made.
66