All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC v6 00/12] SDR API with documentation
@ 2013-12-29  4:03 Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 01/12] v4l: add device type for Software Defined Radio Antti Palosaari
                   ` (11 more replies)
  0 siblings, 12 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

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

-- 
1.8.4.2


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 01/12] v4l: add device type for Software Defined Radio
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 02/12] v4l: add new tuner types for SDR Antti Palosaari
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Add new V4L device type VFL_TYPE_SDR for Software Defined Radio.
It is registered as /dev/swradio0 (/dev/sdr0 was already reserved).

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/v4l2-core/v4l2-dev.c | 6 ++++++
 include/media/v4l2-dev.h           | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 1cc1749..a034b4c 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -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);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index c768c9f..eec6e46 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -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. */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 02/12] v4l: add new tuner types for SDR
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 01/12] v4l: add device type for Software Defined Radio Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 03/12] v4l: 1 Hz resolution flag for tuners Antti Palosaari
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Define 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.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 39 ++++++++++++++++++++++++++----------
 include/uapi/linux/videodev2.h       |  2 ++
 2 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e..0397fc6 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -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)) {
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 437f1b0..3fff116 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -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 {
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 03/12] v4l: 1 Hz resolution flag for tuners
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 01/12] v4l: add device type for Software Defined Radio Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 02/12] v4l: add new tuner types for SDR Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 04/12] v4l: add stream format for SDR receiver Antti Palosaari
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Add V4L2_TUNER_CAP_1HZ for 1 Hz resolution.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 3fff116..97a5e50 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -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
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 04/12] v4l: add stream format for SDR receiver
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (2 preceding siblings ...)
  2013-12-29  4:03 ` [PATCH RFC v6 03/12] v4l: 1 Hz resolution flag for tuners Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 05/12] v4l: define own IOCTL ops for SDR FMT Antti Palosaari
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Add new V4L2 stream format definition, V4L2_BUF_TYPE_SDR_CAPTURE,
for SDR receiver.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 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(+)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 0397fc6..be06c21 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -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);
 
diff --git a/include/trace/events/v4l2.h b/include/trace/events/v4l2.h
index ef94eca..b9bb1f2 100644
--- a/include/trace/events/v4l2.h
+++ b/include/trace/events/v4l2.h
@@ -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)						\
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 97a5e50..c50e449 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -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;
 };
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 05/12] v4l: define own IOCTL ops for SDR FMT
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (3 preceding siblings ...)
  2013-12-29  4:03 ` [PATCH RFC v6 04/12] v4l: add stream format for SDR receiver Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 06/12] v4l: enable some IOCTLs for SDR receiver Antti Palosaari
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Use own format ops for SDR data:
vidioc_enum_fmt_sdr_cap
vidioc_g_fmt_sdr_cap
vidioc_s_fmt_sdr_cap
vidioc_try_fmt_sdr_cap

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 include/media/v4l2-ioctl.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e0b74a4..8be32f5 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -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);
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 06/12] v4l: enable some IOCTLs for SDR receiver
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (4 preceding siblings ...)
  2013-12-29  4:03 ` [PATCH RFC v6 05/12] v4l: define own IOCTL ops for SDR FMT Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2013-12-29  4:03 ` [PATCH RFC v6 07/12] v4l: add device capability flag " Antti Palosaari
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Enable stream format (FMT) IOCTLs for SDR use. These are used for negotiate
used data stream format.

Reorganise some some IOCTL selection logic.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
---
 drivers/media/v4l2-core/v4l2-dev.c   | 21 ++++++++++++++++++---
 drivers/media/v4l2-core/v4l2-ioctl.c | 35 +++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index a034b4c..84b2a84 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -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);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index be06c21..7bd910b 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -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;
 }
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (5 preceding siblings ...)
  2013-12-29  4:03 ` [PATCH RFC v6 06/12] v4l: enable some IOCTLs for SDR receiver Antti Palosaari
@ 2013-12-29  4:03 ` Antti Palosaari
  2014-01-05 12:13   ` Hans Verkuil
  2013-12-29  4:04 ` [PATCH RFC v6 08/12] v4l: do not allow modulator ioctls for non-radio devices Antti Palosaari
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:03 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

VIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new
capability flag to inform given device supports SDR capture.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
---
 include/uapi/linux/videodev2.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index c50e449..f596b7b 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -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 */
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 08/12] v4l: do not allow modulator ioctls for non-radio devices
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (6 preceding siblings ...)
  2013-12-29  4:03 ` [PATCH RFC v6 07/12] v4l: add device capability flag " Antti Palosaari
