xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-frequency.rst (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_FREQUENCY:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab********************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY
854f38fcaSMauro Carvalho Chehab********************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_FREQUENCY - VIDIOC_S_FREQUENCY - Get or set tuner or modulator radio frequency
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_FREQUENCY
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_FREQUENCY, struct v4l2_frequency *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_FREQUENCY
23407e84cdSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_FREQUENCY, const struct v4l2_frequency *argp)``
2554f38fcaSMauro Carvalho Chehab
2654f38fcaSMauro Carvalho ChehabArguments
2754f38fcaSMauro Carvalho Chehab=========
2854f38fcaSMauro Carvalho Chehab
2954f38fcaSMauro Carvalho Chehab``fd``
30407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho Chehab``argp``
3354f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_frequency`.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabTo get the current tuner or modulator radio frequency applications set
3954f38fcaSMauro Carvalho Chehabthe ``tuner`` field of a struct
4054f38fcaSMauro Carvalho Chehab:c:type:`v4l2_frequency` to the respective tuner or
4154f38fcaSMauro Carvalho Chehabmodulator number (only input devices have tuners, only output devices
4254f38fcaSMauro Carvalho Chehabhave modulators), zero out the ``reserved`` array and call the
4354f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this structure. The
4454f38fcaSMauro Carvalho Chehabdriver stores the current frequency in the ``frequency`` field.
4554f38fcaSMauro Carvalho Chehab
4654f38fcaSMauro Carvalho ChehabTo change the current tuner or modulator radio frequency applications
4754f38fcaSMauro Carvalho Chehabinitialize the ``tuner``, ``type`` and ``frequency`` fields, and the
4854f38fcaSMauro Carvalho Chehab``reserved`` array of a struct :c:type:`v4l2_frequency`
4954f38fcaSMauro Carvalho Chehaband call the :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl with a pointer to this
5054f38fcaSMauro Carvalho Chehabstructure. When the requested frequency is not possible the driver
5154f38fcaSMauro Carvalho Chehabassumes the closest possible value. However :ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` is a
5254f38fcaSMauro Carvalho Chehabwrite-only ioctl, it does not return the actual new frequency.
5354f38fcaSMauro Carvalho Chehab
54*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
5554f38fcaSMauro Carvalho Chehab
5654f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_frequency
5754f38fcaSMauro Carvalho Chehab
5854f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_frequency
5954f38fcaSMauro Carvalho Chehab    :header-rows:  0
6054f38fcaSMauro Carvalho Chehab    :stub-columns: 0
6154f38fcaSMauro Carvalho Chehab    :widths:       1 1 2
6254f38fcaSMauro Carvalho Chehab
6354f38fcaSMauro Carvalho Chehab    * - __u32
6454f38fcaSMauro Carvalho Chehab      - ``tuner``
6554f38fcaSMauro Carvalho Chehab      - The tuner or modulator index number. This is the same value as in
6654f38fcaSMauro Carvalho Chehab	the struct :c:type:`v4l2_input` ``tuner`` field and
6754f38fcaSMauro Carvalho Chehab	the struct :c:type:`v4l2_tuner` ``index`` field, or
6854f38fcaSMauro Carvalho Chehab	the struct :c:type:`v4l2_output` ``modulator`` field
6954f38fcaSMauro Carvalho Chehab	and the struct :c:type:`v4l2_modulator` ``index``
7054f38fcaSMauro Carvalho Chehab	field.
7154f38fcaSMauro Carvalho Chehab    * - __u32
7254f38fcaSMauro Carvalho Chehab      - ``type``
7354f38fcaSMauro Carvalho Chehab      - The tuner type. This is the same value as in the struct
7454f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_tuner` ``type`` field. The type must be
7554f38fcaSMauro Carvalho Chehab	set to ``V4L2_TUNER_RADIO`` for ``/dev/radioX`` device nodes, and
7654f38fcaSMauro Carvalho Chehab	to ``V4L2_TUNER_ANALOG_TV`` for all others. Set this field to
7754f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_RADIO`` for modulators (currently only radio
7854f38fcaSMauro Carvalho Chehab	modulators are supported). See :c:type:`v4l2_tuner_type`
7954f38fcaSMauro Carvalho Chehab    * - __u32
8054f38fcaSMauro Carvalho Chehab      - ``frequency``
8154f38fcaSMauro Carvalho Chehab      - Tuning frequency in units of 62.5 kHz, or if the struct
8254f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_tuner` or struct
8354f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_modulator` ``capability`` flag
8454f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_CAP_LOW`` is set, in units of 62.5 Hz. A 1 Hz unit is
8554f38fcaSMauro Carvalho Chehab	used when the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is set.
8654f38fcaSMauro Carvalho Chehab    * - __u32
8754f38fcaSMauro Carvalho Chehab      - ``reserved``\ [8]
8854f38fcaSMauro Carvalho Chehab      - Reserved for future extensions. Drivers and applications must set
8954f38fcaSMauro Carvalho Chehab	the array to zero.
9054f38fcaSMauro Carvalho Chehab
9154f38fcaSMauro Carvalho ChehabReturn Value
9254f38fcaSMauro Carvalho Chehab============
9354f38fcaSMauro Carvalho Chehab
9454f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
9554f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
9654f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
9754f38fcaSMauro Carvalho Chehab
9854f38fcaSMauro Carvalho ChehabEINVAL
9954f38fcaSMauro Carvalho Chehab    The ``tuner`` index is out of bounds or the value in the ``type``
10054f38fcaSMauro Carvalho Chehab    field is wrong.
10154f38fcaSMauro Carvalho Chehab
10254f38fcaSMauro Carvalho ChehabEBUSY
10354f38fcaSMauro Carvalho Chehab    A hardware seek is in progress.
104