xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-modulator.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_MODULATOR:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab********************************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_MODULATOR, VIDIOC_S_MODULATOR
854f38fcaSMauro Carvalho Chehab********************************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_MODULATOR - VIDIOC_S_MODULATOR - Get or set modulator attributes
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_MODULATOR
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_MODULATOR, struct v4l2_modulator *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_MODULATOR
23407e84cdSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_MODULATOR, const struct v4l2_modulator *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_modulator`.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabTo query the attributes of a modulator applications initialize the
3954f38fcaSMauro Carvalho Chehab``index`` field and zero out the ``reserved`` array of a struct
4054f38fcaSMauro Carvalho Chehab:c:type:`v4l2_modulator` and call the
4154f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` ioctl with a pointer to this structure. Drivers
4254f38fcaSMauro Carvalho Chehabfill the rest of the structure or return an ``EINVAL`` error code when the
4354f38fcaSMauro Carvalho Chehabindex is out of bounds. To enumerate all modulators applications shall
4454f38fcaSMauro Carvalho Chehabbegin at index zero, incrementing by one until the driver returns
4554f38fcaSMauro Carvalho ChehabEINVAL.
4654f38fcaSMauro Carvalho Chehab
4754f38fcaSMauro Carvalho ChehabModulators have two writable properties, an audio modulation set and the
4854f38fcaSMauro Carvalho Chehabradio frequency. To change the modulated audio subprograms, applications
4954f38fcaSMauro Carvalho Chehabinitialize the ``index`` and ``txsubchans`` fields and the ``reserved``
5054f38fcaSMauro Carvalho Chehabarray and call the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Drivers may choose a
5154f38fcaSMauro Carvalho Chehabdifferent audio modulation if the request cannot be satisfied. However
5254f38fcaSMauro Carvalho Chehabthis is a write-only ioctl, it does not return the actual audio
5354f38fcaSMauro Carvalho Chehabmodulation selected.
5454f38fcaSMauro Carvalho Chehab
5554f38fcaSMauro Carvalho Chehab:ref:`SDR <sdr>` specific modulator types are ``V4L2_TUNER_SDR`` and
5654f38fcaSMauro Carvalho Chehab``V4L2_TUNER_RF``. For SDR devices ``txsubchans`` field must be
5754f38fcaSMauro Carvalho Chehabinitialized to zero. The term 'modulator' means SDR transmitter in this
5854f38fcaSMauro Carvalho Chehabcontext.
5954f38fcaSMauro Carvalho Chehab
6054f38fcaSMauro Carvalho ChehabTo change the radio frequency the
6154f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl is available.
6254f38fcaSMauro Carvalho Chehab
63fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{2.9cm}|p{2.9cm}|p{5.8cm}|p{2.9cm}|p{2.4cm}|
6454f38fcaSMauro Carvalho Chehab
6554f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_modulator
6654f38fcaSMauro Carvalho Chehab
6754f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_modulator
6854f38fcaSMauro Carvalho Chehab    :header-rows:  0
6954f38fcaSMauro Carvalho Chehab    :stub-columns: 0
7054f38fcaSMauro Carvalho Chehab    :widths:       1 1 2 1 1
7154f38fcaSMauro Carvalho Chehab
7254f38fcaSMauro Carvalho Chehab    * - __u32
7354f38fcaSMauro Carvalho Chehab      - ``index``
7454f38fcaSMauro Carvalho Chehab      - Identifies the modulator, set by the application.
7554f38fcaSMauro Carvalho Chehab    * - __u8
7654f38fcaSMauro Carvalho Chehab      - ``name``\ [32]
7754f38fcaSMauro Carvalho Chehab      - Name of the modulator, a NUL-terminated ASCII string.
7854f38fcaSMauro Carvalho Chehab
7954f38fcaSMauro Carvalho Chehab	This information is intended for the user.
8054f38fcaSMauro Carvalho Chehab    * - __u32
8154f38fcaSMauro Carvalho Chehab      - ``capability``
8254f38fcaSMauro Carvalho Chehab      - Modulator capability flags. No flags are defined for this field,
8354f38fcaSMauro Carvalho Chehab	the tuner flags in struct :c:type:`v4l2_tuner` are
8454f38fcaSMauro Carvalho Chehab	used accordingly. The audio flags indicate the ability to encode
8554f38fcaSMauro Carvalho Chehab	audio subprograms. They will *not* change for example with the
8654f38fcaSMauro Carvalho Chehab	current video standard.
8754f38fcaSMauro Carvalho Chehab    * - __u32
8854f38fcaSMauro Carvalho Chehab      - ``rangelow``
8954f38fcaSMauro Carvalho Chehab      - The lowest tunable frequency in units of 62.5 KHz, or if the
9054f38fcaSMauro Carvalho Chehab	``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
9154f38fcaSMauro Carvalho Chehab	62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
9254f38fcaSMauro Carvalho Chehab	set, in units of 1 Hz.
9354f38fcaSMauro Carvalho Chehab    * - __u32
9454f38fcaSMauro Carvalho Chehab      - ``rangehigh``
9554f38fcaSMauro Carvalho Chehab      - The highest tunable frequency in units of 62.5 KHz, or if the
9654f38fcaSMauro Carvalho Chehab	``capability`` flag ``V4L2_TUNER_CAP_LOW`` is set, in units of
9754f38fcaSMauro Carvalho Chehab	62.5 Hz, or if the ``capability`` flag ``V4L2_TUNER_CAP_1HZ`` is
9854f38fcaSMauro Carvalho Chehab	set, in units of 1 Hz.
9954f38fcaSMauro Carvalho Chehab    * - __u32
10054f38fcaSMauro Carvalho Chehab      - ``txsubchans``
10154f38fcaSMauro Carvalho Chehab      - With this field applications can determine how audio sub-carriers
10254f38fcaSMauro Carvalho Chehab	shall be modulated. It contains a set of flags as defined in
10354f38fcaSMauro Carvalho Chehab	:ref:`modulator-txsubchans`.
10454f38fcaSMauro Carvalho Chehab
10554f38fcaSMauro Carvalho Chehab	.. note::
10654f38fcaSMauro Carvalho Chehab
10754f38fcaSMauro Carvalho Chehab	   The tuner ``rxsubchans`` flags  are reused, but the
10854f38fcaSMauro Carvalho Chehab	   semantics are different. Video output devices
10954f38fcaSMauro Carvalho Chehab	   are assumed to have an analog or PCM audio input with 1-3
11054f38fcaSMauro Carvalho Chehab	   channels. The ``txsubchans`` flags select one or more channels
11154f38fcaSMauro Carvalho Chehab	   for modulation, together with some audio subprogram indicator,
11254f38fcaSMauro Carvalho Chehab	   for example, a stereo pilot tone.
11354f38fcaSMauro Carvalho Chehab    * - __u32
11454f38fcaSMauro Carvalho Chehab      - ``type``
11554f38fcaSMauro Carvalho Chehab      - :cspan:`2` Type of the modulator, see :c:type:`v4l2_tuner_type`.
11654f38fcaSMauro Carvalho Chehab    * - __u32
11754f38fcaSMauro Carvalho Chehab      - ``reserved``\ [3]
11854f38fcaSMauro Carvalho Chehab      - Reserved for future extensions.
11954f38fcaSMauro Carvalho Chehab
12054f38fcaSMauro Carvalho Chehab	Drivers and applications must set the array to zero.
12154f38fcaSMauro Carvalho Chehab
122fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{6.0cm}|p{2.0cm}|p{9.3cm}|
123fea13a69SMauro Carvalho Chehab
124fea13a69SMauro Carvalho Chehab.. cssclass:: longtable
125fea13a69SMauro Carvalho Chehab
126*c4a1bff9SMauro Carvalho Chehab.. _modulator-txsubchans:
127*c4a1bff9SMauro Carvalho Chehab
12854f38fcaSMauro Carvalho Chehab.. flat-table:: Modulator Audio Transmission Flags
12954f38fcaSMauro Carvalho Chehab    :header-rows:  0
13054f38fcaSMauro Carvalho Chehab    :stub-columns: 0
13154f38fcaSMauro Carvalho Chehab    :widths:       3 1 4
13254f38fcaSMauro Carvalho Chehab
13354f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_MONO``
13454f38fcaSMauro Carvalho Chehab      - 0x0001
13554f38fcaSMauro Carvalho Chehab      - Modulate channel 1 as mono audio, when the input has more
13654f38fcaSMauro Carvalho Chehab	channels, a down-mix of channel 1 and 2. This flag does not
13754f38fcaSMauro Carvalho Chehab	combine with ``V4L2_TUNER_SUB_STEREO`` or
13854f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_LANG1``.
13954f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_STEREO``
14054f38fcaSMauro Carvalho Chehab      - 0x0002
14154f38fcaSMauro Carvalho Chehab      - Modulate channel 1 and 2 as left and right channel of a stereo
14254f38fcaSMauro Carvalho Chehab	audio signal. When the input has only one channel or two channels
14354f38fcaSMauro Carvalho Chehab	and ``V4L2_TUNER_SUB_SAP`` is also set, channel 1 is encoded as
14454f38fcaSMauro Carvalho Chehab	left and right channel. This flag does not combine with
14554f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_LANG1``. When the
14654f38fcaSMauro Carvalho Chehab	driver does not support stereo audio it shall fall back to mono.
14754f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_LANG1``
14854f38fcaSMauro Carvalho Chehab      - 0x0008
14954f38fcaSMauro Carvalho Chehab      - Modulate channel 1 and 2 as primary and secondary language of a
15054f38fcaSMauro Carvalho Chehab	bilingual audio signal. When the input has only one channel it is
15154f38fcaSMauro Carvalho Chehab	used for both languages. It is not possible to encode the primary
15254f38fcaSMauro Carvalho Chehab	or secondary language only. This flag does not combine with
15354f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_MONO``, ``V4L2_TUNER_SUB_STEREO`` or
15454f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_SAP``. If the hardware does not support the
15554f38fcaSMauro Carvalho Chehab	respective audio matrix, or the current video standard does not
15654f38fcaSMauro Carvalho Chehab	permit bilingual audio the :ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall
15754f38fcaSMauro Carvalho Chehab	return an ``EINVAL`` error code and the driver shall fall back to mono
15854f38fcaSMauro Carvalho Chehab	or stereo mode.
15954f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_LANG2``
16054f38fcaSMauro Carvalho Chehab      - 0x0004
16154f38fcaSMauro Carvalho Chehab      - Same effect as ``V4L2_TUNER_SUB_SAP``.
16254f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_SAP``
16354f38fcaSMauro Carvalho Chehab      - 0x0004
16454f38fcaSMauro Carvalho Chehab      - When combined with ``V4L2_TUNER_SUB_MONO`` the first channel is
16554f38fcaSMauro Carvalho Chehab	encoded as mono audio, the last channel as Second Audio Program.
16654f38fcaSMauro Carvalho Chehab	When the input has only one channel it is used for both audio
16754f38fcaSMauro Carvalho Chehab	tracks. When the input has three channels the mono track is a
16854f38fcaSMauro Carvalho Chehab	down-mix of channel 1 and 2. When combined with
16954f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_STEREO`` channel 1 and 2 are encoded as left and
17054f38fcaSMauro Carvalho Chehab	right stereo audio, channel 3 as Second Audio Program. When the
17154f38fcaSMauro Carvalho Chehab	input has only two channels, the first is encoded as left and
17254f38fcaSMauro Carvalho Chehab	right channel and the second as SAP. When the input has only one
17354f38fcaSMauro Carvalho Chehab	channel it is used for all audio tracks. It is not possible to
17454f38fcaSMauro Carvalho Chehab	encode a Second Audio Program only. This flag must combine with
17554f38fcaSMauro Carvalho Chehab	``V4L2_TUNER_SUB_MONO`` or ``V4L2_TUNER_SUB_STEREO``. If the
17654f38fcaSMauro Carvalho Chehab	hardware does not support the respective audio matrix, or the
17754f38fcaSMauro Carvalho Chehab	current video standard does not permit SAP the
17854f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl shall return an ``EINVAL`` error code and
17954f38fcaSMauro Carvalho Chehab	driver shall fall back to mono or stereo mode.
18054f38fcaSMauro Carvalho Chehab    * - ``V4L2_TUNER_SUB_RDS``
18154f38fcaSMauro Carvalho Chehab      - 0x0010
18254f38fcaSMauro Carvalho Chehab      - Enable the RDS encoder for a radio FM transmitter.
18354f38fcaSMauro Carvalho Chehab
18454f38fcaSMauro Carvalho ChehabReturn Value
18554f38fcaSMauro Carvalho Chehab============
18654f38fcaSMauro Carvalho Chehab
18754f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
18854f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
18954f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
19054f38fcaSMauro Carvalho Chehab
19154f38fcaSMauro Carvalho ChehabEINVAL
19254f38fcaSMauro Carvalho Chehab    The struct :c:type:`v4l2_modulator` ``index`` is
19354f38fcaSMauro Carvalho Chehab    out of bounds.
194