@ 2013-12-29  4:04 ` Antti Palosaari
  2013-12-29  4:04 ` [PATCH RFC v6 09/12] DocBook: fix wait.c location Antti Palosaari
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:04 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Hans Verkuil, Antti Palosaari

From: Hans Verkuil <hverkuil@xs4all.nl>

Modulator ioctls could be enabled mistakenly for non-radio devices.
Currently those ioctls are only valid for radio. Fix it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/v4l2-core/v4l2-dev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index 84b2a84..db76b0a 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -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);
 	}
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 09/12] DocBook: fix wait.c location
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (7 preceding siblings ...)
  2013-12-29  4:04 ` [PATCH RFC v6 08/12] v4l: do not allow modulator ioctls for non-radio devices Antti Palosaari
@ 2013-12-29  4:04 ` Antti Palosaari
  2013-12-29  4:04 ` [PATCH RFC v6 10/12] DocBook: document 1 Hz flag Antti Palosaari
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:04 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Documentation did not compile as wait.c location was wrong.

Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 Documentation/DocBook/device-drivers.tmpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl
index 6c9d9d3..f517008 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -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
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 10/12] DocBook: document 1 Hz flag
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (8 preceding siblings ...)
  2013-12-29  4:04 ` [PATCH RFC v6 09/12] DocBook: fix wait.c location Antti Palosaari
