1*059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 254f38fcaSMauro Carvalho Chehab 354f38fcaSMauro Carvalho Chehab.. _tuner: 454f38fcaSMauro Carvalho Chehab 554f38fcaSMauro Carvalho Chehab********************* 654f38fcaSMauro Carvalho ChehabTuners and Modulators 754f38fcaSMauro Carvalho Chehab********************* 854f38fcaSMauro Carvalho Chehab 954f38fcaSMauro Carvalho Chehab 1054f38fcaSMauro Carvalho ChehabTuners 1154f38fcaSMauro Carvalho Chehab====== 1254f38fcaSMauro Carvalho Chehab 1354f38fcaSMauro Carvalho ChehabVideo input devices can have one or more tuners demodulating a RF 1454f38fcaSMauro Carvalho Chehabsignal. Each tuner is associated with one or more video inputs, 1554f38fcaSMauro Carvalho Chehabdepending on the number of RF connectors on the tuner. The ``type`` 1654f38fcaSMauro Carvalho Chehabfield of the respective struct :c:type:`v4l2_input` 1754f38fcaSMauro Carvalho Chehabreturned by the :ref:`VIDIOC_ENUMINPUT` ioctl is 1854f38fcaSMauro Carvalho Chehabset to ``V4L2_INPUT_TYPE_TUNER`` and its ``tuner`` field contains the 1954f38fcaSMauro Carvalho Chehabindex number of the tuner. 2054f38fcaSMauro Carvalho Chehab 2154f38fcaSMauro Carvalho ChehabRadio input devices have exactly one tuner with index zero, no video 2254f38fcaSMauro Carvalho Chehabinputs. 2354f38fcaSMauro Carvalho Chehab 2454f38fcaSMauro Carvalho ChehabTo query and change tuner properties applications use the 2554f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>` and 2654f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` ioctls, respectively. The 2754f38fcaSMauro Carvalho Chehabstruct :c:type:`v4l2_tuner` returned by :ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>` 2854f38fcaSMauro Carvalho Chehabalso contains signal status information applicable when the tuner of the 2954f38fcaSMauro Carvalho Chehabcurrent video or radio input is queried. 3054f38fcaSMauro Carvalho Chehab 3154f38fcaSMauro Carvalho Chehab.. note:: 3254f38fcaSMauro Carvalho Chehab 3354f38fcaSMauro Carvalho Chehab :ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` does not switch the 3454f38fcaSMauro Carvalho Chehab current tuner, when there is more than one. The tuner is solely 3554f38fcaSMauro Carvalho Chehab determined by the current video input. Drivers must support both ioctls 3654f38fcaSMauro Carvalho Chehab and set the ``V4L2_CAP_TUNER`` flag in the struct :c:type:`v4l2_capability` 3754f38fcaSMauro Carvalho Chehab returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the 3854f38fcaSMauro Carvalho Chehab device has one or more tuners. 3954f38fcaSMauro Carvalho Chehab 4054f38fcaSMauro Carvalho Chehab 4154f38fcaSMauro Carvalho ChehabModulators 4254f38fcaSMauro Carvalho Chehab========== 4354f38fcaSMauro Carvalho Chehab 4454f38fcaSMauro Carvalho ChehabVideo output devices can have one or more modulators, that modulate a 4554f38fcaSMauro Carvalho Chehabvideo signal for radiation or connection to the antenna input of a TV 4654f38fcaSMauro Carvalho Chehabset or video recorder. Each modulator is associated with one or more 4754f38fcaSMauro Carvalho Chehabvideo outputs, depending on the number of RF connectors on the 4854f38fcaSMauro Carvalho Chehabmodulator. The ``type`` field of the respective struct 4954f38fcaSMauro Carvalho Chehab:c:type:`v4l2_output` returned by the 5054f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_ENUMOUTPUT` ioctl is set to 5154f38fcaSMauro Carvalho Chehab``V4L2_OUTPUT_TYPE_MODULATOR`` and its ``modulator`` field contains the 5254f38fcaSMauro Carvalho Chehabindex number of the modulator. 5354f38fcaSMauro Carvalho Chehab 5454f38fcaSMauro Carvalho ChehabRadio output devices have exactly one modulator with index zero, no 5554f38fcaSMauro Carvalho Chehabvideo outputs. 5654f38fcaSMauro Carvalho Chehab 5754f38fcaSMauro Carvalho ChehabA video or radio device cannot support both a tuner and a modulator. Two 5854f38fcaSMauro Carvalho Chehabseparate device nodes will have to be used for such hardware, one that 5954f38fcaSMauro Carvalho Chehabsupports the tuner functionality and one that supports the modulator 6054f38fcaSMauro Carvalho Chehabfunctionality. The reason is a limitation with the 6154f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl where you 6254f38fcaSMauro Carvalho Chehabcannot specify whether the frequency is for a tuner or a modulator. 6354f38fcaSMauro Carvalho Chehab 6454f38fcaSMauro Carvalho ChehabTo query and change modulator properties applications use the 6554f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` and 6654f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Note that 6754f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` does not switch the current modulator, when there 6854f38fcaSMauro Carvalho Chehabis more than one at all. The modulator is solely determined by the 6954f38fcaSMauro Carvalho Chehabcurrent video output. Drivers must support both ioctls and set the 7054f38fcaSMauro Carvalho Chehab``V4L2_CAP_MODULATOR`` flag in the struct 7154f38fcaSMauro Carvalho Chehab:c:type:`v4l2_capability` returned by the 7254f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_QUERYCAP` ioctl when the device has 7354f38fcaSMauro Carvalho Chehabone or more modulators. 7454f38fcaSMauro Carvalho Chehab 7554f38fcaSMauro Carvalho Chehab 7654f38fcaSMauro Carvalho ChehabRadio Frequency 7754f38fcaSMauro Carvalho Chehab=============== 7854f38fcaSMauro Carvalho Chehab 7954f38fcaSMauro Carvalho ChehabTo get and set the tuner or modulator radio frequency applications use 8054f38fcaSMauro Carvalho Chehabthe :ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` and 8154f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl which both take 8254f38fcaSMauro Carvalho Chehaba pointer to a struct :c:type:`v4l2_frequency`. These 8354f38fcaSMauro Carvalho Chehabioctls are used for TV and radio devices alike. Drivers must support 8454f38fcaSMauro Carvalho Chehabboth ioctls when the tuner or modulator ioctls are supported, or when 8554f38fcaSMauro Carvalho Chehabthe device is a radio device. 86