From patchwork Sun Apr 21 19:00:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 2469331 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C8F5ADF230 for ; Sun, 21 Apr 2013 19:00:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754135Ab3DUTAv (ORCPT ); Sun, 21 Apr 2013 15:00:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57193 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754052Ab3DUTAq (ORCPT ); Sun, 21 Apr 2013 15:00:46 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3LJ0kNo016031 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 21 Apr 2013 15:00:46 -0400 Received: from pedra (vpn1-7-177.gru2.redhat.com [10.97.7.177]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3LJ0fRb012496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Apr 2013 15:00:43 -0400 Received: from v4l by pedra with local (Exim 4.80.1) (envelope-from ) id 1UTzVA-0000ak-JX; Sun, 21 Apr 2013 16:00:40 -0300 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List Subject: [PATCH RFCv3 01/10] [media] Add initial SDR support at V4L2 API Date: Sun, 21 Apr 2013 16:00:30 -0300 Message-Id: <1366570839-662-2-git-send-email-mchehab@redhat.com> In-Reply-To: <1366570839-662-1-git-send-email-mchehab@redhat.com> References: <1366570839-662-1-git-send-email-mchehab@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Adds the basic API bits for Software Digital Radio (SDR) at the V4L2 API. A normal radio device is actually radio and hardware demod. As the demod is in hardware, several things that are required for the demodulate the signal (IF, bandwidth, sample rate, RF/IF filters, etc) are internal to the device and aren't part of the API. SDR radio, on the other hand, requires that every control needed by the tuner to be exposed on userspace, as userspace needs to adjust the software decoder to match it. As proposed at: http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/63123 Add a new device node for SDR devices, and a VIDIOC_QUERYCAP capability (V4L2_CAP_SDR) to indicate that a devnode is SDR. The stream output format also needs to be different, as it should output sample data, instead of video streams. As we need to document SDR, add one initial format there that will be later be used. Signed-off-by: Mauro Carvalho Chehab --- Documentation/DocBook/media/v4l/common.xml | 35 ++++++++++++++++++ Documentation/DocBook/media/v4l/pixfmt.xml | 41 ++++++++++++++++++++++ Documentation/DocBook/media/v4l/v4l2.xml | 1 + .../DocBook/media/v4l/vidioc-querycap.xml | 7 ++++ drivers/media/v4l2-core/v4l2-dev.c | 3 ++ include/media/v4l2-dev.h | 3 +- include/uapi/linux/videodev2.h | 11 ++++++ 7 files changed, 100 insertions(+), 1 deletion(-) diff --git a/Documentation/DocBook/media/v4l/common.xml b/Documentation/DocBook/media/v4l/common.xml index 1ddf354..f59c67d 100644 --- a/Documentation/DocBook/media/v4l/common.xml +++ b/Documentation/DocBook/media/v4l/common.xml @@ -513,6 +513,41 @@ the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl when the device has one or more modulators. +
+ Software Digital Radio (SDR) Tuners and Modulators + + Those devices are special types of Radio devices that don't +have any analog demodulator. Instead, it samples the radio IF or baseband +and sends the samples for userspace to demodulate. +
+ Tuners + + SDR receivers can have one or more tuners sampling RF signals. +Each tuner is associated with one or more inputs, depending on the number +of RF connectors on the tuner. The type field of +the respective &v4l2-input; returned by the &VIDIOC-ENUMINPUT; ioctl is set to +V4L2_INPUT_TYPE_TUNER and its +tuner field contains the index number of +the tuner input. + +To query and change tuner properties applications use the +&VIDIOC-G-TUNER; and &VIDIOC-S-TUNER; ioctl, respectively. The +&v4l2-tuner; returned by VIDIOC_G_TUNER also +contains signal status information applicable when the tuner of the +current SDR input is queried. In order to change the SDR input, +VIDIOC_S_TUNER with a new SDR index should be called. +Drivers must support both ioctls and set the +V4L2_CAP_SDR and V4L2_CAP_TUNER +flags in the &v4l2-capability; returned by the &VIDIOC-QUERYCAP; ioctl. +
+ +
+ Modulators + To be defined. +
+
+ +
Radio Frequency diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml index 99b8d2a..e30075e 100644 --- a/Documentation/DocBook/media/v4l/pixfmt.xml +++ b/Documentation/DocBook/media/v4l/pixfmt.xml @@ -203,6 +203,47 @@ codes can be used.
+
+ SDR format struture + + struct <structname>v4l2_sdr_format</structname> + + &cs-str; + + + __u32 + sampleformat + The format of the samples used by the SDR device. + This is a little endian + + four character code. + + + +
+ + SDR formats + + &cs-str; + + + V4L2_SDR_FMT_I8Q8 + Samples are given by a sequence of 8 bits in-phase(I) and + 8 bits quadrature (Q) samples taken from a + signal(t) represented by the following + expression: + + signal(t) = I cos(2π f t) - Q sin(2π f t) + signal(t) = I * cos(2π fc t) - Q * sin(2π fc t) + + + + + +
+ +
+
Standard Image Formats diff --git a/Documentation/DocBook/media/v4l/v4l2.xml b/Documentation/DocBook/media/v4l/v4l2.xml index bfc93cd..b53a5cf 100644 --- a/Documentation/DocBook/media/v4l/v4l2.xml +++ b/Documentation/DocBook/media/v4l/v4l2.xml @@ -521,6 +521,7 @@ and discussions on the V4L mailing list.
&sub-dev-teletext;
&sub-dev-radio;
&sub-dev-rds;
+
&sub-dev-sdr;
&sub-dev-event;
&sub-dev-subdev;
diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml b/Documentation/DocBook/media/v4l/vidioc-querycap.xml index d5a3c97..97bb25a 100644 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml @@ -296,6 +296,13 @@ modulator programming see . + V4L2_CAP_SDR + 0x00100000 + The device is a Software Digital Radio. + For more information about SDR programming see +. + + V4L2_CAP_READWRITE 0x01000000 The device supports the