1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun.. _tuner: 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun********************* 6*4882a593SmuzhiyunTuners and Modulators 7*4882a593Smuzhiyun********************* 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun 10*4882a593SmuzhiyunTuners 11*4882a593Smuzhiyun====== 12*4882a593Smuzhiyun 13*4882a593SmuzhiyunVideo input devices can have one or more tuners demodulating a RF 14*4882a593Smuzhiyunsignal. Each tuner is associated with one or more video inputs, 15*4882a593Smuzhiyundepending on the number of RF connectors on the tuner. The ``type`` 16*4882a593Smuzhiyunfield of the respective struct :c:type:`v4l2_input` 17*4882a593Smuzhiyunreturned by the :ref:`VIDIOC_ENUMINPUT` ioctl is 18*4882a593Smuzhiyunset to ``V4L2_INPUT_TYPE_TUNER`` and its ``tuner`` field contains the 19*4882a593Smuzhiyunindex number of the tuner. 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunRadio input devices have exactly one tuner with index zero, no video 22*4882a593Smuzhiyuninputs. 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunTo query and change tuner properties applications use the 25*4882a593Smuzhiyun:ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>` and 26*4882a593Smuzhiyun:ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` ioctls, respectively. The 27*4882a593Smuzhiyunstruct :c:type:`v4l2_tuner` returned by :ref:`VIDIOC_G_TUNER <VIDIOC_G_TUNER>` 28*4882a593Smuzhiyunalso contains signal status information applicable when the tuner of the 29*4882a593Smuzhiyuncurrent video or radio input is queried. 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun.. note:: 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun :ref:`VIDIOC_S_TUNER <VIDIOC_G_TUNER>` does not switch the 34*4882a593Smuzhiyun current tuner, when there is more than one. The tuner is solely 35*4882a593Smuzhiyun determined by the current video input. Drivers must support both ioctls 36*4882a593Smuzhiyun and set the ``V4L2_CAP_TUNER`` flag in the struct :c:type:`v4l2_capability` 37*4882a593Smuzhiyun returned by the :ref:`VIDIOC_QUERYCAP` ioctl when the 38*4882a593Smuzhiyun device has one or more tuners. 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunModulators 42*4882a593Smuzhiyun========== 43*4882a593Smuzhiyun 44*4882a593SmuzhiyunVideo output devices can have one or more modulators, that modulate a 45*4882a593Smuzhiyunvideo signal for radiation or connection to the antenna input of a TV 46*4882a593Smuzhiyunset or video recorder. Each modulator is associated with one or more 47*4882a593Smuzhiyunvideo outputs, depending on the number of RF connectors on the 48*4882a593Smuzhiyunmodulator. The ``type`` field of the respective struct 49*4882a593Smuzhiyun:c:type:`v4l2_output` returned by the 50*4882a593Smuzhiyun:ref:`VIDIOC_ENUMOUTPUT` ioctl is set to 51*4882a593Smuzhiyun``V4L2_OUTPUT_TYPE_MODULATOR`` and its ``modulator`` field contains the 52*4882a593Smuzhiyunindex number of the modulator. 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunRadio output devices have exactly one modulator with index zero, no 55*4882a593Smuzhiyunvideo outputs. 56*4882a593Smuzhiyun 57*4882a593SmuzhiyunA video or radio device cannot support both a tuner and a modulator. Two 58*4882a593Smuzhiyunseparate device nodes will have to be used for such hardware, one that 59*4882a593Smuzhiyunsupports the tuner functionality and one that supports the modulator 60*4882a593Smuzhiyunfunctionality. The reason is a limitation with the 61*4882a593Smuzhiyun:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl where you 62*4882a593Smuzhiyuncannot specify whether the frequency is for a tuner or a modulator. 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunTo query and change modulator properties applications use the 65*4882a593Smuzhiyun:ref:`VIDIOC_G_MODULATOR <VIDIOC_G_MODULATOR>` and 66*4882a593Smuzhiyun:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` ioctl. Note that 67*4882a593Smuzhiyun:ref:`VIDIOC_S_MODULATOR <VIDIOC_G_MODULATOR>` does not switch the current modulator, when there 68*4882a593Smuzhiyunis more than one at all. The modulator is solely determined by the 69*4882a593Smuzhiyuncurrent video output. Drivers must support both ioctls and set the 70*4882a593Smuzhiyun``V4L2_CAP_MODULATOR`` flag in the struct 71*4882a593Smuzhiyun:c:type:`v4l2_capability` returned by the 72*4882a593Smuzhiyun:ref:`VIDIOC_QUERYCAP` ioctl when the device has 73*4882a593Smuzhiyunone or more modulators. 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunRadio Frequency 77*4882a593Smuzhiyun=============== 78*4882a593Smuzhiyun 79*4882a593SmuzhiyunTo get and set the tuner or modulator radio frequency applications use 80*4882a593Smuzhiyunthe :ref:`VIDIOC_G_FREQUENCY <VIDIOC_G_FREQUENCY>` and 81*4882a593Smuzhiyun:ref:`VIDIOC_S_FREQUENCY <VIDIOC_G_FREQUENCY>` ioctl which both take 82*4882a593Smuzhiyuna pointer to a struct :c:type:`v4l2_frequency`. These 83*4882a593Smuzhiyunioctls are used for TV and radio devices alike. Drivers must support 84*4882a593Smuzhiyunboth ioctls when the tuner or modulator ioctls are supported, or when 85*4882a593Smuzhiyunthe device is a radio device. 86