SDR API set ADC and RF frequency
cover SDR API set ADC and RF frequency
Here is small example what it looks like when v4l2-ctl is used.
[crope@localhost v4l2-ctl]$
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --all Driver Info (not using libv4l2):
Driver name : rtl2832_sdr Card type : Realtek RTL2832U SDR Bus info : usb-0000:00:13.2-2 Driver version: 3.13.0 Capabilities : 0x85010001 Video Capture Tuner Read/Write Streaming Device Capabilities Device Caps : 0x05010001 Video Capture Tuner Read/Write Streaming Priority: 2 Frequency for tuner 0: 0 (0.000000 MHz) Tuner 0: Name : ADC Capabilities : 1 Hz freq-bands Frequency range : 0.300000 MHz - 3.200000 MHz
Video input : 0 (SDR data: ok)
User Controls
tuner_gain (int) : min=0 max=102 step=1 default=0 value=0 [crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --all Driver Info (not using libv4l2): Driver name : rtl2832_sdr Card type : Realtek RTL2832U SDR Bus info : usb-0000:00:13.2-2 Driver version: 3.13.0 Capabilities : 0x85010001 Video Capture Tuner Read/Write Streaming Device Capabilities Device Caps : 0x05010001 Video Capture Tuner Read/Write Streaming Priority: 2 Frequency for tuner 1: 0 (0.000000 MHz) Tuner 1: Name : RF Capabilities : 62.5 Hz freq-bands Frequency range : 50.000 MHz - 1500.000 MHz
Video input : 0 (SDR data: ok)
User Controls
tuner_gain (int) : min=0 max=102 step=1 default=0 value=0 (reverse-i-search)`en': gedit drivers/media/radio/radio-ke^Ce.c [crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --list-freq-bands ioctl: VIDIOC_ENUM_FREQ_BANDS Index : 0 Modulation : Unknown Capability : 1 Hz freq-bands
Frequency Range: 0.300000 MHz - 0.300000 MHz
Index : 1
Modulation : Unknown
Capability : 1 Hz freq-bands
Frequency Range: 0.900001 MHz - 2.800000 MHz
Index : 2
Modulation : Unknown
Capability : 1 Hz freq-bands
Frequency Range: 3.200000 MHz - 3.200000 MHz
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --list-freq-bands
ioctl: VIDIOC_ENUM_FREQ_BANDS
Index : 0 Modulation : Unknown Capability : 62.5 Hz freq-bands Frequency Range: 50.000 MHz - 1500.000 MHz
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --set-freq=0.300000 Frequency for tuner 0 set to 300000 (0.300000 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --get-freq Frequency for tuner 0: 300000 (0.300000 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --set-freq=100 Frequency for tuner 1 set to 1600000 (100.000000 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --get-freq Frequency for tuner 1: 1600000 (100.000000 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --all Driver Info (not using libv4l2):
Driver name : rtl2832_sdr Card type : Realtek RTL2832U SDR Bus info : usb-0000:00:13.2-2 Driver version: 3.13.0 Capabilities : 0x85010001 Video Capture Tuner Read/Write Streaming Device Capabilities Device Caps : 0x05010001 Video Capture Tuner Read/Write Streaming Priority: 2 Frequency for tuner 1: 1600000 (100.000000 MHz) Tuner 1: Name : RF Capabilities : 62.5 Hz freq-bands Frequency range : 50.000 MHz - 1500.000 MHz
Video input : 0 (SDR data: ok)
User Controls
tuner_gain (int) : min=0 max=102 step=1 default=0 value=0 [crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --all Driver Info (not using libv4l2): Driver name : rtl2832_sdr Card type : Realtek RTL2832U SDR Bus info : usb-0000:00:13.2-2 Driver version: 3.13.0 Capabilities : 0x85010001 Video Capture Tuner Read/Write Streaming Device Capabilities Device Caps : 0x05010001 Video Capture Tuner Read/Write Streaming Priority: 2 Frequency for tuner 0: 300000 (0.300000 MHz) Tuner 0: Name : ADC Capabilities : 1 Hz freq-bands Frequency range : 0.300000 MHz - 3.200000 MHz
Video input : 0 (SDR data: ok)
User Controls
tuner_gain (int) : min=0 max=102 step=1 default=0 value=0
[crope@localhost v4l2-ctl]$
Antti Palosaari (4):
v4l2-core: don't clear VIDIOC_G_FREQUENCY tuner type
v4l2: add new device type for Software Defined Radio
v4l: add new tuner types for SDR
v4l: 1 Hz resolution flag for tuners
drivers/media/v4l2-core/v4l2-dev.c | 5 +++++ drivers/media/v4l2-core/v4l2-ioctl.c | 40 +++++++++++++++++++++++++----------- include/media/v4l2-dev.h | 3 ++- include/uapi/linux/videodev2.h | 3 +++ 4 files changed, 38 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.4.2
RFC PATCH 1/4 v4l2-core: don't clear VIDIOC_G_FREQUENCY tuner type
No need to clear as it will be overridden in every case when v4l_g_frequency() is called. We will need that value later when new tuner types are defined.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -1
@@ -2013,7 +2013,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {IOCTL_INFO_STD (VIDIOC_S_AUDOUT , vidioc_s_audout, v4l_print_audioout,INFO_FL_PRIO ),IOCTL_INFO_FNC (VIDIOC_G_MODULATOR , v4l_g_modulator, v4l_print_modulator,INFO_FL_CLEAR (v4l2_modulator, index)),IOCTL_INFO_STD (VIDIOC_S_MODULATOR , vidioc_s_modulator, v4l_print_modulator,INFO_FL_PRIO ), -IOCTL_INFO_FNC (VIDIOC_G_FREQUENCY , v4l_g_frequency, v4l_print_frequency,INFO_FL_CLEAR (v4l2_frequency, tuner)), +IOCTL_INFO_FNC (VIDIOC_G_FREQUENCY , v4l_g_frequency, v4l_print_frequency,INFO_FL_CLEAR (v4l2_frequency, type)),IOCTL_INFO_FNC (VIDIOC_S_FREQUENCY , v4l_s_frequency, v4l_print_frequency,INFO_FL_PRIO ),IOCTL_INFO_FNC (VIDIOC_CROPCAP , v4l_cropcap, v4l_print_cropcap,INFO_FL_CLEAR (v4l2_cropcap, type)), IOCTL_INFO_FNC(VIDIOC_G_CROP, v4l_g_crop, v4l_print_crop, INFO_FL_CLEAR(v4l2_crop, type)),
Signature · 1 line
1.8.4.2
RFC PATCH 2/4 v4l2: add new device type for Software Defined Radio
In reply to Antti PalosaariAdd new V4L device type VFL_TYPE_SDR for Software Defined Radio. It is registered as /dev/sdr0
--- drivers/media/v4l2-core/v4l2-dev.c | 5 +++++ include/media/v4l2-dev.h | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-dev.c +5 -0
@@ -767,6 +767,8 @@ static void determine_valid_ioctls(struct video_device *vdev)* %VFL_TYPE_RADIO - A radio card * * %VFL_TYPE_SUBDEV - A subdevice +* +* %VFL_TYPE_SDR - Software Defined Radio */ int __video_register_device (struct video_device *vdev,int type,int nr,int warn_if_nr_in_use,struct module *owner)
@@ -806,6 +808,9 @@ int __video_register_device(struct video_device *vdev, int type, int nr,case VFL_TYPE_SUBDEV : name_base ="v4l-subdev" ;break ; +case VFL_TYPE_SDR : + name_base ="sdr" ; +break ;default :printk (KERN_ERR "%s called with unknown type: %d\n" , __func__, type);
include/media/v4l2-dev.h +2 -1
@@ -24,7 +24,8 @@#define VFL_TYPE_VBI 1#define VFL_TYPE_RADIO 2#define VFL_TYPE_SUBDEV 3 -#define VFL_TYPE_MAX 4 +#define VFL_TYPE_SDR 4 +#define VFL_TYPE_MAX 5/* Is this a receiver, transmitter or mem-to-mem? */ /* Ignored for VFL_TYPE_SUBDEV. */
Signature · 1 line
1.8.4.2
RFC PATCH 3/4 v4l: add new tuner types for SDR
In reply to Antti PalosaariDefine tuner types V4L2_TUNER_ADC and V4L2_TUNER_SDR for SDR usage.
ADC is used for setting sampling rate (sampling frequency) to SDR device.
Another tuner type, SDR, is possible RF tuner. Is is used to down-convert RF frequency to range ADC could sample. It is optional for SDR device.
Also add checks to VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY and VIDIOC_ENUM_FREQ_BANDS only allow these two tuner types when device type is SDR (VFL_TYPE_SDR).
--- drivers/media/v4l2-core/v4l2-ioctl.c | 38 +++++++++++++++++++++++++----------- include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 29 insertions(+), 11 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +27 -11
@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops,struct video_device *vfd =video_devdata (file);struct v4l2_frequency *p = arg; - p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + }else { + p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; + }return ops->vidioc_g_frequency (file, fh, p); }
@@ -1300,10 +1305,16 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops,const struct v4l2_frequency *p = arg;enum v4l2_tuner_type type; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; -if (p->type != type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }return ops->vidioc_s_frequency (file, fh, p); }
@@ -1882,11 +1893,16 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,enum v4l2_tuner_type type;int err; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; - -if (type != p->type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }if (ops->vidioc_enum_freq_bands)return ops->vidioc_enum_freq_bands (file, fh, p);if (is_valid_ioctl (vfd,VIDIOC_G_TUNER )) {
include/uapi/linux/videodev2.h +2 -0
@@ -159,6 +159,8 @@ enum v4l2_tuner_type {V4L2_TUNER_RADIO =1 ,V4L2_TUNER_ANALOG_TV =2 ,V4L2_TUNER_DIGITAL_TV =3 , +V4L2_TUNER_ADC =4 , + V4L2_TUNER_SDR = 5, }; enum v4l2_memory {
Signature · 1 line
1.8.4.2
Re: [PATCH RFC 3/4] v4l: add new tuner types for SDR
Quoted 5 lines · Antti Palosaari
Define tuner types
V4L2_TUNER_ADCandV4L2_TUNER_SDRfor SDR usage.ADC is used for setting sampling rate (sampling frequency) to SDR device.
Quoted 7 lines
Another tuner type, SDR, is possible RF tuner. Is is used to down-convert RF frequency to range ADC could sample. It is optional for SDR device.
Also add checks to
VIDIOC_G_FREQUENCY,VIDIOC_S_FREQUENCYandVIDIOC_ENUM_FREQ_BANDSonly allow these two tuner types when device type is SDR (VFL_TYPE_SDR).
Shouldn't you also adapt s_hw_freq_seek?
Quoted 12 lines
Signed-off-by Antti Palosaari <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 38 +++++++++++++++++++++++++----------- include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 29 insertions(+), 11 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0
drivers/media/v4l2-core/v4l2-ioctl.c static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops, · line 1293
Quoted 8 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-2@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops,struct video_device *vfd =video_devdata (file);struct v4l2_frequency *p = arg; - p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ;
This isn't right. p->type is returned by the driver, not set by the user. In the case of TYPE_SDR I would just set it to TUNER_SDR and let the driver update it for ADC tuners. You can also just leave it alone. This does make the assumption that SDR and ADC tuners are always separate tuners. I.e., not like radio and TV tuners that can be one physical tuner with two mutually exclusive modes. It's my understanding that that is by definition true for SDR.
Quoted 56 lines
drivers/media/v4l2-core/v4l2-ioctl.c +24
-9+ }else { + p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; + }return ops->vidioc_g_frequency (file, fh, p); }@@ -1300,10 +1305,16 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops,const struct v4l2_frequency *p = arg;enum v4l2_tuner_type type; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; -if (p->type != type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }return ops->vidioc_s_frequency (file, fh, p); }@@ -1882,11 +1893,16 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,enum v4l2_tuner_type type;int err; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; - -if (type != p->type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }if (ops->vidioc_enum_freq_bands)return ops->vidioc_enum_freq_bands (file, fh, p);if (is_valid_ioctl (vfd,VIDIOC_G_TUNER )) {include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h enum v4l2_tuner_type { · line 166
Quoted 8 lines
include/uapi/linux/videodev2.h +2
-0@@ -159,6 +159,8 @@ enum v4l2_tuner_type {V4L2_TUNER_RADIO =1 ,V4L2_TUNER_ANALOG_TV =2 ,V4L2_TUNER_DIGITAL_TV =3 , +V4L2_TUNER_ADC =4 , + V4L2_TUNER_SDR = 5, }; enum v4l2_memory {
Regards,
Hans
Re: [PATCH RFC 3/4] v4l: add new tuner types for SDR
Quoted 10 lines · Hans Verkuil
Quoted 9 lines · Antti Palosaari
Define tuner types
V4L2_TUNER_ADCandV4L2_TUNER_SDRfor SDR usage.ADC is used for setting sampling rate (sampling frequency) to SDR device.
Another tuner type, SDR, is possible RF tuner. Is is used to down-convert RF frequency to range ADC could sample. It is optional for SDR device.
Quoted 5 lines
Quoted 3 lines
Also add checks to
VIDIOC_G_FREQUENCY,VIDIOC_S_FREQUENCYandVIDIOC_ENUM_FREQ_BANDSonly allow these two tuner types when device type is SDR (VFL_TYPE_SDR).Shouldn't you also adapt
s_hw_freq_seek?
nope! I don't see how SDR could do hardware seek as demodulator is needed to make decision if radio channel is valid or not. On SDR receiver that demodulator is implemented by application software, DSP, thus name software defined radio.
Maybe it could be mapped to signal strength measurement, but it is another story to think.
Quoted 14 lines
Quoted 14 lines
Signed-off-by Antti Palosaari <[email protected]>--- drivers/media/v4l2-core/v4l2-ioctl.c | 38 +++++++++++++++++++++++++----------- include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 29 insertions(+), 11 deletions(-)drivers/media/v4l2-core/v4l2-ioctl.c +0
-0@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops,struct video_device *vfd =video_devdata (file);struct v4l2_frequency *p = arg;
Quoted 13 lines
drivers/media/v4l2-core/v4l2-ioctl.c static int v4l_g_frequency(const struct v4l2_ioctl_ops *ops, · line 1293
Quoted 5 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-2- p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ;This isn't right.
p->typeis returned by the driver, not set by the user. In the case ofTYPE_SDRI would just set it toTUNER_SDRand let the driver update it for ADC tuners. You can also just leave it alone. This does make the assumption that SDR and ADC tuners are always separate tuners. I.e., not like radio and TV tuners that can be one physical tuner with two mutually exclusive modes. It's my understanding that that is by definition true for SDR.
Aaah, so it is possible to use same tuner and that type is aimed for selecting tuner operation mode. Makes sense.
So if I now understand V4L2 driver model correctly, there should be one tuner that implements different functionality by using tuner type field.
I could change it easily, no problem.
Quoted 62 lines
Quoted 62 lines
drivers/media/v4l2-core/v4l2-ioctl.c +24
-9+ }else { + p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; + }return ops->vidioc_g_frequency (file, fh, p); }@@ -1300,10 +1305,16 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops *ops,const struct v4l2_frequency *p = arg;enum v4l2_tuner_type type; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; -if (p->type != type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }return ops->vidioc_s_frequency (file, fh, p); }@@ -1882,11 +1893,16 @@ static int v4l_enum_freq_bands(const struct v4l2_ioctl_ops *ops,enum v4l2_tuner_type type;int err; - type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; - -if (type != p->type) -return -EINVAL ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ; + type = p->type; + }else { + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? +V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (type != p->type) +return -EINVAL ; + }if (ops->vidioc_enum_freq_bands)return ops->vidioc_enum_freq_bands (file, fh, p);if (is_valid_ioctl (vfd,VIDIOC_G_TUNER )) {include/uapi/linux/videodev2.h +2
-0@@ -159,6 +159,8 @@ enum v4l2_tuner_type {V4L2_TUNER_RADIO =1 ,V4L2_TUNER_ANALOG_TV =2 ,V4L2_TUNER_DIGITAL_TV =3 , +V4L2_TUNER_ADC =4 , + V4L2_TUNER_SDR = 5, };
Quoted 7 lines
include/uapi/linux/videodev2.h enum v4l2_tuner_type { · line 166
Quoted 2 lines
include/uapi/linux/videodev2.h +0
-0enum v4l2_memory {Regards,
Hans
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC 3/4] v4l: add new tuner types for SDR
Quoted 31 lines · Antti Palosaari
Quoted 21 lines · Hans Verkuil
Quoted 6 lines · Antti Palosaari
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static int v4l_g_frequency(const struct · line 1294
Quoted 9 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-2@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const structv4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file);struct v4l2_frequency *p = arg; - p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ;This isn't right.
p->typeis returned by the driver, not set by the user. In the case ofTYPE_SDRI would just set it toTUNER_SDRand let the driverQuoted 8 lines
update it for ADC tuners. You can also just leave it alone. This does make
the assumption that SDR and ADC tuners are always separate tuners. I.e., not
like radio and TV tuners that can be one physical tuner with two mutually exclusive modes. It's my understanding that that is by definition true for
SDR.
Quoted 7 lines
Aaah, so it is possible to use same tuner and that type is aimed for selecting tuner operation mode. Makes sense.
So if I now understand V4L2 driver model correctly, there should be one tuner that implements different functionality by using tuner type field.
I could change it easily, no problem.
http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-frequency
I still don't understand that. Why both index and type should be defined for VIDIOC_S_FREQUENCY, but the opposite command VIDIOC_G_FREQUENCY requires only index and returns type too? It does not sound correct behavior. If S_FREQUENCY/G_FREQUENCY should be able to handle multiple tuner types for same tuner index, then type must be also given that driver could detect required mode.
http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-tuner
How I can enumerate tuners. There is G_TUNER/S_TUNER for enumerating, but documentation of these IOCTLs looks like only one tuner type per tuner index is supported. That offers enumeration per tuner index.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC 3/4] v4l: add new tuner types for SDR
Quoted 49 lines · Antti Palosaari
Quoted 31 lines · Antti Palosaari
Quoted 21 lines · Hans Verkuil
Quoted 6 lines · Antti Palosaari
drivers/media/v4l2-core/v4l2-ioctl.c +0
-0drivers/media/v4l2-core/v4l2-ioctl.c static int v4l_g_frequency(const struct · line 1294
Quoted 9 lines
drivers/media/v4l2-core/v4l2-ioctl.c +3
-2@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const structv4l2_ioctl_ops *ops, struct video_device *vfd = video_devdata(file);struct v4l2_frequency *p = arg; - p->type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ? -V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ; +if (vfd->vfl_type ==VFL_TYPE_SDR ) { +if (p->type !=V4L2_TUNER_ADC && p->type !=V4L2_TUNER_SDR ) +return -EINVAL ;This isn't right.
p->typeis returned by the driver, not set by the user. In the case ofTYPE_SDRI would just set it toTUNER_SDRand let the driverQuoted 8 lines
update it for ADC tuners. You can also just leave it alone. This does make
the assumption that SDR and ADC tuners are always separate tuners. I.e., not
like radio and TV tuners that can be one physical tuner with two mutually exclusive modes. It's my understanding that that is by definition true for
SDR.Quoted 7 lines
Aaah, so it is possible to use same tuner and that type is aimed for selecting tuner operation mode. Makes sense.
So if I now understand V4L2 driver model correctly, there should be one tuner that implements different functionality by using tuner type field.
I could change it easily, no problem.
http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-frequency
I still don't understand that. Why both index and type should be defined forVIDIOC_S_FREQUENCY, but the opposite commandVIDIOC_G_FREQUENCYrequires only index and returns type too? It does not sound correct behavior.
If S_FREQUENCY/G_FREQUENCY should be able to handle multiple tuner types for same tuner index, then type must be also given that driver could detect required mode.
Quoted 4 lines
http://hverkuil.home.xs4all.nl/spec/media.html#vidioc-g-tuner
How I can enumerate tuners. There is G_TUNER/S_TUNER for enumerating, but documentation of these IOCTLs looks like only one tuner type per tuner index is supported. That offers enumeration per tuner index.
I can imagine it is confusing. According to the spec the ENUM_FREQ_BANDS, S_HW_FREQ_SEEK and S_FREQUENCY ioctls all require the type field to be set by the user before calling, but G_FREQUENCY and G/S_TUNER do not. And the G/S_MODULATOR ioctls do not use a type field at all.
Frankly, I consider this a bug in the API. All of these ioctls should have required that userspace sets the type field.
The idea behind the original API design was that a tuner can be in either radio or TV mode, and that's determined by the type. The only ioctl that can change the tuner mode is S_FREQUENCY where the type tells the tuner whether to select radio or TV mode. Note that originally it didn't matter whether S_FREQ was called on a radio or a video node, it was the type field that determined the tuner mode, not the node it was called on. At least, that was the theory.
In practice drivers often didn't check the type field and instead depended on whether the ioctl came from a radio or a video node. Applications certainly never mixed radio and video nodes. Also, calling e.g. S_STD would also switch the tuner mode back to the TV mode, requiring drivers to keep track of the last used radio and TV frequencies, to be restored when switching back and forth between radio and TV mode. Frankly, the tuner type handling was a major nightmare and few drivers handled it correctly.
The practical result of all this was that, even though an internal tuner could operate in either TV or radio mode, from the outside world it would look as two separate tuners. So calling G_FREQ from a radio node gives back the last set radio frequency and from a video node the last set TV frequency, regardless of the actual tuner mode. Ditto for G/S_TUNER: if the tuner is in the wrong mode, the tuner data is just faked.
So the tuner type now depends on the device node that is used: it does not have to be set by userspace (except for those ioctls where the spec explicitly requires it) but it is filled in by the core based on the device node used.
This scheme works fine as long as each tuner has either only one mode or the mode can be deduced from the device node used to access it.
If we ever get tuners with multiple modes that can all be used from the same device node, then we have a problem.
My understanding from your SDR proposal is that this doesn't happen:
you have only one or two tuners, and each tuner has only one mode.
I hope this helps instead of confusing you even more :-)
Regards,
Hans
Re: [PATCH RFC 3/4] v4l: add new tuner types for SDR
In reply to Antti PalosaariQuoted 17 lines · Antti Palosaari
Quoted 10 lines · Hans Verkuil
Quoted 9 lines · Antti Palosaari
Define tuner types
V4L2_TUNER_ADCandV4L2_TUNER_SDRfor SDR usage.ADC is used for setting sampling rate (sampling frequency) to SDR device.
Another tuner type, SDR, is possible RF tuner. Is is used to down-convert RF frequency to range ADC could sample. It is optional for SDR device.
Quoted 5 lines
Quoted 3 lines
Also add checks to
VIDIOC_G_FREQUENCY,VIDIOC_S_FREQUENCYandVIDIOC_ENUM_FREQ_BANDSonly allow these two tuner types when device type is SDR (VFL_TYPE_SDR).Shouldn't you also adapt
s_hw_freq_seek?
Quoted 7 lines
nope! I don't see how SDR could do hardware seek as demodulator is needed to make decision if radio channel is valid or not. On SDR receiver that demodulator is implemented by application software, DSP, thus name software defined radio.
Maybe it could be mapped to signal strength measurement, but it is another story to think.
Fair enough, but in that case I would add:
/* s_hw_freq_seek is not supported for SDR for now */ if (vfd->vfl_type == VFL_TYPE_SDR) return -EINVAL;
at the beginning of v4l_s_hw_freq_seek().
Regards,
Hans
RFC PATCH 4/4 v4l: 1 Hz resolution flag for tuners
In reply to Antti PalosaariAdd V4L2_TUNER_CAP_1HZ for 1 Hz resolution.
--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)
include/uapi/linux/videodev2.h +1 -0
@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001
Signature · 1 line
1.8.4.2
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Quoted 13 lines · Antti Palosaari
Add
V4L2_TUNER_CAP_1HZfor 1 Hz resolution.Signed-off-by Antti Palosaari <[email protected]>--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_modulator { · line 1355
Quoted 7 lines
include/uapi/linux/videodev2.h +1
-0@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001
I was wondering, do the band modulation systems (V4L2_BAND_MODULATION_VSB etc.) cover SDR?
Anyway, I'm happy with this patch series. As far as I am concerned, the next step would be to add documention and I would also recommend updating v4l2-compliance. Writing docs and adding compliance tests has proven useful in the past to discover ambiguous API specs.
Regards,
Hans
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Hi Hans!
Quoted 18 lines · Hans Verkuil
Quoted 17 lines · Antti Palosaari
Add
V4L2_TUNER_CAP_1HZfor 1 Hz resolution.Signed-off-by Antti Palosaari <[email protected]>--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/videodev2.h +1
-0@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000
Quoted 5 lines
include/uapi/linux/videodev2.h struct v4l2_modulator { · line 1355
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001I was wondering, do the band modulation systems (
V4L2_BAND_MODULATION_VSBetc.) cover SDR?
There is no such modulations defined for SDR hardware level. SDR demodulation is done by software called DSP (digital signal processing) in host computer.
In ideal case, SDR receiver has only 1 property: ADC (analog to digital converter) sampling rate.
But as digital signal processing is very CPU intensive when sampling rates are increased, there is very often RF tuner used to down-convert actual radio frequency to low-IF / BB. Then ADC is used to sample that baseband / low-IF signal and only small sampling rate is needed => stream is smaller => DSP does not need so much CPU.
Quoted 3 lines
Anyway, I'm happy with this patch series. As far as I am concerned, the next step would be to add documention and I would also recommend updating v4l2-compliance. Writing docs and adding compliance tests has proven useful in the past to discover ambiguous API specs.
I will do these at finally when I drivers and applications are tested to be working.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Quoted 27 lines · Antti Palosaari
Hi Hans!
Quoted 18 lines · Hans Verkuil
Quoted 17 lines · Antti Palosaari
Add
V4L2_TUNER_CAP_1HZfor 1 Hz resolution.Signed-off-by Antti Palosaari <[email protected]>--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/videodev2.h +1
-0@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000Quoted 5 lines
include/uapi/linux/videodev2.h struct v4l2_modulator { · line 1355
Quoted 3 lines
include/uapi/linux/videodev2.h +0
-0/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001I was wondering, do the band modulation systems (
V4L2_BAND_MODULATION_VSBetc.) cover SDR?
Quoted 6 lines
There is no such modulations defined for SDR hardware level. SDR demodulation is done by software called DSP (digital signal processing) in host computer.
In ideal case, SDR receiver has only 1 property: ADC (analog to digital converter) sampling rate.
So in that case the band modulation would be 0, right?
Quoted 6 lines
But as digital signal processing is very CPU intensive when sampling rates are increased, there is very often RF tuner used to down-convert actual radio frequency to low-IF / BB. Then ADC is used to sample that baseband / low-IF signal and only small sampling rate is needed => stream is smaller => DSP does not need so much CPU.
How does the application know that there is an RF tuner? I assume that the app needs to know this?
As you can probably tell, I basically know nothing about SDR, so forgive me if I am asking stupid questions. I just want to make sure all bases are covered when it comes to the V4L2 API.
Regards,
Hans
Quoted 10 lines
Quoted 3 lines
Anyway, I'm happy with this patch series. As far as I am concerned, the next step would be to add documention and I would also recommend updating v4l2-compliance. Writing docs and adding compliance tests has proven useful in the past to discover ambiguous API specs.
I will do these at finally when I drivers and applications are tested to be working.
regards
Antti
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Quoted 28 lines · Hans Verkuil
Quoted 27 lines · Antti Palosaari
Hi Hans!
Quoted 23 lines · Hans Verkuil
Quoted 13 lines · Antti Palosaari
Add
V4L2_TUNER_CAP_1HZfor 1 Hz resolution.Signed-off-by Antti Palosaari <[email protected]>--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/videodev2.h +0
-0include/uapi/linux/videodev2.h struct v4l2_modulator { · line 1355
Quoted 7 lines
include/uapi/linux/videodev2.h +1
-0@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001I was wondering, do the band modulation systems (
V4L2_BAND_MODULATION_VSBetc.) cover SDR?
Quoted 8 lines
Quoted 6 lines
There is no such modulations defined for SDR hardware level. SDR demodulation is done by software called DSP (digital signal processing) in host computer.
In ideal case, SDR receiver has only 1 property: ADC (analog to digital converter) sampling rate.
So in that case the band modulation would be 0, right?
Yes. If you split that radio receiver to some logic blocs, from antenna to host computer:
1. Antenna is here
2. RF tuner (RF frontend): tuner "band" belongs here
3. ADC: sampling rate
4. demodulator (modulation lives here)
In a case of traditional hw based demodulator PC/host computer is located as a number 5. In a case of a software defined radio receiver host computer is next to ADC, between 3-4. Demodulator itself is DSP software running on host computer.
Quoted 8 lines
Quoted 5 lines
But as digital signal processing is very CPU intensive when sampling rates are increased, there is very often RF tuner used to down-convert actual radio frequency to low-IF / BB. Then ADC is used to sample that baseband / low-IF signal and only small sampling rate is needed => stream is smaller => DSP does not need so much CPU.
How does the application know that there is an RF tuner? I assume that the app needs to know this?
Yes, that indeed needs to be know. It is one key issue to resolve. Something like a capability flag works or application could test it when. Like if tuner type is "ADC" then enumerate if there is tuner type "SDR" also. Or expect there is always RF tuner and frequency is programmed as a 0 Hz when it is not really there. Enumeration of RF tuner returns only supported frequency as a 0Hz to tell there is only ADC.
Quoted 3 lines
As you can probably tell, I basically know nothing about SDR, so forgive me if I am asking stupid questions. I just want to make sure all bases are covered when it comes to the V4L2 API.
I really appreciate that as simply has no enough knowledge from V4L2 API and API changes are needed. I will try to list here shortly some SDR devices in general level enough.
ant = antenna
host = host computer, PC (SW modulator/demodulator) ADC = analog to digital converter
DAC = digital to analog converter
amp = amplifier
mixer = "TX tuner"
receiver:
ant <> RF tuner <> ADC <> bridge <> host
ant <>ADC <> bridge <> host
ant <> up-converter <> RF tuner <> ADC <> bridge <> host
transmitter:
ant <> amp <> mixer <> DAC <> bridge <> host
ant <> mixer <> DAC <> bridge <> host
ant <> DAC <> bridge <> host
Those are the used building blocks in some general view. ADC (DAC) is most important hardware block, but RF tuner is also critical in practice.
So what I understood, V4L2 API "tuner" is kinda logical entity that represent single radio device, containing RF tuner, demodulator and so. That same logical entity in DVB API side is frontend, which is mostly implemented by demodulator with a help of RF tuner.
So what is needed is to make V4L2 API entity (tuner I guess) that could represent both ADC and RF tuner.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Quoted 57 lines · Antti Palosaari
Quoted 28 lines · Hans Verkuil
Quoted 27 lines · Antti Palosaari
Hi Hans!
Quoted 23 lines · Hans Verkuil
Quoted 13 lines · Antti Palosaari
Add
V4L2_TUNER_CAP_1HZfor 1 Hz resolution.Signed-off-by Antti Palosaari <[email protected]>--- include/uapi/linux/videodev2.h | 1 + 1 file changed, 1 insertion(+)include/uapi/linux/videodev2.h +0
-0include/uapi/linux/videodev2.h struct v4l2_modulator { · line 1355
Quoted 7 lines
include/uapi/linux/videodev2.h +1
-0@@ -1349,6 +1349,7 @@ struct v4l2_modulator {#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800 +#define V4L2_TUNER_CAP_1HZ 0x1000/* Flags for the 'rxsubchans' field */ #define V4L2_TUNER_SUB_MONO 0x0001I was wondering, do the band modulation systems (
V4L2_BAND_MODULATION_VSBetc.) cover SDR?Quoted 8 lines
Quoted 6 lines
There is no such modulations defined for SDR hardware level. SDR demodulation is done by software called DSP (digital signal processing) in host computer.
In ideal case, SDR receiver has only 1 property: ADC (analog to digital converter) sampling rate.
So in that case the band modulation would be 0, right?
Yes. If you split that radio receiver to some logic blocs, from antenna to host computer:
1. Antenna is here
2. RF tuner (RF frontend): tuner "band" belongs here
3. ADC: sampling rate
4. demodulator (modulation lives here)In a case of traditional hw based demodulator PC/host computer is located as a number 5. In a case of a software defined radio receiver host computer is next to ADC, between 3-4. Demodulator itself is DSP software running on host computer.
Quoted 6 lines
Quoted 5 lines
But as digital signal processing is very CPU intensive when sampling rates are increased, there is very often RF tuner used to down-convert actual radio frequency to low-IF / BB. Then ADC is used to sample that baseband / low-IF signal and only small sampling rate is needed => stream is smaller => DSP does not need so much CPU.
Quoted 7 lines
Quoted 2 lines
How does the application know that there is an RF tuner? I assume that the app needs to know this?
Yes, that indeed needs to be know. It is one key issue to resolve. Something like a capability flag works or application could test it when. Like if tuner type is "ADC" then enumerate if there is tuner type "SDR" also.
Instead of calling it TUNER_TYPE_SDR, shouldn't it be called TUNER_TYPE_RF? Or perhaps _SDR_RF?
Quoted 3 lines
Or expect there is always RF tuner and frequency is
programmed as a 0 Hz when it is not really there. Enumeration of RF tuner returns only supported frequency as a 0Hz to tell there is only ADC.
I think just enumerating tuners to see if there is a RF tuner would be sufficient.
Quoted 30 lines
Quoted 5 lines
As you can probably tell, I basically know nothing about SDR, so forgive me if I am asking stupid questions. I just want to make sure all bases are covered when it comes to the V4L2 API.
I really appreciate that as simply has no enough knowledge from V4L2 API and API changes are needed. I will try to list here shortly some SDR devices in general level enough.
ant = antenna
host = host computer, PC (SW modulator/demodulator) ADC = analog to digital converter
DAC = digital to analog converter
amp = amplifier
mixer = "TX tuner"receiver:
ant <> RF tuner <> ADC <> bridge <> host
ant <>ADC <> bridge <> host
ant <> up-converter <> RF tuner <> ADC <> bridge <> hosttransmitter:
ant <> amp <> mixer <> DAC <> bridge <> host
ant <> mixer <> DAC <> bridge <> host
ant <> DAC <> bridge <> hostThose are the used building blocks in some general view. ADC (DAC) is most important hardware block, but RF tuner is also critical in practice.
Quoted 7 lines
So what I understood, V4L2 API "tuner" is kinda logical entity that represent single radio device, containing RF tuner, demodulator and so. That same logical entity in DVB API side is frontend, which is mostly implemented by demodulator with a help of RF tuner.
So what is needed is to make V4L2 API entity (tuner I guess) that could represent both ADC and RF tuner.
Well, a V4L2 tuner represents the hardware that requires a frequency. Which for typical radio and TV devices means the RF tuner + demodulator combo. So externally you see only one tuner, but internally there are often two devices (tuner and modulator) that have to be controlled.
For SDR you have an RF Tuner with a frequency and an ADC with a frequency, and the two frequencies can be set independently. So representing that as two tuners seems like a sensible mapping to me.
Regards,
Hans
Re: [PATCH RFC 4/4] v4l: 1 Hz resolution flag for tuners
Quoted 36 lines · Hans Verkuil
Quoted 27 lines · Antti Palosaari
Quoted 1 line · Hans Verkuil
On 12/12/2013 06:22 PM, Antti Palosaari wrote:
I really appreciate that as simply has no enough knowledge from V4L2 API and API changes are needed. I will try to list here shortly some SDR devices in general level enough.
ant = antenna
host = host computer, PC (SW modulator/demodulator) ADC = analog to digital converter
DAC = digital to analog converter
amp = amplifier
mixer = "TX tuner"receiver:
ant <> RF tuner <> ADC <> bridge <> host
ant <>ADC <> bridge <> host
ant <> up-converter <> RF tuner <> ADC <> bridge <> hosttransmitter:
ant <> amp <> mixer <> DAC <> bridge <> host
ant <> mixer <> DAC <> bridge <> host
ant <> DAC <> bridge <> hostThose are the used building blocks in some general view. ADC (DAC) is most important hardware block, but RF tuner is also critical in practice.
Quoted 7 lines
So what I understood, V4L2 API "tuner" is kinda logical entity that represent single radio device, containing RF tuner, demodulator and so. That same logical entity in DVB API side is frontend, which is mostly implemented by demodulator with a help of RF tuner.
So what is needed is to make V4L2 API entity (tuner I guess) that could represent both ADC and RF tuner.
Quoted 8 lines
Well, a V4L2 tuner represents the hardware that requires a frequency. Which for typical radio and TV devices means the RF tuner + demodulator combo. So externally you see only one tuner, but internally there are often two devices (tuner and modulator) that have to be controlled.
For SDR you have an RF Tuner with a frequency and an ADC with a frequency, and the two frequencies can be set independently. So representing that as two tuners seems like a sensible mapping to me.
Correct. Both RF tuner and ADC are independent each others and both must be possible to adjust runtime.
Shortly, all-in-all, I will implement those as a tuner#0 is ADC and tuner#1 is RF tuner. Patches with corrections follow soon.
regards
Antti
Signature · 1 line
http://palosaari.fi/