SDR API with documentation
Subsystems (3)
v6 cover SDR API with documentation
That version contains documentation fixes reported by Hans.
Antti Palosaari (11):
v4l: add device type for Software Defined Radio
v4l: add new tuner types for SDR
v4l: 1 Hz resolution flag for tuners
v4l: add stream format for SDR receiver
v4l: define own IOCTL ops for SDR FMT
v4l: enable some IOCTLs for SDR receiver
v4l: add device capability flag for SDR receiver
DocBook: fix wait.c location
DocBook: document 1 Hz flag
DocBook: Software Defined Radio Interface v4l2-framework.txt: add SDR device type
Hans Verkuil (1):
v4l: do not allow modulator ioctls for non-radio devices
Documentation/DocBook/device-drivers.tmpl | 2 +- Documentation/DocBook/media/v4l/compat.xml | 10 ++ Documentation/DocBook/media/v4l/dev-sdr.xml | 107 +++++++++++++++++++++ Documentation/DocBook/media/v4l/io.xml | 6 ++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + .../DocBook/media/v4l/vidioc-enum-freq-bands.xml | 8 +- Documentation/DocBook/media/v4l/vidioc-g-fmt.xml | 7 ++ .../DocBook/media/v4l/vidioc-g-frequency.xml | 5 +- .../DocBook/media/v4l/vidioc-g-modulator.xml | 6 +- Documentation/DocBook/media/v4l/vidioc-g-tuner.xml | 15 ++- .../DocBook/media/v4l/vidioc-querycap.xml | 6 ++ .../DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | 8 +- Documentation/video4linux/v4l2-framework.txt | 1 + drivers/media/v4l2-core/v4l2-dev.c | 30 +++++- drivers/media/v4l2-core/v4l2-ioctl.c | 75 ++++++++++++--- include/media/v4l2-dev.h | 3 +- include/media/v4l2-ioctl.h | 8 ++ include/trace/events/v4l2.h | 1 + include/uapi/linux/videodev2.h | 16 +++ 19 files changed, 286 insertions(+), 29 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/dev-sdr.xml
Signature · 1 line
1.8.4.2
RFC PATCH v6 1/12 v4l: add device type for Software Defined Radio
Add new V4L device type VFL_TYPE_SDR for Software Defined Radio. It is registered as /dev/swradio0 (/dev/sdr0 was already reserved).
--- drivers/media/v4l2-core/v4l2-dev.c | 6 ++++++ include/media/v4l2-dev.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-dev.c +6 -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,10 @@ 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 : +/* Use device name 'swradio' because 'sdr' was already taken. */ + name_base ="swradio" ; +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 v6 2/12 v4l: add new tuner types for SDR
In reply to Antti PalosaariDefine tuner types V4L2_TUNER_ADC and V4L2_TUNER_RF for SDR usage.
ADC is used for setting sampling rate (sampling frequency) to SDR device.
Another tuner type, named as V4L2_TUNER_RF, is possible RF tuner. Is is used to down-convert RF frequency to range ADC could sample. Having RF tuner is optional, whilst in practice it is almost always there.
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). For VIDIOC_G_FREQUENCY we do not check tuner type, instead override type with V4L2_TUNER_ADC in every case (requested by Hans in order to keep functionality in line with existing tuners and existing API does not specify it).
Prohibit VIDIOC_S_HW_FREQ_SEEK explicitly when device type is SDR, as device cannot do hardware seek without a hardware demodulator.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 39 ++++++++++++++++++++++++++---------- include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 30 insertions(+), 11 deletions(-)
drivers/media/v4l2-core/v4l2-ioctl.c +28 -11
@@ -1288,8 +1288,11 @@ 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 ) + p->type =V4L2_TUNER_ADC ; +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 +1303,15 @@ 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_RF ) +return -EINVAL ; + }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); }
@@ -1383,6 +1391,10 @@ static int v4l_s_hw_freq_seek(const struct v4l2_ioctl_ops *ops,struct v4l2_hw_freq_seek *p = arg;enum v4l2_tuner_type type; +/* s_hw_freq_seek is not supported for SDR for now */ +if (vfd->vfl_type ==VFL_TYPE_SDR ) +return -EINVAL ; + type = (vfd->vfl_type ==VFL_TYPE_RADIO ) ?V4L2_TUNER_RADIO :V4L2_TUNER_ANALOG_TV ;if (p->type != type)
@@ -1882,11 +1894,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_RF ) +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_RF = 5, }; enum v4l2_memory {
Signature · 1 line
1.8.4.2
RFC PATCH v6 3/12 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
@@ -1341,6 +1341,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
RFC PATCH v6 4/12 v4l: add stream format for SDR receiver
In reply to Antti PalosaariAdd new V4L2 stream format definition, V4L2_BUF_TYPE_SDR_CAPTURE, for SDR receiver.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/trace/events/v4l2.h | 1 + include/uapi/linux/videodev2.h | 11 +++++++++++ 3 files changed, 13 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -149,6 +149,7 @@ const char *v4l2_type_names[] = { [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "vid-out-overlay", [V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE] = "vid-cap-mplane", [V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE] = "vid-out-mplane", + [V4L2_BUF_TYPE_SDR_CAPTURE ] ="sdr-cap" , };EXPORT_SYMBOL (v4l2_type_names);
include/trace/events/v4l2.h +1 -0
@@ -18,6 +18,7 @@ { V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY, "VIDEO_OUTPUT_OVERLAY" },\ { V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" },\ { V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" }, \ + { V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" }, \ { V4L2_BUF_TYPE_PRIVATE, "PRIVATE" }) #define show_field(field) \
include/uapi/linux/videodev2.h +11 -0
@@ -139,6 +139,7 @@ enum v4l2_buf_type {#endif V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE =9 ,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE =10 , +V4L2_BUF_TYPE_SDR_CAPTURE =11 ,/* Deprecated, do not use */ V4L2_BUF_TYPE_PRIVATE = 0x80, };
@@ -1695,6 +1696,15 @@ struct v4l2_pix_format_mplane { } __attribute__ ((packed));/** +* struct v4l2_format_sdr - SDR format definition +* @pixelformat: little endian four character code (fourcc) +*/ +struct v4l2_format_sdr { +__u32 pixelformat; +__u8 reserved[28 ]; +} __attribute__ ((packed)); + +/** * struct v4l2_format - stream data format * @type: enum v4l2_buf_type; type of the data stream * @pix: definition of an image format
@@ -1712,6 +1722,7 @@ struct v4l2_format {struct v4l2_window win;/* V4L2_BUF_TYPE_VIDEO_OVERLAY */ struct v4l2_vbi_format vbi;/* V4L2_BUF_TYPE_VBI_CAPTURE */ struct v4l2_sliced_vbi_format sliced;/* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ +struct v4l2_format_sdr sdr;/* V4L2_BUF_TYPE_SDR_CAPTURE */ __u8 raw_data[200 ];/* user-defined */ } fmt; };
Signature · 1 line
1.8.4.2
RFC PATCH v6 5/12 v4l: define own IOCTL ops for SDR FMT
In reply to Antti PalosaariUse own format ops for SDR data:vidioc_enum_fmt_sdr_capvidioc_g_fmt_sdr_capvidioc_s_fmt_sdr_capvidioc_try_fmt_sdr_cap
--- include/media/v4l2-ioctl.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/media/v4l2-ioctl.h +8 -0
@@ -40,6 +40,8 @@ struct v4l2_ioctl_ops { struct v4l2_fmtdesc *f);int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file,void *fh,struct v4l2_fmtdesc *f); +int (*vidioc_enum_fmt_sdr_cap) (struct file *file,void *fh, +struct v4l2_fmtdesc *f);/* VIDIOC_G_FMT handlers */ int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
@@ -62,6 +64,8 @@ struct v4l2_ioctl_ops { struct v4l2_format *f);int (*vidioc_g_fmt_vid_out_mplane)(struct file *file,void *fh,struct v4l2_format *f); +int (*vidioc_g_fmt_sdr_cap) (struct file *file,void *fh, +struct v4l2_format *f);/* VIDIOC_S_FMT handlers */ int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
@@ -84,6 +88,8 @@ struct v4l2_ioctl_ops { struct v4l2_format *f);int (*vidioc_s_fmt_vid_out_mplane)(struct file *file,void *fh,struct v4l2_format *f); +int (*vidioc_s_fmt_sdr_cap) (struct file *file,void *fh, +struct v4l2_format *f);/* VIDIOC_TRY_FMT handlers */ int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
@@ -106,6 +112,8 @@ struct v4l2_ioctl_ops { struct v4l2_format *f);int (*vidioc_try_fmt_vid_out_mplane)(struct file *file,void *fh,struct v4l2_format *f); +int (*vidioc_try_fmt_sdr_cap) (struct file *file,void *fh, +struct v4l2_format *f);/* Buffer handlers */ int (*vidioc_reqbufs) (struct file *file,void *fh,struct v4l2_requestbuffers *b);
Signature · 1 line
1.8.4.2
RFC PATCH v6 6/12 v4l: enable some IOCTLs for SDR receiver
In reply to Antti PalosaariEnable stream format (FMT) IOCTLs for SDR use. These are used for negotiate used data stream format.
Reorganise some some IOCTL selection logic.
--- drivers/media/v4l2-core/v4l2-dev.c | 21 ++++++++++++++++++--- drivers/media/v4l2-core/v4l2-ioctl.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/v4l2-dev.c +18 -3
@@ -562,7 +562,7 @@ static void determine_valid_ioctls(struct video_device *vdev)const struct v4l2_ioctl_ops *ops = vdev->ioctl_ops;bool is_vid = vdev->vfl_type ==VFL_TYPE_GRABBER ;bool is_vbi = vdev->vfl_type ==VFL_TYPE_VBI ; -bool is_radio = vdev->vfl_type ==VFL_TYPE_RADIO ; +bool is_sdr = vdev->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vdev->vfl_dir !=VFL_DIR_TX ;bool is_tx = vdev->vfl_dir !=VFL_DIR_RX ;
@@ -671,9 +671,20 @@ static void determine_valid_ioctls(struct video_device *vdev) ops->vidioc_try_fmt_sliced_vbi_out)))set_bit (_IOC_NR (VIDIOC_TRY_FMT ), valid_ioctls);SET_VALID_IOCTL (ops,VIDIOC_G_SLICED_VBI_CAP , vidioc_g_sliced_vbi_cap); + }else if (is_sdr) { +/* SDR specific ioctls */ +if (ops->vidioc_enum_fmt_sdr_cap) +set_bit (_IOC_NR (VIDIOC_ENUM_FMT ), valid_ioctls); +if (ops->vidioc_g_fmt_sdr_cap) +set_bit (_IOC_NR (VIDIOC_G_FMT ), valid_ioctls); +if (ops->vidioc_s_fmt_sdr_cap) +set_bit (_IOC_NR (VIDIOC_S_FMT ), valid_ioctls); +if (ops->vidioc_try_fmt_sdr_cap) +set_bit (_IOC_NR (VIDIOC_TRY_FMT ), valid_ioctls); } -if (!is_radio) { -/* ioctls valid for video or vbi */ + +if (is_vid || is_vbi || is_sdr) { +/* ioctls valid for video, vbi or sdr */ SET_VALID_IOCTL (ops,VIDIOC_REQBUFS , vidioc_reqbufs);SET_VALID_IOCTL (ops,VIDIOC_QUERYBUF , vidioc_querybuf);SET_VALID_IOCTL (ops,VIDIOC_QBUF , vidioc_qbuf);
@@ -681,6 +692,10 @@ static void determine_valid_ioctls(struct video_device *vdev)SET_VALID_IOCTL (ops,VIDIOC_DQBUF , vidioc_dqbuf);SET_VALID_IOCTL (ops,VIDIOC_CREATE_BUFS , vidioc_create_bufs);SET_VALID_IOCTL (ops,VIDIOC_PREPARE_BUF , vidioc_prepare_buf); + } + +if (is_vid || is_vbi) { +/* ioctls valid for video or vbi */ if (ops->vidioc_s_std)set_bit (_IOC_NR (VIDIOC_ENUMSTD ), valid_ioctls);SET_VALID_IOCTL (ops,VIDIOC_S_STD , vidioc_s_std);
drivers/media/v4l2-core/v4l2-ioctl.c +35 -0
@@ -243,6 +243,7 @@ static void v4l_print_format(const void *arg, bool write_only)const struct v4l2_vbi_format *vbi;const struct v4l2_sliced_vbi_format *sliced;const struct v4l2_window *win; +const struct v4l2_format_sdr *sdr;unsigned i;pr_cont ("type=%s" ,prt_names (p->type, v4l2_type_names));
@@ -316,6 +317,14 @@ static void v4l_print_format(const void *arg, bool write_only) sliced->service_lines[0 ][i], sliced->service_lines[1][i]);break ; +case V4L2_BUF_TYPE_SDR_CAPTURE : + sdr = &p->fmt.sdr; +pr_cont (", pixelformat=%c%c%c%c\n" , + (sdr->pixelformat >>0 ) &0xff , + (sdr->pixelformat >>8 ) &0xff , + (sdr->pixelformat >>16 ) &0xff , + (sdr->pixelformat >>24 ) &0xff ); +break ; } }
@@ -879,6 +888,7 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type)const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;bool is_vid = vfd->vfl_type ==VFL_TYPE_GRABBER ;bool is_vbi = vfd->vfl_type ==VFL_TYPE_VBI ; +bool is_sdr = vfd->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vfd->vfl_dir !=VFL_DIR_TX ;bool is_tx = vfd->vfl_dir !=VFL_DIR_RX ;
@@ -928,6 +938,10 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type)if (is_vbi && is_tx && ops->vidioc_g_fmt_sliced_vbi_out)return 0 ;break ; +case V4L2_BUF_TYPE_SDR_CAPTURE : +if (is_sdr && is_rx && ops->vidioc_g_fmt_sdr_cap) +return 0 ; +break ;default :break ; }
@@ -1047,6 +1061,10 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,if (unlikely (!is_tx || !ops->vidioc_enum_fmt_vid_out_mplane))break ;return ops->vidioc_enum_fmt_vid_out_mplane (file, fh, arg); +case V4L2_BUF_TYPE_SDR_CAPTURE : +if (unlikely (!is_rx || !ops->vidioc_enum_fmt_sdr_cap)) +break ; +return ops->vidioc_enum_fmt_sdr_cap (file, fh, arg); }return -EINVAL ; }
@@ -1057,6 +1075,7 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,struct v4l2_format *p = arg;struct video_device *vfd =video_devdata (file);bool is_vid = vfd->vfl_type ==VFL_TYPE_GRABBER ; +bool is_sdr = vfd->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vfd->vfl_dir !=VFL_DIR_TX ;bool is_tx = vfd->vfl_dir !=VFL_DIR_RX ;
@@ -1101,6 +1120,10 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,if (unlikely (!is_tx || is_vid || !ops->vidioc_g_fmt_sliced_vbi_out))break ;return ops->vidioc_g_fmt_sliced_vbi_out (file, fh, arg); +case V4L2_BUF_TYPE_SDR_CAPTURE : +if (unlikely (!is_rx || !is_sdr || !ops->vidioc_g_fmt_sdr_cap)) +break ; +return ops->vidioc_g_fmt_sdr_cap (file, fh, arg); }return -EINVAL ; }
@@ -1111,6 +1134,7 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,struct v4l2_format *p = arg;struct video_device *vfd =video_devdata (file);bool is_vid = vfd->vfl_type ==VFL_TYPE_GRABBER ; +bool is_sdr = vfd->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vfd->vfl_dir !=VFL_DIR_TX ;bool is_tx = vfd->vfl_dir !=VFL_DIR_RX ;
@@ -1165,6 +1189,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,break ;CLEAR_AFTER_FIELD (p, fmt.sliced);return ops->vidioc_s_fmt_sliced_vbi_out (file, fh, arg); +case V4L2_BUF_TYPE_SDR_CAPTURE : +if (unlikely (!is_rx || !is_sdr || !ops->vidioc_s_fmt_sdr_cap)) +break ; +CLEAR_AFTER_FIELD (p, fmt.sdr); +return ops->vidioc_s_fmt_sdr_cap (file, fh, arg); }return -EINVAL ; }
@@ -1175,6 +1204,7 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,struct v4l2_format *p = arg;struct video_device *vfd =video_devdata (file);bool is_vid = vfd->vfl_type ==VFL_TYPE_GRABBER ; +bool is_sdr = vfd->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vfd->vfl_dir !=VFL_DIR_TX ;bool is_tx = vfd->vfl_dir !=VFL_DIR_RX ;
@@ -1229,6 +1259,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,break ;CLEAR_AFTER_FIELD (p, fmt.sliced);return ops->vidioc_try_fmt_sliced_vbi_out (file, fh, arg); +case V4L2_BUF_TYPE_SDR_CAPTURE : +if (unlikely (!is_rx || !is_sdr || !ops->vidioc_try_fmt_sdr_cap)) +break ; +CLEAR_AFTER_FIELD (p, fmt.sdr); +return ops->vidioc_try_fmt_sdr_cap (file, fh, arg); }return -EINVAL ; }
Signature · 1 line
1.8.4.2
RFC PATCH v6 7/12 v4l: add device capability flag for SDR receiver
In reply to Antti PalosaariVIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new capability flag to inform given device supports SDR capture.
--- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+)
include/uapi/linux/videodev2.h +2 -0
@@ -267,6 +267,8 @@ struct v4l2_capability {#define V4L2_CAP_RADIO 0x00040000/* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000/* has a modulator */ +#define V4L2_CAP_SDR_CAPTURE 0x00100000/* Is a SDR capture device */ +#define V4L2_CAP_READWRITE 0x01000000/* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000/* async I/O */ #define V4L2_CAP_STREAMING 0x04000000/* streaming I/O ioctls */
Signature · 1 line
1.8.4.2
Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
Quoted 16 lines · Antti Palosaari
VIDIOC_QUERYCAPIOCTL is used to query device capabilities. Add new capability flag to inform given device supports SDR capture.Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>Acked-by Hans Verkuil <[email protected]>--- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+)include/uapi/linux/videodev2.h +0
-0
include/uapi/linux/videodev2.h struct v4l2_capability { · line 274
Quoted 8 lines
include/uapi/linux/videodev2.h +2
-0@@ -267,6 +267,8 @@ struct v4l2_capability {#define V4L2_CAP_RADIO 0x00040000/* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000/* has a modulator */ +#define V4L2_CAP_SDR_CAPTURE 0x00100000/* Is a SDR capture device */ +#define V4L2_CAP_READWRITE 0x01000000/* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000/* async I/O */ #define V4L2_CAP_STREAMING 0x04000000/* streaming I/O ioctls */
This new capability needs to be documented in DocBook as well (vidioc-querycap.xml).
Regards,
Hans
Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
Quoted 19 lines · Hans Verkuil
Quoted 18 lines · Antti Palosaari
VIDIOC_QUERYCAPIOCTL is used to query device capabilities. Add new capability flag to inform given device supports SDR capture.Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>Acked-by Hans Verkuil <[email protected]>--- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+)include/uapi/linux/videodev2.h +0
-0@@ -267,6 +267,8 @@ struct v4l2_capability {#define V4L2_CAP_RADIO 0x00040000/* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000/* has a modulator */
Quoted 8 lines
include/uapi/linux/videodev2.h struct v4l2_capability { · line 274
Quoted 6 lines
include/uapi/linux/videodev2.h +2
-0+#define V4L2_CAP_SDR_CAPTURE 0x00100000/* Is a SDR capture device */ +#define V4L2_CAP_READWRITE 0x01000000/* read/write systemcalls */ #define V4L2_CAP_ASYNCIO 0x02000000/* async I/O */ #define V4L2_CAP_STREAMING 0x04000000/* streaming I/O ioctls */ This new capability needs to be documented in DocBook as well (vidioc-querycap.xml).
It is already.
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
Quoted 34 lines · Antti Palosaari
Quoted 20 lines · Hans Verkuil
Quoted 19 lines · Antti Palosaari
VIDIOC_QUERYCAPIOCTL is used to query device capabilities. Add new capability flag to inform given device supports SDR capture.Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>Acked-by Hans Verkuil <[email protected]>--- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+)include/uapi/linux/videodev2.h +0
-0@@ -267,6 +267,8 @@ struct v4l2_capability {#define V4L2_CAP_RADIO 0x00040000/* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000/* has a modulator */ Quoted 12 lines
Quoted 9 lines
include/uapi/linux/videodev2.h +1
-0+#define V4L2_CAP_SDR_CAPTURE 0x00100000/* Is a SDR capture device */
+
#defineV4L2_CAP_READWRITE0x01000000/* read/write
systemcalls */#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streamingI/O ioctls */
This new capability needs to be documented in DocBook as well (vidioc-querycap.xml).
Quoted 1 line
It is already.
There is following related flags:
V4L2_CAP_TUNERV4L2_CAP_RADIOV4L2_CAP_MODULATORV4L2_CAP_SDR_CAPTURE
V4L2_CAP_TUNER flag is overlapping with all these and is redundant at least currently. Lets take a example as a radio device. There is V4L2_CAP_RADIO flag to say it is radio and then there is flag V4L2_CAP_TUNER which means signal is coming from antenna? So there could be radio device without V4L2_CAP_TUNER flag, for example radio over IP, right?
Due to that I started thinking relation of V4L2_CAP_SDR_CAPTURE and V4L2_CAP_TUNER and V4L2_CAP_RADIO flags. ADC is pretty much mandatory element of SDR receiver (and DAC SDR transmitter). Whilst ADC is mandatory, RF tuner is not. So should I map V4L2_CAP_TUNER to indicate there is RF tuner?
regards
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
Quoted 44 lines · Antti Palosaari
Quoted 34 lines · Antti Palosaari
Quoted 20 lines · Hans Verkuil
Quoted 19 lines · Antti Palosaari
VIDIOC_QUERYCAPIOCTL is used to query device capabilities. Add new capability flag to inform given device supports SDR capture.Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>Acked-by Hans Verkuil <[email protected]>--- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+)include/uapi/linux/videodev2.h +0
-0@@ -267,6 +267,8 @@ struct v4l2_capability {#define V4L2_CAP_RADIO 0x00040000/* is a radio device */ #define V4L2_CAP_MODULATOR 0x00080000/* has a modulator */ Quoted 12 lines
Quoted 9 lines
include/uapi/linux/videodev2.h +1
-0+#define V4L2_CAP_SDR_CAPTURE 0x00100000/* Is a SDR capture device */
+
#defineV4L2_CAP_READWRITE0x01000000/* read/write
systemcalls */#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ #define V4L2_CAP_STREAMING 0x04000000 /* streamingI/O ioctls */
This new capability needs to be documented in DocBook as well (vidioc-querycap.xml).
Quoted 1 line
It is already.
There is following related flags:
V4L2_CAP_TUNERV4L2_CAP_RADIOV4L2_CAP_MODULATORV4L2_CAP_SDR_CAPTURE
Quoted 6 lines
V4L2_CAP_TUNERflag is overlapping with all these and is redundant at least currently. Lets take a example as a radio device. There isV4L2_CAP_RADIOflag to say it is radio and then there is flagV4L2_CAP_TUNERwhich means signal is coming from antenna? So there could be radio device withoutV4L2_CAP_TUNERflag, for example radio over IP, right?
The tuner cap is important to tell the difference between a radio tuner and a radio modulator. In addition you need this capability tell userspace that the video capture device has a tuner. Video capture without a tuner is quite common.
Quoted 5 lines
Due to that I started thinking relation of
V4L2_CAP_SDR_CAPTUREandV4L2_CAP_TUNERandV4L2_CAP_RADIOflags. ADC is pretty much mandatory element of SDR receiver (and DAC SDR transmitter). Whilst ADC is mandatory, RF tuner is not. So should I mapV4L2_CAP_TUNERto indicate there is RF tuner?
I don't think so. The capabilities really tell userspace what APIs are supported by the driver. Even though the ADC is perhaps not a 'real' tuner, the tuner API is still used to program it.
Regards,
Hans
RFC PATCH v6 8/12 v4l: do not allow modulator ioctls for non-radio devices
In reply to Antti PalosaariFrom: Hans Verkuil <[email protected]>
Modulator ioctls could be enabled mistakenly for non-radio devices. Currently those ioctls are only valid for radio. Fix it.
--- drivers/media/v4l2-core/v4l2-dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/v4l2-core/v4l2-dev.c +3 -2
@@ -562,6 +562,7 @@ static void determine_valid_ioctls(struct video_device *vdev)const struct v4l2_ioctl_ops *ops = vdev->ioctl_ops;bool is_vid = vdev->vfl_type ==VFL_TYPE_GRABBER ;bool is_vbi = vdev->vfl_type ==VFL_TYPE_VBI ; +bool is_radio = vdev->vfl_type ==VFL_TYPE_RADIO ;bool is_sdr = vdev->vfl_type ==VFL_TYPE_SDR ;bool is_rx = vdev->vfl_dir !=VFL_DIR_TX ;bool is_tx = vdev->vfl_dir !=VFL_DIR_RX ;
@@ -735,8 +736,8 @@ static void determine_valid_ioctls(struct video_device *vdev)SET_VALID_IOCTL (ops,VIDIOC_ENUM_DV_TIMINGS , vidioc_enum_dv_timings);SET_VALID_IOCTL (ops,VIDIOC_DV_TIMINGS_CAP , vidioc_dv_timings_cap); } -if (is_tx) { -/* transmitter only ioctls */ +if (is_tx && (is_radio || is_sdr)) { +/* radio transmitter only ioctls */ SET_VALID_IOCTL (ops,VIDIOC_G_MODULATOR , vidioc_g_modulator);SET_VALID_IOCTL (ops,VIDIOC_S_MODULATOR , vidioc_s_modulator); }
Signature · 1 line
1.8.4.2
RFC PATCH v6 9/12 DocBook: fix wait.c location
In reply to Antti PalosaariDocumentation did not compile as wait.c location was wrong.
--- Documentation/DocBook/device-drivers.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/DocBook/device-drivers.tmpl +1 -1
@@ -58,7 +58,7 @@ </sect1> <sect1><title>Wait queues and Wake events</title> !Iinclude/linux/wait.h -!Ekernel/wait.c +!Ekernel/sched/wait.c </sect1> <sect1><title>High-resolution timers</title> !Iinclude/linux/ktime.h
Signature · 1 line
1.8.4.2
RFC PATCH v6 10/12 DocBook: document 1 Hz flag
In reply to Antti PalosaariUpdate documention to reflect 1 Hz frequency step flag.
--- .../DocBook/media/v4l/vidioc-enum-freq-bands.xml | 8 +++++--- Documentation/DocBook/media/v4l/vidioc-g-frequency.xml | 5 +++-- Documentation/DocBook/media/v4l/vidioc-g-modulator.xml | 6 ++++-- Documentation/DocBook/media/v4l/vidioc-g-tuner.xml | 15 ++++++++++++--- Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | 8 ++++++-- 5 files changed, 30 insertions(+), 12 deletions(-)
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +5 -3
@@ -100,7 +100,7 @@ See <xref linkend="v4l2-tuner-type" /></entry> <entry><structfield>capability</structfield></entry> <entry spanname="hspan">The tuner/modulator capability flags for this frequency band, see <xref linkend="tuner-capability" />. The <constant>V4L2_TUNER_CAP_LOW</constant> -capability must be the same for all frequency bands of the selected tuner/modulator. +or <constant>V4L2_TUNER_CAP_1HZ</constant> capability must be the same for all frequency bands of the selected tuner/modulator. So either all bands have that capability set, or none of them have that capability.</entry> </row> <row>
@@ -109,7 +109,8 @@ So either all bands have that capability set, or none of them have that capabili <entry spanname="hspan">The lowest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. 1 Hz unit is used when <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>
@@ -117,7 +118,8 @@ Hz, for this frequency band.</entry> <entry spanname="hspan">The highest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. 1 Hz unit is used when <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>
Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +3 -2
@@ -109,9 +109,10 @@ See <xref linkend="v4l2-tuner-type" /></entry> <entry>__u32</entry> <entry><structfield>frequency</structfield></entry> <entry>Tuning frequency in units of 62.5 kHz, or if the -&v4l2-tuner; or &v4l2-modulator; <structfield>capabilities</structfield> flag +&v4l2-tuner; or &v4l2-modulator; <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz. 1 Hz unit is used when <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>
Documentation/DocBook/media/v4l/vidioc-g-modulator.xml +4 -2
@@ -113,7 +113,8 @@ change for example with the current video standard.</entry> <entry>The lowest tunable frequency in units of 62.5 KHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry> </row> <row> <entry>__u32</entry>
@@ -121,7 +122,8 @@ Hz.</entry> <entry>The highest tunable frequency in units of 62.5 KHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry> </row> <row> <entry>__u32</entry>
Documentation/DocBook/media/v4l/vidioc-g-tuner.xml +12 -3
@@ -134,7 +134,9 @@ the structure refers to a radio tuner the <entry spanname="hspan">The lowest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then <structfield>rangelow</structfield> is the lowest frequency of all the frequency bands.</entry> </row>
@@ -144,7 +146,9 @@ of all the frequency bands.</entry> <entry spanname="hspan">The highest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then <structfield>rangehigh</structfield> is the highest frequency of all the frequency bands.</entry> </row>
@@ -270,7 +274,7 @@ applications must set the array to zero.</entry> <entry><constant>V4L2_TUNER_CAP_LOW</constant></entry> <entry>0x0001</entry> <entry>When set, tuning frequencies are expressed in units of -62.5 Hz, otherwise in units of 62.5 kHz.</entry> +62.5 Hz instead of 62.5 kHz.</entry> </row> <row> <entry><constant>V4L2_TUNER_CAP_NORM</constant></entry>
@@ -360,6 +364,11 @@ radio tuners.</entry> <entry>The range to search when using the hardware seek functionality is programmable, see &VIDIOC-S-HW-FREQ-SEEK; for details.</entry> </row> + <row> + <entry><constant>V4L2_TUNER_CAP_1HZ</constant></entry> + <entry>0x1000</entry> + <entry>When set, tuning frequencies are expressed in units of 1 Hz instead of 62.5 kHz.</entry> + </row> </tbody> </tgroup> </table>
Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +6 -2
@@ -121,7 +121,9 @@ field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> <entry>If non-zero, the lowest tunable frequency of the band to search in units of 62.5 kHz, or if the &v4l2-tuner; <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz. If <structfield>rangelow</structfield> is zero a reasonable default value is used.</entry> </row>
@@ -131,7 +133,9 @@ is used.</entry> <entry>If non-zero, the highest tunable frequency of the band to search in units of 62.5 kHz, or if the &v4l2-tuner; <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz. If <structfield>rangehigh</structfield> is zero a reasonable default value is used.</entry> </row>
Signature · 1 line
1.8.4.2
Re: [PATCH RFC v6 10/12] DocBook: document 1 Hz flag
More small fixes:
Quoted 1 line · Antti Palosaari
Update documention to reflect 1 Hz frequency step flag.
documention -> documentation
Quoted 25 lines
Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>--- .../DocBook/media/v4l/vidioc-enum-freq-bands.xml | 8 +++++--- Documentation/DocBook/media/v4l/vidioc-g-frequency.xml | 5 +++-- Documentation/DocBook/media/v4l/vidioc-g-modulator.xml | 6 ++++-- Documentation/DocBook/media/v4l/vidioc-g-tuner.xml | 15 ++++++++++++--- Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml | 8 ++++++-- 5 files changed, 30 insertions(+), 12 deletions(-)Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +1
-1@@ -100,7 +100,7 @@ See <xref linkend="v4l2-tuner-type" /></entry> <entry><structfield>capability</structfield></entry> <entry spanname="hspan">The tuner/modulator capability flags for this frequency band, see <xref linkend="tuner-capability" />. The <constant>V4L2_TUNER_CAP_LOW</constant> -capability must be the same for all frequency bands of the selected tuner/modulator. +or <constant>V4L2_TUNER_CAP_1HZ</constant> capability must be the same for all frequency bands of the selected tuner/modulator. So either all bands have that capability set, or none of them have that capability.</entry> </row> <row>
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml So either all bands have that capability set, or none of them have that capabili · line 112
Quoted 5 lines
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +1
-1@@ -109,7 +109,8 @@ So either all bands have that capability set, or none of them have that capabili <entry spanname="hspan">The lowest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. 1 Hz unit is used when <structfield>capability</structfield> flag
Change to:
"Hz, for this frequency band. A 1 Hz unit is used when the <structfield>capability</structfield> flag"
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml Hz, for this frequency band.</entry> · line 121
Quoted 10 lines
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +2
-1+<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>@@ -117,7 +118,8 @@ Hz, for this frequency band.</entry> <entry spanname="hspan">The highest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz, for this frequency band.</entry> +Hz, for this frequency band. 1 Hz unit is used when <structfield>capability</structfield> flag
Change to:
"Hz, for this frequency band. A 1 Hz unit is used when the <structfield>capability</structfield> flag"
Quoted 9 lines
Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml +1
-0+<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +0
-0
Documentation/DocBook/media/v4l/vidioc-g-frequency.xml See <xref linkend="v4l2-tuner-type" /></entry> · line 114
Quoted 8 lines
Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +2
-2@@ -109,9 +109,10 @@ See <xref linkend="v4l2-tuner-type" /></entry> <entry>__u32</entry> <entry><structfield>frequency</structfield></entry> <entry>Tuning frequency in units of 62.5 kHz, or if the -&v4l2-tuner; or &v4l2-modulator; <structfield>capabilities</structfield> flag +&v4l2-tuner; or &v4l2-modulator; <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz. 1 Hz unit is used when <structfield>capability</structfield> flag
Change to:
"Hz. A 1 Hz unit is used when the <structfield>capability</structfield> flag"
Quoted 92 lines
Documentation/DocBook/media/v4l/vidioc-g-frequency.xml +1
-0+<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry> </row> <row> <entry>__u32</entry>Documentation/DocBook/media/v4l/vidioc-g-modulator.xml +4
-2@@ -113,7 +113,8 @@ change for example with the current video standard.</entry> <entry>The lowest tunable frequency in units of 62.5 KHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry> </row> <row> <entry>__u32</entry>@@ -121,7 +122,8 @@ Hz.</entry> <entry>The highest tunable frequency in units of 62.5 KHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz.</entry> +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz.</entry> </row> <row> <entry>__u32</entry>Documentation/DocBook/media/v4l/vidioc-g-tuner.xml +12
-3@@ -134,7 +134,9 @@ the structure refers to a radio tuner the <entry spanname="hspan">The lowest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then <structfield>rangelow</structfield> is the lowest frequency of all the frequency bands.</entry> </row>@@ -144,7 +146,9 @@ of all the frequency bands.</entry> <entry spanname="hspan">The highest tunable frequency in units of 62.5 kHz, or if the <structfield>capability</structfield> flag <constant>V4L2_TUNER_CAP_LOW</constant> is set, in units of 62.5 -Hz. If multiple frequency bands are supported, then +Hz, or if the <structfield>capability</structfield> flag +<constant>V4L2_TUNER_CAP_1HZ</constant> is set, in units of 1 Hz. +If multiple frequency bands are supported, then <structfield>rangehigh</structfield> is the highest frequency of all the frequency bands.</entry> </row>@@ -270,7 +274,7 @@ applications must set the array to zero.</entry> <entry><constant>V4L2_TUNER_CAP_LOW</constant></entry> <entry>0x0001</entry> <entry>When set, tuning frequencies are expressed in units of -62.5 Hz, otherwise in units of 62.5 kHz.</entry> +62.5 Hz instead of 62.5 kHz.</entry> </row> <row> <entry><constant>V4L2_TUNER_CAP_NORM</constant></entry>@@ -360,6 +364,11 @@ radio tuners.</entry> <entry>The range to search when using the hardware seek functionality is programmable, see &VIDIOC-S-HW-FREQ-SEEK; for details.</entry> </row> + <row> + <entry><constant>V4L2_TUNER_CAP_1HZ</constant></entry> + <entry>0x1000</entry> + <entry>When set, tuning frequencies are expressed in units of 1 Hz instead of 62.5 kHz.</entry> + </row> </tbody> </tgroup> </table>Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +3
-1@@ -121,7 +121,9 @@ field and the &v4l2-tuner; <structfield>index</structfield> field.</entry> <entry>If non-zero, the lowest tunable frequency of the band to search in units of 62.5 kHz, or if the &v4l2-tuner; <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz. If <structfield>rangelow</structfield> is zero a reasonable default value is used.</entry> </row>
Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml is used.</entry> · line 141
Quoted 10 lines
Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml +3
-1@@ -131,7 +133,9 @@ is used.</entry> <entry>If non-zero, the highest tunable frequency of the band to search in units of 62.5 kHz, or if the &v4l2-tuner; <structfield>capability</structfield> field has the -<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz. +<constant>V4L2_TUNER_CAP_LOW</constant> flag set, in units of 62.5 Hz or if the &v4l2-tuner; +<structfield>capability</structfield> field has the +<constant>V4L2_TUNER_CAP_1HZ</constant> flag set, in units of 1 Hz. If <structfield>rangehigh</structfield> is zero a reasonable default value is used.</entry> </row>
After making these minor changes you can add my:
Regards,
Hans
RFC PATCH v6 11/12 DocBook: Software Defined Radio Interface
In reply to Antti PalosaariDocument V4L2 SDR interface.
--- Documentation/DocBook/media/v4l/compat.xml | 10 ++ Documentation/DocBook/media/v4l/dev-sdr.xml | 107 +++++++++++++++++++++ Documentation/DocBook/media/v4l/io.xml | 6 ++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + Documentation/DocBook/media/v4l/vidioc-g-fmt.xml | 7 ++ .../DocBook/media/v4l/vidioc-querycap.xml | 6 ++ 6 files changed, 137 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/dev-sdr.xml
Documentation/DocBook/media/v4l/compat.xml +10 -0
@@ -2523,6 +2523,16 @@ that used it. It was originally scheduled for removal in 2.6.35. </orderedlist> </section> + <section> + <title>V4L2 in Linux 3.14</title> + <orderedlist> + <listitem> + <para>Added Software Defined Radio (SDR) Interface. + </para> + </listitem> + </orderedlist> + </section> + <section id="other"> <title>Relation of V4L2 to other Linux multimedia APIs</title>
Documentation/DocBook/media/v4l/dev-sdr.xml new file +107 -0
107 lines not on this page · raw message
Documentation/DocBook/media/v4l/io.xml +6 -0
@@ -1005,6 +1005,12 @@ should set this to 0.</entry> <entry>Buffer for video output overlay (OSD), see <xref linkend="osd" />.</entry> </row> + <row> + <entry><constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant></entry> + <entry>11</entry> + <entry>Buffer for Software Defined Radio (SDR), see <xref + linkend="sdr" />.</entry> + </row> </tbody> </tgroup> </table>
Documentation/DocBook/media/v4l/v4l2.xml +1 -0
@@ -529,6 +529,7 @@ and discussions on the V4L mailing list.</revremark> <section id="ttx"> &sub-dev-teletext; </section> <section id="radio"> &sub-dev-radio; </section> <section id="rds"> &sub-dev-rds; </section> + <section id="sdr"> &sub-dev-sdr; </section> <section id="event"> &sub-dev-event; </section> <section id="subdev"> &sub-dev-subdev; </section> </chapter>
Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +7 -0
@@ -172,6 +172,13 @@ capture and output devices.</entry> </row> <row> <entry></entry> + <entry>&v4l2-format-sdr;</entry> + <entry><structfield>sdr</structfield></entry> + <entry>Definition of an data format, see +<xref linkend="pixfmt" />, used by SDR capture devices.</entry> + </row> + <row> + <entry></entry> <entry>__u8</entry> <entry><structfield>raw_data</structfield>[200]</entry> <entry>Place holder for future extensions.</entry>
Documentation/DocBook/media/v4l/vidioc-querycap.xml +6 -0
@@ -296,6 +296,12 @@ modulator programming see <xref linkend="tuner" />.</entry> </row> <row> + <entry><constant>V4L2_CAP_SDR_CAPTURE</constant></entry> + <entry>0x00100000</entry> + <entry>The device supports the +<link linkend="sdr">SDR Capture</link> interface.</entry> + </row> + <row> <entry><constant>V4L2_CAP_READWRITE</constant></entry> <entry>0x01000000</entry> <entry>The device supports the <link
Signature · 1 line
1.8.4.2
Re: [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface
More small fixes:
Quoted 73 lines · Antti Palosaari
Document V4L2 SDR interface.
Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>--- Documentation/DocBook/media/v4l/compat.xml | 10 ++ Documentation/DocBook/media/v4l/dev-sdr.xml | 107 +++++++++++++++++++++ Documentation/DocBook/media/v4l/io.xml | 6 ++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + Documentation/DocBook/media/v4l/vidioc-g-fmt.xml | 7 ++ .../DocBook/media/v4l/vidioc-querycap.xml | 6 ++ 6 files changed, 137 insertions(+) create mode 100644 Documentation/DocBook/media/v4l/dev-sdr.xmlDocumentation/DocBook/media/v4l/compat.xml +10
-0@@ -2523,6 +2523,16 @@ that used it. It was originally scheduled for removal in 2.6.35. </orderedlist> </section> + <section> + <title>V4L2 in Linux 3.14</title> + <orderedlist> + <listitem> + <para>Added Software Defined Radio (SDR) Interface. + </para> + </listitem> + </orderedlist> + </section> + <section id="other"> <title>Relation of V4L2 to other Linux multimedia APIs</title>Documentation/DocBook/media/v4l/dev-sdr.xml new file +32
-0@@ -0,0 +1,107 @@ + <title>Software Defined Radio Interface (SDR)</title> + + <para> +SDR is an abbreviation of Software Defined Radio, the radio device +which uses application software for modulation or demodulation. This interface +is intended for controlling and data streaming of such devices. + </para> + + <para> +SDR devices are accessed through character device special files named +<filename>/dev/swradio0</filename> to <filename>/dev/swradio255</filename> +with major number 81 and dynamically allocated minor numbers 0 to 255. + </para> + + <section> + <title>Querying Capabilities</title> + + <para> +Devices supporting the SDR receiver interface set the +<constant>V4L2_CAP_SDR_CAPTURE</constant> and +<constant>V4L2_CAP_TUNER</constant> flag in the +<structfield>capabilities</structfield> field of &v4l2-capability; +returned by the &VIDIOC-QUERYCAP; ioctl. That flag means the device has an +Analog to Digital Converter (ADC), which is a mandatory element for the SDR receiver. +At least one of the read/write, streaming or asynchronous I/O methods must +be supported. + </para> + </section> + + <section> + <title>Supplemental Functions</title> +
Documentation/DocBook/media/v4l/dev-sdr.xml line 42
Quoted 10 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +10
-0+ <para> +SDR devices can support <link linkend="control">controls</link>, and must +support the <link linkend="tuner">tuner</link> ioctls. Tuner ioctls are used +for setting the ADC sampling rate (sampling frequency) and the possible RF tuner +frequency. + </para> + + <para> +The <constant>V4L2_TUNER_ADC</constant> tuner type is used for ADC tuners, and +the <constant>V4L2_TUNER_RF</constant> is used for RF tuners. The tuner index
s/is used/tuner type is used/
Quoted 6 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +6
-0+of the RF tuner (if any) must always follow the ADC tuner index. Normally the +ADC tuner is #0 and the RF tuner is #1. + </para> + + <para> +The &VIDIOC-S-HW-FREQ-SEEK; ioctl is not supported.
Documentation/DocBook/media/v4l/dev-sdr.xml line 58
Quoted 10 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +10
-0+ </para> + </section> + + <section> + <title>Data Format Negotiation</title> + + <para> +The SDR capture device uses the <link linkend="format">format</link> ioctls to +select the capture format. Both the sampling resolution and the data streaming +format are bound to that selectable format. In addition to basic
s/to basic/to the basic/
Documentation/DocBook/media/v4l/dev-sdr.xml line 60
Quoted 2 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +2
-0+<link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl +must be supported too.
s/too/as well/
Quoted 18 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +18
-0+ </para> + + <para> +To use the <link linkend="format">format</link> ioctls applications set the +<structfield>type</structfield> field of a &v4l2-format; to +<constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant> and use the &v4l2-format-sdr; +<structfield>sdr</structfield> member of the <structfield>fmt</structfield> +union as needed per the desired operation. +Currently only the <structfield>pixelformat</structfield> field of +&v4l2-format-sdr; is used. The content of that field is the V4L2 fourcc code +of the data format. + </para> + + <table pgwide="1" frame="none" id="v4l2-format-sdr"> + <title>struct <structname>v4l2_format_sdr</structname></title> + <tgroup cols="3"> + &cs-str; + <tbody valign="top">
Documentation/DocBook/media/v4l/dev-sdr.xml line 88
Quoted 10 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +10
-0+ <row> + <entry>__u32</entry> + <entry><structfield>pixelformat</structfield></entry> + <entry> +The pixel format or type of compression, set by the +application. This is a little endian +<link linkend="v4l2-fourcc">four character code</link>. V4L2 defines +standard RGB formats in <xref linkend="rgb-formats" />, YUV formats in +<xref linkend="yuv-formats" />, and reserved codes in +<xref linkend="reserved-formats" />
Instead of pointing to the RGB/YUV/Reserved codes (which makes no sense for SDR) you need to point to a new section where the SDR fourcc formats are described.
Quoted 74 lines
Documentation/DocBook/media/v4l/dev-sdr.xml new file +19
-0+ </entry> + </row> + <row> + <entry>__u8</entry> + <entry><structfield>reserved[28]</structfield></entry> + <entry>This array is reserved for future extensions. +Drivers and applications must set it to zero.</entry> + </row> + </tbody> + </tgroup> + </table> + + <para> +An SDR device may support <link linkend="rw">read/write</link> +and/or streaming (<link linkend="mmap">memory mapping</link> +or <link linkend="userp">user pointer</link>) I/O. + </para> + + </section>Documentation/DocBook/media/v4l/io.xml +6
-0@@ -1005,6 +1005,12 @@ should set this to 0.</entry> <entry>Buffer for video output overlay (OSD), see <xref linkend="osd" />.</entry> </row> + <row> + <entry><constant>V4L2_BUF_TYPE_SDR_CAPTURE</constant></entry> + <entry>11</entry> + <entry>Buffer for Software Defined Radio (SDR), see <xref + linkend="sdr" />.</entry> + </row> </tbody> </tgroup> </table>Documentation/DocBook/media/v4l/v4l2.xml +1
-0@@ -529,6 +529,7 @@ and discussions on the V4L mailing list.</revremark> <section id="ttx"> &sub-dev-teletext; </section> <section id="radio"> &sub-dev-radio; </section> <section id="rds"> &sub-dev-rds; </section> + <section id="sdr"> &sub-dev-sdr; </section> <section id="event"> &sub-dev-event; </section> <section id="subdev"> &sub-dev-subdev; </section> </chapter>Documentation/DocBook/media/v4l/vidioc-g-fmt.xml +7
-0@@ -172,6 +172,13 @@ capture and output devices.</entry> </row> <row> <entry></entry> + <entry>&v4l2-format-sdr;</entry> + <entry><structfield>sdr</structfield></entry> + <entry>Definition of an data format, see +<xref linkend="pixfmt" />, used by SDR capture devices.</entry> + </row> + <row> + <entry></entry> <entry>__u8</entry> <entry><structfield>raw_data</structfield>[200]</entry> <entry>Place holder for future extensions.</entry>Documentation/DocBook/media/v4l/vidioc-querycap.xml +0
-0@@ -296,6 +296,12 @@ modulator programming see <xref linkend="tuner" />.</entry> </row>
Documentation/DocBook/media/v4l/vidioc-querycap.xml modulator programming see · line 307
Quoted 10 lines
Documentation/DocBook/media/v4l/vidioc-querycap.xml +6
-0<row> + <entry><constant>V4L2_CAP_SDR_CAPTURE</constant></entry> + <entry>0x00100000</entry> + <entry>The device supports the +<link linkend="sdr">SDR Capture</link> interface.</entry> + </row> + <row> <entry><constant>V4L2_CAP_READWRITE</constant></entry> <entry>0x01000000</entry> <entry>The device supports the <link
Regards,
Hans
RFC PATCH v6 12/12 v4l2-framework.txt: add SDR device type
In reply to Antti PalosaariAdd SDR device type to v4l2-framework.txt document.
--- Documentation/video4linux/v4l2-framework.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/video4linux/v4l2-framework.txt +1 -0
@@ -768,6 +768,7 @@ types exist: VFL_TYPE_GRABBER: videoX for video input/output devices VFL_TYPE_VBI: vbiX for vertical blank data (i.e. closed captions, teletext) VFL_TYPE_RADIO: radioX for radio tuners +VFL_TYPE_SDR: swradioX for Software Defined Radio tuners The last argument gives you a certain amount of control over the device device node number used (i.e. the X in videoX). Normally you will pass -1
Signature · 1 line
1.8.4.2
Re: [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type
Quoted 14 lines · Antti Palosaari
Add SDR device type to v4l2-framework.txt document.
Cc Hans Verkuil <[email protected]>Signed-off-by Antti Palosaari <[email protected]>--- Documentation/video4linux/v4l2-framework.txt | 1 + 1 file changed, 1 insertion(+)Documentation/video4linux/v4l2-framework.txt +0
-0
Documentation/video4linux/v4l2-framework.txt types exist: · line 774
Quoted 7 lines
Documentation/video4linux/v4l2-framework.txt +1
-0@@ -768,6 +768,7 @@ types exist: VFL_TYPE_GRABBER: videoX for video input/output devices VFL_TYPE_VBI: vbiX for vertical blank data (i.e. closed captions, teletext) VFL_TYPE_RADIO: radioX for radio tuners +VFL_TYPE_SDR: swradioX for Software Defined Radio tuners The last argument gives you a certain amount of control over the device device node number used (i.e. the X in videoX). Normally you will pass -1
Regards,
Hans