@ 2013-12-29  4:04 ` Antti Palosaari
  2014-01-05 12:04   ` Hans Verkuil
  2013-12-29  4:04 ` [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface Antti Palosaari
  2013-12-29  4:04 ` [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type Antti Palosaari
  11 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:04 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Update documention to reflect 1 Hz frequency step flag.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 .../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(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
index 6541ba0..60ad9ea 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
index c7a1c46..01870c4 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
index 7f4ac7e..7068b59 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
index 6cc8201..b0d8659 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
@@ -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&nbsp;Hz, otherwise in units of 62.5&nbsp;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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
index 5b379e7..a5fc4c4 100644
--- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
@@ -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>
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (9 preceding siblings ...)
  2013-12-29  4:04 ` [PATCH RFC v6 10/12] DocBook: document 1 Hz flag Antti Palosaari
@ 2013-12-29  4:04 ` Antti Palosaari
  2014-01-05 12:11   ` Hans Verkuil
  2013-12-29  4:04 ` [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type Antti Palosaari
  11 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:04 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Document V4L2 SDR interface.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 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

diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
index 0c7195e..85fb864 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -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>
 
diff --git a/Documentation/DocBook/media/v4l/dev-sdr.xml b/Documentation/DocBook/media/v4l/dev-sdr.xml
new file mode 100644
index 0000000..db4859f
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/dev-sdr.xml
@@ -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>
+
+    <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
+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.
+    </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
+<link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl
+must be supported too.
+    </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">
+          <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" />
+           </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>
diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml
index 2c4c068..1fb11e8 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
index 8469fe1..a27fcae 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index ee8f56e..ffed137 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -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>
diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
index d5a3c97..370d49d 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
@@ -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
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type
  2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
                   ` (10 preceding siblings ...)
  2013-12-29  4:04 ` [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface Antti Palosaari
@ 2013-12-29  4:04 ` Antti Palosaari
  2014-01-05 12:15   ` Hans Verkuil
  11 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2013-12-29  4:04 UTC (permalink / raw)
  To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Antti Palosaari

Add SDR device type to v4l2-framework.txt document.

Cc: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 Documentation/video4linux/v4l2-framework.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
index 6c4866b..ae3a2cc 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -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
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 10/12] DocBook: document 1 Hz flag
  2013-12-29  4:04 ` [PATCH RFC v6 10/12] DocBook: document 1 Hz flag Antti Palosaari
@ 2014-01-05 12:04   ` Hans Verkuil
  0 siblings, 0 replies; 20+ messages in thread
From: Hans Verkuil @ 2014-01-05 12:04 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media, Mauro Carvalho Chehab

More small fixes:

On 12/29/2013 05:04 AM, Antti Palosaari wrote:
> Update documention to reflect 1 Hz frequency step flag.

documention -> documentation

> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  .../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(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
> index 6541ba0..60ad9ea 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-enum-freq-bands.xml
> @@ -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

Change to:

"Hz, for this frequency band. A 1 Hz unit is used when the <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

Change to:

"Hz, for this frequency band. A 1 Hz unit is used when the <structfield>capability</structfield> flag"

> +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry>
>  	  </row>
>  	  <row>
>  	    <entry>__u32</entry>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
> index c7a1c46..01870c4 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-frequency.xml
> @@ -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"

> +<constant>V4L2_TUNER_CAP_1HZ</constant> is set.</entry>
>  	  </row>
>  	  <row>
>  	    <entry>__u32</entry>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
> index 7f4ac7e..7068b59 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-modulator.xml
> @@ -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>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
> index 6cc8201..b0d8659 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-tuner.xml
> @@ -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&nbsp;Hz, otherwise in units of 62.5&nbsp;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>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
> index 5b379e7..a5fc4c4 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-s-hw-freq-seek.xml
> @@ -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>
> 

After making these minor changes you can add my:

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface
  2013-12-29  4:04 ` [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface Antti Palosaari
@ 2014-01-05 12:11   ` Hans Verkuil
  0 siblings, 0 replies; 20+ messages in thread
From: Hans Verkuil @ 2014-01-05 12:11 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media, Mauro Carvalho Chehab

More small fixes:

On 12/29/2013 05:04 AM, Antti Palosaari wrote:
> Document V4L2 SDR interface.
> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  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
> 
> diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml
> index 0c7195e..85fb864 100644
> --- a/Documentation/DocBook/media/v4l/compat.xml
> +++ b/Documentation/DocBook/media/v4l/compat.xml
> @@ -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>
>  
> diff --git a/Documentation/DocBook/media/v4l/dev-sdr.xml b/Documentation/DocBook/media/v4l/dev-sdr.xml
> new file mode 100644
> index 0000000..db4859f
> --- /dev/null
> +++ b/Documentation/DocBook/media/v4l/dev-sdr.xml
> @@ -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>
> +
> +    <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/

> +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.
> +    </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/

> +<link linkend="format">format</link> ioctls, the &VIDIOC-ENUM-FMT; ioctl
> +must be supported too.

s/too/as well/

> +    </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">
> +          <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.

> +           </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>
> diff --git a/Documentation/DocBook/media/v4l/io.xml b/Documentation/DocBook/media/v4l/io.xml
> index 2c4c068..1fb11e8 100644
> --- a/Documentation/DocBook/media/v4l/io.xml
> +++ b/Documentation/DocBook/media/v4l/io.xml
> @@ -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>
> diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml
> index 8469fe1..a27fcae 100644
> --- a/Documentation/DocBook/media/v4l/v4l2.xml
> +++ b/Documentation/DocBook/media/v4l/v4l2.xml
> @@ -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>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> index ee8f56e..ffed137 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
> @@ -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>
> diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> index d5a3c97..370d49d 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> @@ -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
> 

Regards,

	Hans

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
  2013-12-29  4:03 ` [PATCH RFC v6 07/12] v4l: add device capability flag " Antti Palosaari
@ 2014-01-05 12:13   ` Hans Verkuil
  2014-01-14  1:44     ` Antti Palosaari
  0 siblings, 1 reply; 20+ messages in thread
From: Hans Verkuil @ 2014-01-05 12:13 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media, Mauro Carvalho Chehab

On 12/29/2013 05:03 AM, Antti Palosaari wrote:
> VIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new
> capability flag to inform given device supports SDR capture.
> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
> ---
>  include/uapi/linux/videodev2.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index c50e449..f596b7b 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type
  2013-12-29  4:04 ` [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type Antti Palosaari
@ 2014-01-05 12:15   ` Hans Verkuil
  0 siblings, 0 replies; 20+ messages in thread
From: Hans Verkuil @ 2014-01-05 12:15 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media, Mauro Carvalho Chehab

On 12/29/2013 05:04 AM, Antti Palosaari wrote:
> Add SDR device type to v4l2-framework.txt document.
> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  Documentation/video4linux/v4l2-framework.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
> index 6c4866b..ae3a2cc 100644
> --- a/Documentation/video4linux/v4l2-framework.txt
> +++ b/Documentation/video4linux/v4l2-framework.txt
> @@ -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
> 

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Regards,

	Hans

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
  2014-01-05 12:13   ` Hans Verkuil
@ 2014-01-14  1:44     ` Antti Palosaari
  2014-01-15 17:25       ` Antti Palosaari
  0 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2014-01-14  1:44 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Mauro Carvalho Chehab

On 05.01.2014 14:13, Hans Verkuil wrote:
> On 12/29/2013 05:03 AM, Antti Palosaari wrote:
>> VIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new
>> capability flag to inform given device supports SDR capture.
>>
>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>> Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
>> ---
>>   include/uapi/linux/videodev2.h | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
>> index c50e449..f596b7b 100644
>> --- a/include/uapi/linux/videodev2.h
>> +++ b/include/uapi/linux/videodev2.h
>> @@ -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).

It is already.

regards
Antti


-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
  2014-01-14  1:44     ` Antti Palosaari
@ 2014-01-15 17:25       ` Antti Palosaari
  2014-01-15 18:18         ` Hans Verkuil
  0 siblings, 1 reply; 20+ messages in thread
From: Antti Palosaari @ 2014-01-15 17:25 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, Mauro Carvalho Chehab

On 14.01.2014 03:44, Antti Palosaari wrote:
> On 05.01.2014 14:13, Hans Verkuil wrote:
>> On 12/29/2013 05:03 AM, Antti Palosaari wrote:
>>> VIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new
>>> capability flag to inform given device supports SDR capture.
>>>
>>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>>> Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
>>> ---
>>>   include/uapi/linux/videodev2.h | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/include/uapi/linux/videodev2.h
>>> b/include/uapi/linux/videodev2.h
>>> index c50e449..f596b7b 100644
>>> --- a/include/uapi/linux/videodev2.h
>>> +++ b/include/uapi/linux/videodev2.h
>>> @@ -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).
>
> It is already.

There is following related flags:

V4L2_CAP_TUNER
V4L2_CAP_RADIO
V4L2_CAP_MODULATOR
V4L2_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

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH RFC v6 07/12] v4l: add device capability flag for SDR receiver
  2014-01-15 17:25       ` Antti Palosaari
@ 2014-01-15 18:18         ` Hans Verkuil
  0 siblings, 0 replies; 20+ messages in thread
From: Hans Verkuil @ 2014-01-15 18:18 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media, Mauro Carvalho Chehab

On 01/15/2014 06:25 PM, Antti Palosaari wrote:
> On 14.01.2014 03:44, Antti Palosaari wrote:
>> On 05.01.2014 14:13, Hans Verkuil wrote:
>>> On 12/29/2013 05:03 AM, Antti Palosaari wrote:
>>>> VIDIOC_QUERYCAP IOCTL is used to query device capabilities. Add new
>>>> capability flag to inform given device supports SDR capture.
>>>>
>>>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>>>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>>>> Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
>>>> ---
>>>>   include/uapi/linux/videodev2.h | 2 ++
>>>>   1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/include/uapi/linux/videodev2.h
>>>> b/include/uapi/linux/videodev2.h
>>>> index c50e449..f596b7b 100644
>>>> --- a/include/uapi/linux/videodev2.h
>>>> +++ b/include/uapi/linux/videodev2.h
>>>> @@ -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).
>>
>> It is already.
> 
> There is following related flags:
> 
> V4L2_CAP_TUNER
> V4L2_CAP_RADIO
> V4L2_CAP_MODULATOR
> V4L2_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?

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.

> 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?

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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2014-01-15 18:18 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-29  4:03 [PATCH RFC v6 00/12] SDR API with documentation Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 01/12] v4l: add device type for Software Defined Radio Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 02/12] v4l: add new tuner types for SDR Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 03/12] v4l: 1 Hz resolution flag for tuners Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 04/12] v4l: add stream format for SDR receiver Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 05/12] v4l: define own IOCTL ops for SDR FMT Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 06/12] v4l: enable some IOCTLs for SDR receiver Antti Palosaari
2013-12-29  4:03 ` [PATCH RFC v6 07/12] v4l: add device capability flag " Antti Palosaari
2014-01-05 12:13   ` Hans Verkuil
2014-01-14  1:44     ` Antti Palosaari
2014-01-15 17:25       ` Antti Palosaari
2014-01-15 18:18         ` Hans Verkuil
2013-12-29  4:04 ` [PATCH RFC v6 08/12] v4l: do not allow modulator ioctls for non-radio devices Antti Palosaari
2013-12-29  4:04 ` [PATCH RFC v6 09/12] DocBook: fix wait.c location Antti Palosaari
2013-12-29  4:04 ` [PATCH RFC v6 10/12] DocBook: document 1 Hz flag Antti Palosaari
2014-01-05 12:04   ` Hans Verkuil
2013-12-29  4:04 ` [PATCH RFC v6 11/12] DocBook: Software Defined Radio Interface Antti Palosaari
2014-01-05 12:11   ` Hans Verkuil
2013-12-29  4:04 ` [PATCH RFC v6 12/12] v4l2-framework.txt: add SDR device type Antti Palosaari
2014-01-05 12:15   ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.