[PATCH] [media] v4l2-dv-timings: fix GTF calculation

2014-01-23 Thread Martin Bugge
Round off image width to nearest 8 (GTF_CELL_GRAN)

A source sending a GTF (Generalized Timing Formula) format have no means of
signalling image width. The assumed aspect ratio may result in an odd image
width but according to the standard image width should be in multiple of 8.

Cc: Mats Randgaard matra...@cisco.com
Cc: Hans Verkuil hans.verk...@cisco.com
Signed-off-by: Martin Bugge marbu...@cisco.com
---
 drivers/media/v4l2-core/v4l2-dv-timings.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
b/drivers/media/v4l2-core/v4l2-dv-timings.c
index ee52b9f4..f7902fe 100644
--- a/drivers/media/v4l2-core/v4l2-dv-timings.c
+++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
@@ -515,6 +515,7 @@ bool v4l2_detect_gtf(unsigned frame_height,
aspect.denominator = 9;
}
image_width = ((image_height * aspect.numerator) / aspect.denominator);
+   image_width = (image_width + GTF_CELL_GRAN/2)  ~(GTF_CELL_GRAN - 1);
 
/* Horizontal */
if (default_gtf)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks

2014-01-23 Thread Kamil Debski
Hi Amit,

 From: Amit Grover [mailto:amit.gro...@samsung.com]
 Sent: Monday, December 30, 2013 11:43 AM
 
 This patch adds Controls to set Horizontal and Vertical search range
 for Motion Estimation block for Samsung MFC video Encoders.
 
 Signed-off-by: Swami Nathan swaminat...@samsung.com
 Signed-off-by: Amit Grover amit.gro...@samsung.com
 ---
  Documentation/DocBook/media/v4l/controls.xml|   14 +
  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 ++
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   24
 +++
  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |8 ++--
  drivers/media/v4l2-core/v4l2-ctrls.c|   14 +
  include/uapi/linux/v4l2-controls.h  |2 ++
  6 files changed, 58 insertions(+), 6 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 7a3b49b..70a0f6f 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -2258,6 +2258,20 @@ Applicable to the MPEG1, MPEG2, MPEG4
 encoders./entry
  VBV buffer control./entry
 /row
 
 +   rowentry/entry/row
 +   row id=v4l2-mpeg-video-horz-search-range
 + entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE/constant

HORZ is nowhere used. HOR is more commonly used in control names.
V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE seems better.

 nbsp;/entry
 + entryinteger/entry
 +   /rowrowentry spanname=descrSets the Horizontal
 search range for Video Macro blocks./entry
 +   /row

It's expressed in pixels? If so then it should be mentioned here. Also I
think this lacks the mention that it is used for motion estimation.
Please add a more detailed description.

 +
 +  rowentry/entry/row
 +   row id=v4l2-mpeg-video-vert-search-range
 + entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE/constant
 nbsp;/entry

V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE seems better.

 + entryinteger/entry
 +   /rowrowentry spanname=descrSets the Vertical search
 range for Video Macro blocks./entry
 +   /row
 +

This description is too vague as well.

 rowentry/entry/row
 row
   entry
 spanname=idconstantV4L2_CID_MPEG_VIDEO_H264_CPB_SIZE/constantnb
 sp;/entry
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 index 6920b54..f2c13c3 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
 @@ -430,6 +430,8 @@ struct s5p_mfc_vp8_enc_params {
  struct s5p_mfc_enc_params {
   u16 width;
   u16 height;
 + u32 horz_range;
 + u32 vert_range;

mv_h_range ?
mv_v_range ?

 
   u16 gop_size;
   enum v4l2_mpeg_video_multi_slice_mode slice_mode;
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index 4ff3b6c..a02e7b8 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
   .default_value = 0,
   },
   {
 + .id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
 + .type = V4L2_CTRL_TYPE_INTEGER,
 + .name = horizontal search range of video macro block,

This too should be property capitalised. Please mention the motion vectors
too.

 + .minimum = 16,
 + .maximum = 128,
 + .step = 16,
 + .default_value = 32,
 + },
 + {
 + .id = V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE,
 + .type = V4L2_CTRL_TYPE_INTEGER,
 + .name = vertical search range of video macro block,

This too should be property capitalised. Please mention the motion vectors
too.

 + .minimum = 16,
 + .maximum = 128,
 + .step = 16,
 + .default_value = 32,
 + },
 + {
   .id = V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE,
   .type = V4L2_CTRL_TYPE_INTEGER,
   .minimum = 0,
 @@ -1377,6 +1395,12 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl
 *ctrl)
   case V4L2_CID_MPEG_VIDEO_VBV_SIZE:
   p-vbv_size = ctrl-val;
   break;
 + case V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE:
 + p-horz_range = ctrl-val;
 + break;
 + case V4L2_CID_MPEG_VIDEO_VERT_SEARCH_RANGE:
 + p-vert_range = ctrl-val;
 + break;
   case V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE:
   p-codec.h264.cpb_size = ctrl-val;
   break;
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 index 461358c..47e1807 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
 +++ 

Re: [PATCH] [media] s5p-mfc: Add Horizontal and Vertical search range for Video Macro Blocks

2014-01-23 Thread Sylwester Nawrocki
Hi,

On 23/01/14 11:11, Kamil Debski wrote:
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  index 4ff3b6c..a02e7b8 100644
  --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  @@ -208,6 +208,24 @@ static struct mfc_control controls[] = {
 .default_value = 0,
 },
 {
  +  .id = V4L2_CID_MPEG_VIDEO_HORZ_SEARCH_RANGE,
  +  .type = V4L2_CTRL_TYPE_INTEGER,
  +  .name = horizontal search range of video macro block,

 This too should be property capitalised. Please mention the motion vectors
 too. 

And additionally length of the name string should not exceed 31 characters.

--
Thanks,
Sylwester
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] uvc: simplify redundant check

2014-01-23 Thread oliver
From: Oliver Neukum oneu...@suse.de

x  constant implies x + unsigned  constant
That check just obfuscates the code

Signed-off-by: Oliver Neukum oneu...@suse.de
---
 drivers/media/usb/uvc/uvc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c 
b/drivers/media/usb/uvc/uvc_driver.c
index c3bb250..b6cac17 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device 
*dev,
case UVC_VC_HEADER:
n = buflen = 12 ? buffer[11] : 0;
 
-   if (buflen  12 || buflen  12 + n) {
+   if (buflen  12 + n) {
uvc_trace(UVC_TRACE_DESCR, device %d videocontrol 
interface %d HEADER error\n, udev-devnum,
alts-desc.bInterfaceNumber);
-- 
1.8.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] uvc: simplify redundant check

2014-01-23 Thread oliver
From: Oliver Neukum oneu...@suse.de

x  constant implies x + unsigned  constant
That check just obfuscates the code

Signed-off-by: Oliver Neukum oneu...@suse.de
---
 drivers/media/usb/uvc/uvc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c 
b/drivers/media/usb/uvc/uvc_driver.c
index c3bb250..b6cac17 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device 
*dev,
case UVC_VC_HEADER:
n = buflen = 12 ? buffer[11] : 0;
 
-   if (buflen  12 || buflen  12 + n) {
+   if (buflen  12 + n) {
uvc_trace(UVC_TRACE_DESCR, device %d videocontrol 
interface %d HEADER error\n, udev-devnum,
alts-desc.bInterfaceNumber);
-- 
1.8.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] v4l2-dv-timings: fix GTF calculation

2014-01-23 Thread Hans Verkuil
Reviewed-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

On 01/23/14 10:40, Martin Bugge wrote:
 Round off image width to nearest 8 (GTF_CELL_GRAN)
 
 A source sending a GTF (Generalized Timing Formula) format have no means of
 signalling image width. The assumed aspect ratio may result in an odd image
 width but according to the standard image width should be in multiple of 8.
 
 Cc: Mats Randgaard matra...@cisco.com
 Cc: Hans Verkuil hans.verk...@cisco.com
 Signed-off-by: Martin Bugge marbu...@cisco.com
 ---
  drivers/media/v4l2-core/v4l2-dv-timings.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c 
 b/drivers/media/v4l2-core/v4l2-dv-timings.c
 index ee52b9f4..f7902fe 100644
 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c
 +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c
 @@ -515,6 +515,7 @@ bool v4l2_detect_gtf(unsigned frame_height,
   aspect.denominator = 9;
   }
   image_width = ((image_height * aspect.numerator) / aspect.denominator);
 + image_width = (image_width + GTF_CELL_GRAN/2)  ~(GTF_CELL_GRAN - 1);
  
   /* Horizontal */
   if (default_gtf)
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] uvc: simplify redundant check

2014-01-23 Thread Laurent Pinchart
Hi Oliver,

Thank you for the patch.

On Thursday 23 January 2014 11:28:24 oli...@neukum.org wrote:
 From: Oliver Neukum oneu...@suse.de
 
 x  constant implies x + unsigned  constant
 That check just obfuscates the code
 
 Signed-off-by: Oliver Neukum oneu...@suse.de

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

I've applied the patch to my tree and will send a pull request for v3.15.

 ---
  drivers/media/usb/uvc/uvc_driver.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/media/usb/uvc/uvc_driver.c
 b/drivers/media/usb/uvc/uvc_driver.c index c3bb250..b6cac17 100644
 --- a/drivers/media/usb/uvc/uvc_driver.c
 +++ b/drivers/media/usb/uvc/uvc_driver.c
 @@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device
 *dev, case UVC_VC_HEADER:
   n = buflen = 12 ? buffer[11] : 0;
 
 - if (buflen  12 || buflen  12 + n) {
 + if (buflen  12 + n) {
   uvc_trace(UVC_TRACE_DESCR, device %d videocontrol 
   interface %d HEADER error\n, udev-devnum,
   alts-desc.bInterfaceNumber);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2] Device Tree bindings for OMAP3 Camera System

2014-01-23 Thread Laurent Pinchart
Hi Sebastian,

On Thursday 23 January 2014 01:11:29 Sebastian Reichel wrote:
 On Wed, Jan 22, 2014 at 11:57:45PM +0100, Laurent Pinchart wrote:
  [...]
  
  camera-switch {
  
   /*
   
* TODO:
*  - check if the switching code is generic enough to use a
*more generic name like gpio-camera-switch.
  
  I think you can use a more generic name. You could probably get some
  inspiration from the i2c-mux-gpio DT bindings.
 
 My main concern is, that the gpio used for switching is also connected to
 the reset pin of one of the cameras. Maybe that fact can just be neglected,
 though?

I'm not the only one to wish we could change that, but alas! we'll have to 
live with that stupid hardware design decision :-)

What we want to ensure here is that the two sensors won't be accessed at the 
same time, as that would lead to errors. This was previously handled by 
callback function to board code, but board code is now going away. The 
challenge is to find a way to express the constraints in DT. I'm not sure 
whether that's doable in a generic way, and this might be one of the rare 
cases where board code is still needed.

Sakari, have you given this a thought ?

-- 
Regards,

Laurent Pinchart


signature.asc
Description: This is a digitally signed message part.


Re: [RFCv2 PATCH 06/21] v4l2-ctrls: add support for complex types.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:45, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 This patch implements initial support for complex types.
 
 For the most part the changes are fairly obvious (basic support for is_ptr
 types, the type_is_int function is replaced by a is_int bitfield, and
 v4l2_query_ext_ctrl is added), but one change needs more explanation:
 
 The v4l2_ctrl struct adds a 'new' field and a 'stores' array at the end
 of the struct. This is in preparation for future patches where each control
 can have multiple configuration stores. The idea is that stores[0] is the 
 current
 control value, stores[1] etc. are the control values for each configuration 
 store
 and the 'new' value can be accessed through 'stores[-1]', i.e. the 'new' 
 field.
 However, for now only stores[-1] and stores[0] is used.

I guess it implies an assumption that (maximum) number of configuration stores
is known before creating the control ?

Regarding the negative array indexes, I guess I would just stick with using 
the 'new' field :-)

 These new fields use the v4l2_ctrl_ptr union, which is a pointer to a control
 value.
 
 Note that these two new fields are not yet actually used.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com

--
Regards,
Sylwester


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 07/21] v4l2: integrate support for VIDIOC_QUERY_EXT_CTRL.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Perhaps we can have a bit more information than this in commit
description.

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 00/21] Add support for complex controls

2014-01-23 Thread Hans Verkuil
On 01/22/14 23:44, Sylwester Nawrocki wrote:
 Hello Hans,
 
 On 01/20/2014 01:45 PM, Hans Verkuil wrote:
 This patch series adds support for complex controls (aka 'Properties') to
 the control framework. It is the first part of a larger patch series that
 adds support for configuration stores, motion detection matrix controls and
 support for 'Multiple Selections'.

 This patch series is based on this RFC:

 http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/71822

 A more complete patch series (including configuration store support and the
 motion detection work) can be found here:

 http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/propapi-doc

 This patch series is a revision of this series:

 http://www.spinics.net/lists/linux-media/msg71281.html

 Changes since RFCv1 are:

 - dropped configuration store support for now (there is no driver at the 
 moment
that needs it).
 - dropped the term 'property', instead call it a 'control with a complex 
 type'
or 'complex control' for short.
 - added DocBook documentation.

 The API changes required to support complex controls are minimal:

 - A new V4L2_CTRL_FLAG_HIDDEN has been added: any control with this flag (and
complex controls will always have this flag) will never be shown by 
 control
panel GUIs. The only way to discover them is to pass the new 
 _FLAG_NEXT_HIDDEN
flag to QUERYCTRL.
 
 I had issues with using _HIDDEN for this at first but after thinking a bit 
 more
 it seems sensible.
 
 - A new VIDIOC_QUERY_EXT_CTRL ioctl has been added: needed to get the number 
 of elements
stored in the control (rows by columns) and the size in byte of each 
 element.
As a bonus feature a unit string has also been added as this has been 
 requested
in the past. In addition min/max/step/def values are now 64-bit.

 - A new 'p' field is added to struct v4l2_ext_control to set/get complex 
 values.

 - A helper flag V4L2_CTRL_FLAG_IS_PTR has been added to tell apps whether the
'value' or 'value64' fields of the v4l2_ext_control struct can be used 
 (bit
is cleared) or if the 'p' pointer can be used (bit it set).

 There is one open item: if a complex control is a matrix, then it is possible
 to set only the first N elements of that matrix (starting at the first row).
 Currently the API will initialize the remaining elements to their default
 value. The idea was that if you have an array of, say, selection
 rectangles, then if you just set the first one the others will be 
 automatically
 zeroed (i.e. set to unused). Without that you would be forced to set the 
 whole
 array unless you are certain that they are already zeroed.

 It also has the advantage that when you set a control you know that all 
 elements
 are set, even if you don't specify them all.

 Should I support the ability to set only the first N elements of a matrix at 
 all?

 I see three options:

 1) allow getting/setting only the first N elements and (when setting) 
 initialize
 the remaining elements to their default value.
 2) allow getting/setting only the first N elements and leave the remaining
 elements to their old value.
 3) always set the full matrix.

 I am actually leaning towards 3 as that is the only unambiguous option. If 
 there
 is a good use case in the future support for 1 or 2 can always be added 
 later.
 
 My feeling is that setting/getting only part of the matrix might be a useful
 feature. Weren't you using struct v4l2_rect to select part of the matrix ?

Yes, in an earlier version of this project. However, it became too complex.
It suffered from the same problem as with initializing the first N elements,
but in addition it made the API and internal implementation overly complex.

The reality is that the only use-case where this would be useful is for large
matrices where you often need to update a sub-rectangle.

I do have large matrices (motion detection regions and thresholds), but you
typically set those up only once and you rarely change those on-the-fly.

 Anyway, if there is no real need for {s,g}etting only part of the matrix yet
 and adding it later won't be troublesome it seems reasonable to just start
 with 3) for now.

Yeah, the more I think about it, the more I believe that that's the best
approach.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Conexant PCI-8604PW 4 channel BNC Video capture card (bttv)

2014-01-23 Thread Daniel Glöckner
On Wed, Jan 22, 2014 at 06:15:44PM +, Robert Longbottom wrote:
 On 22/01/14 13:50, Daniel Glöckner wrote:
 This is strange. There are 7 different IRQs assigned to that card but
 PCI slots only have 4. According to the pictures each 878A gets one of
 these. The .0 and .1 functions of a 878A must always share the same IRQ.

It seems the .1 functions still show the IRQ assigned by the BIOS, while
the .0 functions had their IRQ reassigned when a driver was bound.
The .1 IRQ would probably have been reassigned as well if you tried
to use the audio driver. I don't think this is the problem.

Can you try to load bttv with irq_debug=1? 
This should generate a lot of output.

  Daniel
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 19/21] DocBook media: update VIDIOC_G/S/TRY_EXT_CTRLS.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   | 43 
 ++
  1 file changed, 35 insertions(+), 8 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml 
 b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 index b3bb957..bb383b9 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 @@ -72,23 +72,30 @@ initialize the structfieldid/structfield,
  structfieldsize/structfield and structfieldreserved2/structfield 
 fields
  of each v4l2-ext-control; and call the
  constantVIDIOC_G_EXT_CTRLS/constant ioctl. String controls controls
 -must also set the structfieldstring/structfield field./para
 +must also set the structfieldstring/structfield field. Controls
 +of complex types (constantV4L2_CTRL_FLAG_IS_PTR/constant is set)
 +must set the structfieldp/structfield field./para
  
  paraIf the structfieldsize/structfield is too small to
  receive the control result (only relevant for pointer-type controls
  like strings), then the driver will set structfieldsize/structfield
  to a valid value and return an ENOSPC;. You should re-allocate the
 -string memory to this new size and try again. It is possible that the
 -same issue occurs again if the string has grown in the meantime. It is
 +memory to this new size and try again. For the string type it is possible 
 that
 +the same issue occurs again if the string has grown in the meantime. It is
  recommended to call VIDIOC-QUERYCTRL; first and use
  structfieldmaximum/structfield+1 as the new 
 structfieldsize/structfield
  value. It is guaranteed that that is sufficient memory.
  /para
  
 +paraFor matrices it is possible to only get the first 
 constantX/constant
 +elements by setting size to constantX * elem_size/constant, where
 +structfieldelem_size/structfield is obtained by calling 
 VIDIOC-QUERY-EXT-CTRL;.
 +Matrix elements are returned row-by-row./para
 +
  paraTo change the value of a set of controls applications
  initialize the structfieldid/structfield, 
 structfieldsize/structfield,
  structfieldreserved2/structfield and
 -structfieldvalue/string/structfield fields of each v4l2-ext-control; and
 +structfieldvalue/value64/string/p/structfield fields of each 
 v4l2-ext-control; and
  call the constantVIDIOC_S_EXT_CTRLS/constant ioctl. The controls
  will only be set if emphasisall/emphasis control values are
  valid./para
 @@ -96,11 +103,17 @@ valid./para
  paraTo check if a set of controls have correct values applications
  initialize the structfieldid/structfield, 
 structfieldsize/structfield,
  structfieldreserved2/structfield and
 -structfieldvalue/string/structfield fields of each v4l2-ext-control; and
 +structfieldvalue/value64/string/p/structfield fields of each 
 v4l2-ext-control; and
  call the constantVIDIOC_TRY_EXT_CTRLS/constant ioctl. It is up to
  the driver whether wrong values are automatically adjusted to a valid
  value or if an error is returned./para
  
 +paraFor matrices it is possible to only set or check only the first
 +constantX/constant elements by setting size to constantX * 
 elem_size/constant,
 +where structfieldelem_size/structfield is obtained by calling 
 VIDIOC-QUERY-EXT-CTRL;.
 +Matrix elements are set row-by-row. Matrix elements that are not explicitly
 +set will be initialized to their default value./para

Presumably this could be more problematic than leaving the remaining part
of the matrix unchanged. I assume this paragraph is going to be removed ?

  paraWhen the structfieldid/structfield or
  structfieldctrl_class/structfield is invalid drivers return an
  EINVAL;. When the value is out of bounds drivers can choose to take
 @@ -158,19 +171,33 @@ applications must set the array to zero./entry
   entry/entry
   entry__s32/entry
   entrystructfieldvalue/structfield/entry
 - entryNew value or current value./entry
 + entryNew value or current value. Valid if this control is not of
 +type constantV4L2_CTRL_TYPE_INTEGER64/constant and
 +constantV4L2_CTRL_FLAG_IS_PTR/constant is not set./entry
 /row
 row
   entry/entry
   entry__s64/entry
   entrystructfieldvalue64/structfield/entry
 - entryNew value or current value./entry
 + entryNew value or current value. Valid if this control is of
 +type constantV4L2_CTRL_TYPE_INTEGER64/constant and
 +constantV4L2_CTRL_FLAG_IS_PTR/constant is not set./entry
 /row
 row
   entry/entry
   entrychar */entry
   entrystructfieldstring/structfield/entry
 - entryA pointer to a string./entry
 + entryA pointer to a string. Valid if this control is of
 +type constantV4L2_CTRL_TYPE_STRING/constant./entry
 +   /row
 +   row
 + 

Re: [RFCv2 PATCH 17/21] v4l2-ctrls.c: return elem_size instead of strlen

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 When getting a string and the size given by the application is too
 short return the max length the string can have (elem_size) instead
 of the string length + 1. That makes more sense.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 11/21] v4l2-ctrls: prepare for matrix support: add cols rows fields.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Add cols and rows fields to the core control structures in preparation
 for matrix support.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 19/21] DocBook media: update VIDIOC_G/S/TRY_EXT_CTRLS.

2014-01-23 Thread Hans Verkuil
On 01/23/2014 02:46 PM, Sylwester Nawrocki wrote:
 On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  .../DocBook/media/v4l/vidioc-g-ext-ctrls.xml   | 43 
 ++
  1 file changed, 35 insertions(+), 8 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml 
 b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 index b3bb957..bb383b9 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
 @@ -72,23 +72,30 @@ initialize the structfieldid/structfield,
  structfieldsize/structfield and structfieldreserved2/structfield 
 fields
  of each v4l2-ext-control; and call the
  constantVIDIOC_G_EXT_CTRLS/constant ioctl. String controls controls
 -must also set the structfieldstring/structfield field./para
 +must also set the structfieldstring/structfield field. Controls
 +of complex types (constantV4L2_CTRL_FLAG_IS_PTR/constant is set)
 +must set the structfieldp/structfield field./para
  
  paraIf the structfieldsize/structfield is too small to
  receive the control result (only relevant for pointer-type controls
  like strings), then the driver will set structfieldsize/structfield
  to a valid value and return an ENOSPC;. You should re-allocate the
 -string memory to this new size and try again. It is possible that the
 -same issue occurs again if the string has grown in the meantime. It is
 +memory to this new size and try again. For the string type it is possible 
 that
 +the same issue occurs again if the string has grown in the meantime. It is
  recommended to call VIDIOC-QUERYCTRL; first and use
  structfieldmaximum/structfield+1 as the new 
 structfieldsize/structfield
  value. It is guaranteed that that is sufficient memory.
  /para
  
 +paraFor matrices it is possible to only get the first 
 constantX/constant
 +elements by setting size to constantX * elem_size/constant, where
 +structfieldelem_size/structfield is obtained by calling 
 VIDIOC-QUERY-EXT-CTRL;.
 +Matrix elements are returned row-by-row./para
 +
  paraTo change the value of a set of controls applications
  initialize the structfieldid/structfield, 
 structfieldsize/structfield,
  structfieldreserved2/structfield and
 -structfieldvalue/string/structfield fields of each v4l2-ext-control; 
 and
 +structfieldvalue/value64/string/p/structfield fields of each 
 v4l2-ext-control; and
  call the constantVIDIOC_S_EXT_CTRLS/constant ioctl. The controls
  will only be set if emphasisall/emphasis control values are
  valid./para
 @@ -96,11 +103,17 @@ valid./para
  paraTo check if a set of controls have correct values applications
  initialize the structfieldid/structfield, 
 structfieldsize/structfield,
  structfieldreserved2/structfield and
 -structfieldvalue/string/structfield fields of each v4l2-ext-control; 
 and
 +structfieldvalue/value64/string/p/structfield fields of each 
 v4l2-ext-control; and
  call the constantVIDIOC_TRY_EXT_CTRLS/constant ioctl. It is up to
  the driver whether wrong values are automatically adjusted to a valid
  value or if an error is returned./para
  
 +paraFor matrices it is possible to only set or check only the first
 +constantX/constant elements by setting size to constantX * 
 elem_size/constant,
 +where structfieldelem_size/structfield is obtained by calling 
 VIDIOC-QUERY-EXT-CTRL;.
 +Matrix elements are set row-by-row. Matrix elements that are not explicitly
 +set will be initialized to their default value./para
 
 Presumably this could be more problematic than leaving the remaining part
 of the matrix unchanged. I assume this paragraph is going to be removed ?

Yes, that's going away.

Regards,

Hans

 
  paraWhen the structfieldid/structfield or
  structfieldctrl_class/structfield is invalid drivers return an
  EINVAL;. When the value is out of bounds drivers can choose to take
 @@ -158,19 +171,33 @@ applications must set the array to zero./entry
  entry/entry
  entry__s32/entry
  entrystructfieldvalue/structfield/entry
 -entryNew value or current value./entry
 +entryNew value or current value. Valid if this control is not of
 +type constantV4L2_CTRL_TYPE_INTEGER64/constant and
 +constantV4L2_CTRL_FLAG_IS_PTR/constant is not set./entry
/row
row
  entry/entry
  entry__s64/entry
  entrystructfieldvalue64/structfield/entry
 -entryNew value or current value./entry
 +entryNew value or current value. Valid if this control is of
 +type constantV4L2_CTRL_TYPE_INTEGER64/constant and
 +constantV4L2_CTRL_FLAG_IS_PTR/constant is not set./entry
/row
row
  entry/entry
  entrychar */entry
  entrystructfieldstring/structfield/entry
 -entryA pointer to a string./entry
 +entryA pointer to a string. Valid if this control is of
 +type 

Re: [RFCv2 PATCH 05/21] videodev2.h: add struct v4l2_query_ext_ctrl and VIDIOC_QUERY_EXT_CTRL.

2014-01-23 Thread Hans Verkuil
On 01/23/2014 12:02 AM, Sylwester Nawrocki wrote:
 On 01/20/2014 01:45 PM, Hans Verkuil wrote:
 From: Hans Verkuilhans.verk...@cisco.com

 Add a new struct and ioctl to extend the amount of information you can
 get for a control.

 It gives back a unit string, the range is now a s64 type, and the matrix
 and element size can be reported through cols/rows/elem_size.

 Signed-off-by: Hans Verkuilhans.verk...@cisco.com
 ---
   include/uapi/linux/videodev2.h | 30 ++
   1 file changed, 30 insertions(+)

 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index 4d7782a..9e5b7d4 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -1272,6 +1272,34 @@ struct v4l2_queryctrl {
  __u32reserved[2];
   };

 +/*  Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls 
 */
 +struct v4l2_query_ext_ctrl {
 +__u32id;
 +__u32type;
 +char name[32];
 +char unit[32];
 
 +union {
 +__s64 val;
 +__u32 reserved[4];
 +} min;
 +union {
 +__s64 val;
 +__u32 reserved[4];
 +} max;
 +union {
 +__u64 val;
 +__u32 reserved[4];
 +} step;
 +union {
 +__s64 val;
 +__u32 reserved[4];
 +} def;
 
 Are these reserved[] arrays of any use ?

Excellent question. I'd like to know as well :-)

The idea is that if the type of the control is complex, then for certain types
it might still make sense to have a range. E.g. say that the type is v4l2_rect,
then you can define min/max/step/def v4l2_rect entries in the unions. Ditto
for a v4l2_fract (it would be nice to be able to specify the min/max allowed
scaling factors, for example).

The question is, am I over-engineering or is this the best idea since sliced
bread? Without the 'reserved' part this idea will be impossible to implement,
and I don't think it hurts to have it in.

 
 +__u32flags;
 +__u32cols, rows;
 
 nit: I would put them on separate lines and use full words.

Separate lines: no problem, but do I really have to write 'columns' in full? :-(

Regards,

Hans

 
 +__u32elem_size;
 +__u32reserved[17];
 +};
 +
   /*  Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
   struct v4l2_querymenu {
  __u32   id;
 @@ -1965,6 +1993,8 @@ struct v4l2_create_buffers {
  Never use these in applications! */
   #define VIDIOC_DBG_G_CHIP_INFO  _IOWR('V', 102, struct v4l2_dbg_chip_info)

 +#define VIDIOC_QUERY_EXT_CTRL   _IOWR('V', 103, struct 
 v4l2_query_ext_ctrl)
 +
   /* Reminder: when adding new ioctls please add support for them to
  drivers/media/video/v4l2-compat-ioctl32.c as well! */
 
 --
 Regards,
 Sylwester
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 08/21] v4l2-ctrls: create type_ops.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Since complex controls can have non-standard types we need to be able to do
 type-specific checks etc. In order to make that easy type operations are 
 added.
 There are four operations:
 
 - equal: check if two values are equal
 - init: initialize a value
 - log: log the value
 - validate: validate a new value
 
 This patch uses the v4l2_ctrl_ptr union for the first time.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Looks good.

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com

-- 
Sylwester Nawrocki
Samsung RD Institute Poland
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 10/21] v4l2-ctrls: compare values only once.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 When setting a control the control's new value is compared to the current
 value twice: once by new_to_cur(), once by cluster_changed(). Not a big
 deal when dealing with simple values, but it can be a problem when dealing
 with compound types or matrices. So fix this: cluster_changed() sets the
 has_changed flag, which is used by new_to_cur() instead of having to do
 another compare.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 05/21] videodev2.h: add struct v4l2_query_ext_ctrl and VIDIOC_QUERY_EXT_CTRL.

2014-01-23 Thread Sylwester Nawrocki
On 23/01/14 15:23, Hans Verkuil wrote:
 On 01/23/2014 12:02 AM, Sylwester Nawrocki wrote:
 On 01/20/2014 01:45 PM, Hans Verkuil wrote:
 From: Hans Verkuilhans.verk...@cisco.com

 Add a new struct and ioctl to extend the amount of information you can
 get for a control.

 It gives back a unit string, the range is now a s64 type, and the matrix
 and element size can be reported through cols/rows/elem_size.

 Signed-off-by: Hans Verkuilhans.verk...@cisco.com
 ---
   include/uapi/linux/videodev2.h | 30 ++
   1 file changed, 30 insertions(+)

 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index 4d7782a..9e5b7d4 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -1272,6 +1272,34 @@ struct v4l2_queryctrl {
 __u32reserved[2];
   };

 +/*  Used in the VIDIOC_QUERY_EXT_CTRL ioctl for querying extended controls 
 */
 +struct v4l2_query_ext_ctrl {
 +   __u32id;
 +   __u32type;
 +   char name[32];
 +   char unit[32];

 +   union {
 +   __s64 val;
 +   __u32 reserved[4];
 +   } min;
 +   union {
 +   __s64 val;
 +   __u32 reserved[4];
 +   } max;
 +   union {
 +   __u64 val;
 +   __u32 reserved[4];
 +   } step;
 +   union {
 +   __s64 val;
 +   __u32 reserved[4];
 +   } def;

 Are these reserved[] arrays of any use ?
 
 Excellent question. I'd like to know as well :-)
 
 The idea is that if the type of the control is complex, then for certain types
 it might still make sense to have a range. E.g. say that the type is 
 v4l2_rect,
 then you can define min/max/step/def v4l2_rect entries in the unions. Ditto
 for a v4l2_fract (it would be nice to be able to specify the min/max allowed
 scaling factors, for example).

Huh, sorry, I misread the patch. Please ignore this comment.

Certainly we need an ability to query other compound control types as well.
16 bytes seems a reasonable size, I guess it is going to be sufficient for
most cases. If not we could add a pointer member to the union...?

 The question is, am I over-engineering or is this the best idea since sliced
 bread? Without the 'reserved' part this idea will be impossible to implement,
 and I don't think it hurts to have it in.

Yes, that's how I imagined it as well, I didn't mean questioning the union
idea at all.

 +   __u32flags;
 +   __u32cols, rows;

 nit: I would put them on separate lines and use full words.
 
 Separate lines: no problem, but do I really have to write 'columns' in full? 
 :-(

Yes, sorry, one shall abide by the rules! :-)

Really, it's up to you - as the author, I think you're entitled to decide
about such details. ;) The short version looks probably neater anyway.

--
Regards,
Sylwester
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 20/21] DocBook media: update control section.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Document the support for complex types in controls.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  Documentation/DocBook/media/v4l/controls.xml | 185 
 +--
  1 file changed, 118 insertions(+), 67 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/controls.xml 
 b/Documentation/DocBook/media/v4l/controls.xml
 index a5a3188..85d78d4 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -13,6 +13,19 @@ correctly with any device./para
  paraAll controls are accessed using an ID value. V4L2 defines
  several IDs for specific purposes. Drivers can also implement their
  own custom controls using constantV4L2_CID_PRIVATE_BASE/constant
 +footnoteparaThe use of constantV4L2_CID_PRIVATE_BASE/constant
 +is problematic because different drivers may use the same
 +constantV4L2_CID_PRIVATE_BASE/constant ID for different controls.
 +This makes it hard to programatically set such controls since the meaning
 +of the control with that ID is driver dependent. In order to resolve this
 +drivers use unique IDs and the constantV4L2_CID_PRIVATE_BASE/constant
 +IDs are mapped to those unique IDs by the kernel. Consider these
 +constantV4L2_CID_PRIVATE_BASE/constant IDs as aliases to the real
 +IDs./para
 +paraMany applications today still use the 
 constantV4L2_CID_PRIVATE_BASE/constant
 +IDs instead of using VIDIOC-QUERYCTRL; with the 
 constantV4L2_CTRL_FLAG_NEXT_CTRL/constant
 +flag to enumerate all IDs, so support for 
 constantV4L2_CID_PRIVATE_BASE/constant
 +is still around./para/footnote
  and higher values. The pre-defined control IDs have the prefix
  constantV4L2_CID_/constant, and are listed in xref
  linkend=control-id /. The ID is used when querying the attributes of
 @@ -31,25 +44,22 @@ the current video input or output, tuner or modulator, or 
 audio input
  or output. Different in the sense of other bounds, another default and
  current value, step size or other menu items. A control with a certain
  emphasiscustom/emphasis ID can also change name and
 -type.footnote
 - paraIt will be more convenient for applications if drivers
 -make use of the constantV4L2_CTRL_FLAG_DISABLED/constant flag, but
 -that was never required./para
 -  /footnote Control values are stored globally, they do not
 +type./para
 +
 +paraIf a control is not applicable to the current configuration
 +of the device (for example, it doesn't apply to the current video input)
 +drivers set the constantV4L2_CTRL_FLAG_INACTIVE/constant flag./para
 +
 +paraControl values are stored globally, they do not
  change when switching except to stay within the reported bounds. They
  also do not change eg; when the device is opened or closed, when the
  tuner radio frequency is changed or generally never without
 -application request. Since V4L2 specifies no event mechanism, panel
 -applications intended to cooperate with other panel applications (be
 -they built into a larger application, as a TV viewer) may need to
 -regularly poll control values to update their user
 -interface.footnote
 - paraApplications could call an ioctl to request events.
 -After another process called VIDIOC-S-CTRL; or another ioctl changing
 -shared properties the func-select; function would indicate
 -readability until any ioctl (querying the properties) is
 -called./para
 -  /footnote/para
 +application request./para
 +
 +paraV4L2 specifies an event mechanism to notify applications
 +when controls change value (see VIDIOC-SUBSCRIBE-EVENT;, event
 +constantV4L2_EVENT_CTRL/constant), panel applications might want to make
 +use of that in order to always reflect the correct control value./para
  
  para
All controls use machine endianness.
 @@ -434,127 +444,152 @@ Drivers must implement 
 constantVIDIOC_QUERYCTRL/constant,
  controls, constantVIDIOC_QUERYMENU/constant when it has one or
  more menu type controls./para
  
 -example
 -  titleEnumerating all controls/title
 +example id=enum_all_controls
 +  titleEnumerating all user controls/title
  
programlisting
  v4l2-queryctrl; queryctrl;
  v4l2-querymenu; querymenu;
  
 -static void
 -enumerate_menu (void)
 +static void enumerate_menu(void)
  {
 - printf (  Menu items:\n);
 + printf(  Menu items:\n);
  
 - memset (amp;querymenu, 0, sizeof (querymenu));
 + memset(amp;querymenu, 0, sizeof(querymenu));
   querymenu.id = queryctrl.id;
  
   for (querymenu.index = queryctrl.minimum;
querymenu.index lt;= queryctrl.maximum;
 -   querymenu.index++) {
 - if (0 == ioctl (fd, VIDIOC-QUERYMENU;, amp;querymenu)) {
 - printf (  %s\n, querymenu.name);
 +  querymenu.index++) {
 + if (0 == ioctl(fd, VIDIOC-QUERYMENU;, amp;querymenu)) {
 + printf(  %s\n, querymenu.name);
 

Re: [RFCv2 PATCH 12/21] v4l2-ctrls: replace cur by a union v4l2_ctrl_ptr.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Instead of having to maintain the 'cur' union this patch replaces it by
 a v4l2_ctrl_ptr union to be consistent with the future configuration stores,
 which also use that union. The number of drivers that use 'cur' is fairly 
 small,
 so it is easy enough to convert them all.
 
 Unfortunately, the union for the new value cannot be dropped as easily
 since it is used pretty much everywhere.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  Documentation/video4linux/v4l2-controls.txt   |  4 ++--
  drivers/media/common/cx2341x.c|  4 ++--
  drivers/media/i2c/adp1653.c   | 10 +-
  drivers/media/i2c/as3645a.c   | 22 ++---
  drivers/media/i2c/lm3560.c|  2 +-
  drivers/media/i2c/m5mols/m5mols_controls.c|  6 +++---
  drivers/media/i2c/msp3400-driver.c|  4 ++--
  drivers/media/i2c/mt9p031.c   |  4 ++--
  drivers/media/i2c/mt9t001.c   |  4 ++--
  drivers/media/i2c/s5c73m3/s5c73m3-ctrls.c |  6 +++---
  drivers/media/i2c/smiapp/smiapp-core.c| 12 ++--
  drivers/media/pci/cx18/cx18-av-core.c |  2 +-
  drivers/media/pci/cx18/cx18-driver.c  | 10 +-
  drivers/media/platform/exynos4-is/fimc-core.c |  6 +++---
  drivers/media/platform/vivi.c | 28 
 +--
  drivers/media/radio/radio-isa.c   |  2 +-
  drivers/media/radio/radio-sf16fmr2.c  |  4 ++--
  drivers/media/usb/gspca/conex.c   |  8 
  drivers/media/usb/gspca/sn9c20x.c |  4 ++--
  drivers/media/usb/gspca/topro.c   |  4 ++--
  drivers/media/v4l2-core/v4l2-ctrls.c  | 16 +++
  include/media/v4l2-ctrls.h|  9 ++---
  22 files changed, 83 insertions(+), 88 deletions(-)
 
 diff --git a/Documentation/video4linux/v4l2-controls.txt 
 b/Documentation/video4linux/v4l2-controls.txt
 index 06cf3ac..1c353c2 100644
 --- a/Documentation/video4linux/v4l2-controls.txt
 +++ b/Documentation/video4linux/v4l2-controls.txt
 @@ -362,8 +362,8 @@ will result in a deadlock since these helpers lock the 
 handler as well.
  You can also take the handler lock yourself:
  
   mutex_lock(state-ctrl_handler.lock);
 - printk(KERN_INFO String value is '%s'\n, ctrl1-cur.string);
 - printk(KERN_INFO Integer value is '%s'\n, ctrl2-cur.val);
 + pr_info(String value is '%s'\n, ctrl1-cur.p_char);
 + pr_info(Integer value is '%d'\n, *ctrl2-cur.p_s32);
   mutex_unlock(state-ctrl_handler.lock);
  
  
 diff --git a/drivers/media/common/cx2341x.c b/drivers/media/common/cx2341x.c
 index 103ef6b..909d334 100644
 --- a/drivers/media/common/cx2341x.c
 +++ b/drivers/media/common/cx2341x.c
 @@ -1261,10 +1261,10 @@ static int cx2341x_hdl_api(struct cx2341x_handler 
 *hdl,
   return hdl-func(hdl-priv, cmd, args, 0, data);
  }
  
 -/* ctrl-handler-lock is held, so it is safe to access cur.val */
 +/* ctrl-handler-lock is held, so it is safe to access *cur.p_s32 */
  static inline int cx2341x_neq(struct v4l2_ctrl *ctrl)
  {
 - return ctrl  ctrl-val != ctrl-cur.val;
 + return ctrl  ctrl-val != *ctrl-cur.p_s32;
  }
  
  static int cx2341x_try_ctrl(struct v4l2_ctrl *ctrl)
 diff --git a/drivers/media/i2c/adp1653.c b/drivers/media/i2c/adp1653.c
 index 873fe19..7d478dc 100644
 --- a/drivers/media/i2c/adp1653.c
 +++ b/drivers/media/i2c/adp1653.c
 @@ -158,16 +158,16 @@ static int adp1653_get_ctrl(struct v4l2_ctrl *ctrl)
   if (IS_ERR_VALUE(rval))
   return rval;
  
 - ctrl-cur.val = 0;
 + *ctrl-cur.p_s32 = 0;
  
   if (flash-fault  ADP1653_REG_FAULT_FLT_SCP)
 - ctrl-cur.val |= V4L2_FLASH_FAULT_SHORT_CIRCUIT;
 + *ctrl-cur.p_s32 |= V4L2_FLASH_FAULT_SHORT_CIRCUIT;
   if (flash-fault  ADP1653_REG_FAULT_FLT_OT)
 - ctrl-cur.val |= V4L2_FLASH_FAULT_OVER_TEMPERATURE;
 + *ctrl-cur.p_s32 |= V4L2_FLASH_FAULT_OVER_TEMPERATURE;
   if (flash-fault  ADP1653_REG_FAULT_FLT_TMR)
 - ctrl-cur.val |= V4L2_FLASH_FAULT_TIMEOUT;
 + *ctrl-cur.p_s32 |= V4L2_FLASH_FAULT_TIMEOUT;
   if (flash-fault  ADP1653_REG_FAULT_FLT_OV)
 - ctrl-cur.val |= V4L2_FLASH_FAULT_OVER_VOLTAGE;
 + *ctrl-cur.p_s32 |= V4L2_FLASH_FAULT_OVER_VOLTAGE;
  
   flash-fault = 0;
  
 diff --git a/drivers/media/i2c/as3645a.c b/drivers/media/i2c/as3645a.c
 index 301084b..4c6041c 100644
 --- a/drivers/media/i2c/as3645a.c
 +++ b/drivers/media/i2c/as3645a.c
 @@ -334,24 +334,24 @@ static int as3645a_get_ctrl(struct v4l2_ctrl *ctrl)
   if (value  0)
   return value;
  
 - ctrl-cur.val = 0;
 + *ctrl-cur.p_s32 = 0;
   if (value  AS_FAULT_INFO_SHORT_CIRCUIT)
 - ctrl-cur.val |= V4L2_FLASH_FAULT_SHORT_CIRCUIT;
 + 

Re: [RFCv2 PATCH 21/21] v4l2-controls.txt: update to the new way of accessing controls.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 The way current and new values are accessed has changed. Update the
 document to bring it up to date with the code.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 13/21] v4l2-ctrls: use 'new' to access pointer controls

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Require that 'new' string and pointer values are accessed through the 'new'
 field instead of through the union. This reduces the union to just val and
 val64.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com

Reviewed-by: Sylwester Nawrocki s.nawro...@samsung.com

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv2 PATCH 18/21] DocBook media: document VIDIOC_QUERY_EXT_CTRL.

2014-01-23 Thread Sylwester Nawrocki
On 20/01/14 13:46, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  .../DocBook/media/v4l/vidioc-queryctrl.xml | 223 
 +
  1 file changed, 189 insertions(+), 34 deletions(-)
 
 diff --git a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml 
 b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml
 index e6645b9..5e93c30 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-queryctrl.xml
 @@ -1,11 +1,12 @@
  refentry id=vidioc-queryctrl
refmeta
 -refentrytitleioctl VIDIOC_QUERYCTRL, VIDIOC_QUERYMENU/refentrytitle
 +refentrytitleioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, 
 VIDIOC_QUERYMENU/refentrytitle
  manvol;
/refmeta
  
refnamediv
  refnameVIDIOC_QUERYCTRL/refname
 +refnameVIDIOC_QUERY_EXT_CTRL/refname
  refnameVIDIOC_QUERYMENU/refname
  refpurposeEnumerate controls and menu control items/refpurpose
/refnamediv
 @@ -24,6 +25,14 @@
   funcdefint functionioctl/function/funcdef
   paramdefint parameterfd/parameter/paramdef
   paramdefint parameterrequest/parameter/paramdef
 + paramdefstruct v4l2_query_ext_ctrl 
 *parameterargp/parameter/paramdef
 +  /funcprototype
 +/funcsynopsis
 +funcsynopsis
 +  funcprototype
 + funcdefint functionioctl/function/funcdef
 + paramdefint parameterfd/parameter/paramdef
 + paramdefint parameterrequest/parameter/paramdef
   paramdefstruct v4l2_querymenu *parameterargp/parameter/paramdef
/funcprototype
  /funcsynopsis
 @@ -42,7 +51,7 @@
varlistentry
   termparameterrequest/parameter/term
   listitem
 -   paraVIDIOC_QUERYCTRL, VIDIOC_QUERYMENU/para
 +   paraVIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU/para
   /listitem
/varlistentry
varlistentry
 @@ -91,7 +100,26 @@ prematurely end the enumeration)./para/footnote/para
  constantV4L2_CTRL_FLAG_NEXT_CTRL/constant the driver returns the
  next supported control, or errorcodeEINVAL/errorcode if there is
  none. Drivers which do not support this flag yet always return
 -errorcodeEINVAL/errorcode./para
 +errorcodeEINVAL/errorcode. Hidden controls (i.e. controls
 +with the constantV4L2_CTRL_FLAG_HIDDEN/constant flag set) are
 +skipped when using the constantV4L2_CTRL_FLAG_NEXT_CTRL/constant
 +flag. Use the constantVIDIOC_QUERY_EXT_CTRL/constant for that./para
 +
 +paraThe constantVIDIOC_QUERY_EXT_CTRL/constant ioctl was
 +introduced in order to better support controls that can use complex
 +types, and to expose addition control information that cannot be

s/addition/additional ?

 +returned in v4l2-queryctrl; since that structure is full./para
 +
 +paraconstantVIDIOC_QUERY_EXT_CTRL/constant is used in the
 +same way as constantVIDIOC_QUERYCTRL/constant, except that the
 +structfieldreserved/structfield array must be zeroed as well.
 +In addition, the constantV4L2_CTRL_FLAG_NEXT_HIDDEN/constant flag
 +can be specified to enumerate all hidden controls (i.e. controls
 +with the constantV4L2_CTRL_FLAG_HIDDEN/constant flag set which

s/set which/set, which ?

 +includes all controls with complex types). Specify both
 +constantV4L2_CTRL_FLAG_NEXT_CTRL/constant and
 +constantV4L2_CTRL_FLAG_NEXT_HIDDEN/constant in order to enumerate
 +all controls, hidden or not./para
  
  paraAdditional information is required for menu controls: the
  names of the menu items. To query them applications set the
 @@ -142,38 +170,23 @@ string. This information is intended for the 
 user./entry
   entry__s32/entry
   entrystructfieldminimum/structfield/entry
   entryMinimum value, inclusive. This field gives a lower
 -bound for constantV4L2_CTRL_TYPE_INTEGER/constant controls and the
 -lowest valid index for constantV4L2_CTRL_TYPE_MENU/constant controls.
 -For constantV4L2_CTRL_TYPE_STRING/constant controls the minimum value
 -gives the minimum length of the string. This length emphasisdoes not 
 include the terminating
 -zero/emphasis. It may not be valid for any other type of control, including
 -constantV4L2_CTRL_TYPE_INTEGER64/constant controls. Note that this is a
 -signed value./entry
 +bound for the control. See v4l2-ctrl-type; how the minimum value is to
 +be used for each possible control type. Note that this a signed 32-bit 
 value./entry
 /row
 row
   entry__s32/entry
   entrystructfieldmaximum/structfield/entry
   entryMaximum value, inclusive. This field gives an upper
 -bound for constantV4L2_CTRL_TYPE_INTEGER/constant controls and the
 -highest valid index for constantV4L2_CTRL_TYPE_MENU/constant
 -controls. For constantV4L2_CTRL_TYPE_BITMASK/constant controls it is the
 -set of usable bits.
 -For constantV4L2_CTRL_TYPE_STRING/constant controls the maximum value
 -gives the maximum length of the string. This length emphasisdoes not 
 include the 

Re: [RFC PATCH 0/4] rc: Adding support for sysfs wakeup scancodes

2014-01-23 Thread Antti Seppälä
On 23 January 2014 00:01, Mauro Carvalho Chehab m.che...@samsung.com wrote:
 Not sure if you saw it, but there's already another patchset proposing
 that, that got submitted before this changeset:
 https://patchwork.linuxtv.org/patch/21625/

I actually didn't notice that until now. Seems quite a similar kind of
approach with even more advanced features than what I had in mind
(namely the scancode filtering and masking).

However it looks like that patchset has the same drawback about not
knowing which protocol to use for the wakeup scancode as was pointed
from my patch.

I think I'll try to come up with a new patch addressing the comments
I've seen so far.

-Antti
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 07/13] v4l: add device capability flag for SDR receiver

2014-01-23 Thread 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 hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hverk...@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 27bed7c..27fedfe 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -267,6 +267,8 @@ struct v4l2_capability {
 #define V4L2_CAP_RADIO 0x0004  /* is a radio device */
 #define V4L2_CAP_MODULATOR 0x0008  /* has a modulator */
 
+#define V4L2_CAP_SDR_CAPTURE   0x0010  /* Is a SDR capture device 
*/
+
 #define V4L2_CAP_READWRITE  0x0100  /* read/write systemcalls 
*/
 #define V4L2_CAP_ASYNCIO0x0200  /* async I/O */
 #define V4L2_CAP_STREAMING  0x0400  /* streaming I/O ioctls */
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 02/13] v4l: add new tuner types for SDR

2014-01-23 Thread 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 hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@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 707aef7..15ab349 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1291,8 +1291,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);
 }
 
@@ -1303,10 +1306,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);
 }
 
@@ -1386,6 +1394,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)
@@ -1885,11 +1897,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 6ae7bbe..9dc79d1 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.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 05/13] v4l: define own IOCTL ops for SDR FMT

2014-01-23 Thread 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 hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@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.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 10/13] DocBook: Software Defined Radio Interface

2014-01-23 Thread Antti Palosaari
Document V4L2 SDR interface.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 Documentation/DocBook/media/v4l/compat.xml |  10 ++
 Documentation/DocBook/media/v4l/dev-sdr.xml| 104 +
 Documentation/DocBook/media/v4l/io.xml |   6 ++
 Documentation/DocBook/media/v4l/pixfmt.xml |   8 ++
 Documentation/DocBook/media/v4l/v4l2.xml   |   1 +
 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml   |   7 ++
 .../DocBook/media/v4l/vidioc-querycap.xml  |   6 ++
 7 files changed, 142 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 c4cac6d..83f64ce 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2535,6 +2535,16 @@ fields changed from _s32 to _u32.
   /orderedlist
 /section
 
+section
+  titleV4L2 in Linux 3.14/title
+  orderedlist
+listitem
+ paraAdded Software Defined Radio (SDR) Interface.
+ /para
+/listitem
+  /orderedlist
+/section
+
 section id=other
   titleRelation 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 000..332b87f
--- /dev/null
+++ b/Documentation/DocBook/media/v4l/dev-sdr.xml
@@ -0,0 +1,104 @@
+  titleSoftware 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
+titleQuerying Capabilities/title
+
+para
+Devices supporting the SDR receiver interface set the
+constantV4L2_CAP_SDR_CAPTURE/constant and
+constantV4L2_CAP_TUNER/constant flag in the
+structfieldcapabilities/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
+titleSupplemental Functions/title
+
+para
+SDR devices can support link linkend=controlcontrols/link, and must
+support the link linkend=tunertuner/link ioctls. Tuner ioctls are used
+for setting the ADC sampling rate (sampling frequency) and the possible RF 
tuner
+frequency.
+/para
+
+para
+The constantV4L2_TUNER_ADC/constant tuner type is used for ADC tuners, and
+the constantV4L2_TUNER_RF/constant tuner type 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
+titleData Format Negotiation/title
+
+para
+The SDR capture device uses the link linkend=formatformat/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 the basic
+link linkend=formatformat/link ioctls, the VIDIOC-ENUM-FMT; ioctl
+must be supported as well.
+/para
+
+para
+To use the link linkend=formatformat/link ioctls applications set the
+structfieldtype/structfield field of a v4l2-format; to
+constantV4L2_BUF_TYPE_SDR_CAPTURE/constant and use the v4l2-format-sdr;
+structfieldsdr/structfield member of the structfieldfmt/structfield
+union as needed per the desired operation.
+Currently only the structfieldpixelformat/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
+  titlestruct structnamev4l2_format_sdr/structname/title
+  tgroup cols=3
+cs-str;
+tbody valign=top
+  row
+entry__u32/entry
+entrystructfieldpixelformat/structfield/entry
+entry
+The data format or type of compression, set by the application. This is a
+little endian link linkend=v4l2-fourccfour character code/link.
+V4L2 defines SDR formats in xref linkend=sdr-formats /.
+   /entry
+  /row
+  row
+entry__u8/entry
+entrystructfieldreserved[28]/structfield/entry
+entryThis array is reserved for future extensions.
+Drivers and applications must set it to zero./entry
+  /row
+/tbody
+  /tgroup
+/table
+
+

[REVIEW PATCH 00/13] SDR API

2014-01-23 Thread Antti Palosaari
I think it is ready enough. PULL request will follow in next days...


The next step I am going to add SDR API is tuner gain controls.

Modern silicon RF tuners used nowadays has many controllable gains
on signal path. Usually there is at least 3 amplifiers:
1) LNA gain. That is first amplifier just after antenna input pins.
2) Mixer gain. Quite middle of the signal path, where RF signal is
down-converted to IF/BB.
3) IF gain. That is last gain in order to adjust output signal
level to optimal level of demodulator.

Each gain controls could be often manual or automatic mode (AGC).
Total gain is something like sum of all gains. My plan is to implement
these 3 gains with manual/auto switch and group all those to one
master/total gain.

Antti

Antti Palosaari (12):
  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: document 1 Hz flag
  DocBook: Software Defined Radio Interface
  DocBook: mark SDR API as Experimental
  v4l2-framework.txt: add SDR device type
  devices.txt: add video4linux device for Software Defined Radio

Hans Verkuil (1):
  v4l: do not allow modulator ioctls for non-radio devices

 Documentation/DocBook/media/v4l/compat.xml |  13 +++
 Documentation/DocBook/media/v4l/dev-sdr.xml| 110 +
 Documentation/DocBook/media/v4l/io.xml |   6 ++
 Documentation/DocBook/media/v4l/pixfmt.xml |   8 ++
 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/devices.txt  |   7 ++
 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 +++
 20 files changed, 306 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/DocBook/media/v4l/dev-sdr.xml

-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 12/13] v4l2-framework.txt: add SDR device type

2014-01-23 Thread Antti Palosaari
Add SDR device type to v4l2-framework.txt document.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 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.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 13/13] devices.txt: add video4linux device for Software Defined Radio

2014-01-23 Thread Antti Palosaari
Add new video4linux device named /dev/swradio for Software Defined
Radio use. V4L device minor numbers are allocated dynamically
nowadays, but there is still configuration option for old fixed style.
Add note to mention that configuration option too.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 Documentation/devices.txt | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 80b7241..e852855 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -1490,10 +1490,17 @@ Your cooperation is appreciated.
 64 = /dev/radio0   Radio device
...
127 = /dev/radio63  Radio device
+   128 = /dev/swradio0 Software Defined Radio device
+   ...
+   191 = /dev/swradio63Software Defined Radio device
224 = /dev/vbi0 Vertical blank interrupt
...
255 = /dev/vbi31Vertical blank interrupt
 
+   Minor numbers are allocated dynamically unless
+   CONFIG_VIDEO_FIXED_MINOR_RANGES (default n)
+   configuration option is set.
+
  81 block  I2O hard disk
  0 = /dev/i2o/hdq  17th I2O hard disk, whole disk
 16 = /dev/i2o/hdr  18th I2O hard disk, whole disk
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 11/13] DocBook: mark SDR API as Experimental

2014-01-23 Thread Antti Palosaari
Let it be experimental still as all SDR drivers are in staging.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 Documentation/DocBook/media/v4l/compat.xml  | 3 +++
 Documentation/DocBook/media/v4l/dev-sdr.xml | 6 ++
 2 files changed, 9 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 83f64ce..2fb2b8d 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2661,6 +2661,9 @@ ioctls./para
 listitem
  paraExporting DMABUF files using VIDIOC-EXPBUF; ioctl./para
 /listitem
+listitem
+ paraSoftware Defined Radio (SDR) Interface, xref linkend=sdr 
/./para
+/listitem
   /itemizedlist
 /section
 
diff --git a/Documentation/DocBook/media/v4l/dev-sdr.xml 
b/Documentation/DocBook/media/v4l/dev-sdr.xml
index 332b87f..ac9f1af 100644
--- a/Documentation/DocBook/media/v4l/dev-sdr.xml
+++ b/Documentation/DocBook/media/v4l/dev-sdr.xml
@@ -1,5 +1,11 @@
   titleSoftware Defined Radio Interface (SDR)/title
 
+  note
+titleExperimental/title
+paraThis is an link linkend=experimental experimental /link
+interface and may change in the future./para
+  /note
+
   para
 SDR is an abbreviation of Software Defined Radio, the radio device
 which uses application software for modulation or demodulation. This interface
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 01/13] v4l: add device type for Software Defined Radio

2014-01-23 Thread 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 hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@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 b5c..2ccacf2 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -758,6 +758,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)
@@ -797,6 +799,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_SUBDEV3
-#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.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 06/13] v4l: enable some IOCTLs for SDR receiver

2014-01-23 Thread 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 hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hverk...@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 2ccacf2..6308a19 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -553,7 +553,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;
 
@@ -662,9 +662,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);
@@ -672,6 +683,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 9a2acaf..95dd4f1 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -246,6 +246,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));
@@ -319,6 +320,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;
}
 }
 
@@ -882,6 +891,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;
 
@@ -931,6 +941,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;
}
@@ -1050,6 +1064,10 @@ static int v4l_enum_fmt(const struct 

[REVIEW PATCH 03/13] v4l: 1 Hz resolution flag for tuners

2014-01-23 Thread Antti Palosaari
Add V4L2_TUNER_CAP_1HZ for 1 Hz resolution.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@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 9dc79d1..1cf2076 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_CONTROLS0x0200
 #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_MONO0x0001
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 09/13] DocBook: document 1 Hz flag

2014-01-23 Thread Antti Palosaari
Update documentation to reflect 1 Hz frequency step flag.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 .../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..4e8ea65 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
entrystructfieldcapability/structfield/entry
entry spanname=hspanThe tuner/modulator capability flags for
 this frequency band, see xref linkend=tuner-capability /. The 
constantV4L2_TUNER_CAP_LOW/constant
-capability must be the same for all frequency bands of the selected 
tuner/modulator.
+or constantV4L2_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=hspanThe lowest tunable frequency in
 units of 62.5 kHz, or if the structfieldcapability/structfield
 flag constantV4L2_TUNER_CAP_LOW/constant is set, in units of 62.5
-Hz, for this frequency band./entry
+Hz, for this frequency band. A 1 Hz unit is used when the 
structfieldcapability/structfield flag
+constantV4L2_TUNER_CAP_1HZ/constant is set./entry
  /row
  row
entry__u32/entry
@@ -117,7 +118,8 @@ Hz, for this frequency band./entry
entry spanname=hspanThe highest tunable frequency in
 units of 62.5 kHz, or if the structfieldcapability/structfield
 flag constantV4L2_TUNER_CAP_LOW/constant is set, in units of 62.5
-Hz, for this frequency band./entry
+Hz, for this frequency band. A 1 Hz unit is used when the 
structfieldcapability/structfield flag
+constantV4L2_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..d1034fb 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
entrystructfieldfrequency/structfield/entry
entryTuning frequency in units of 62.5 kHz, or if the
-v4l2-tuner; or v4l2-modulator; structfieldcapabilities/structfield flag
+v4l2-tuner; or v4l2-modulator; structfieldcapability/structfield flag
 constantV4L2_TUNER_CAP_LOW/constant is set, in units of 62.5
-Hz./entry
+Hz. A 1 Hz unit is used when the structfieldcapability/structfield flag
+constantV4L2_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
entryThe lowest tunable frequency in units of 62.5
 KHz, or if the structfieldcapability/structfield flag
 constantV4L2_TUNER_CAP_LOW/constant is set, in units of 62.5
-Hz./entry
+Hz, or if the structfieldcapability/structfield flag
+constantV4L2_TUNER_CAP_1HZ/constant is set, in units of 1 Hz./entry
  /row
  row
entry__u32/entry
@@ -121,7 +122,8 @@ Hz./entry
entryThe highest tunable frequency in units of 62.5
 KHz, or if the structfieldcapability/structfield flag
 constantV4L2_TUNER_CAP_LOW/constant is set, in units of 62.5
-Hz./entry
+Hz, or if the structfieldcapability/structfield flag
+constantV4L2_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=hspanThe lowest tunable frequency in
 units of 62.5 kHz, or if 

[REVIEW PATCH 04/13] v4l: add stream format for SDR receiver

2014-01-23 Thread Antti Palosaari
Add new V4L2 stream format definition, V4L2_BUF_TYPE_SDR_CAPTURE,
for SDR receiver.

Cc: Hans Verkuil hverk...@xs4all.nl
Signed-off-by: Antti Palosaari cr...@iki.fi
Acked-by: Hans Verkuil hans.verk...@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 15ab349..9a2acaf 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -152,6 +152,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 1cf2076..27bed7c 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;
+   __u8reserved[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 */
__u8raw_data[200];   /* user-defined */
} fmt;
 };
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW PATCH 08/13] v4l: do not allow modulator ioctls for non-radio devices

2014-01-23 Thread Antti Palosaari
From: Hans Verkuil hverk...@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.verk...@cisco.com
Signed-off-by: Antti Palosaari cr...@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 6308a19..9adde0f 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -553,6 +553,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;
@@ -726,8 +727,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.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: WARNINGS

2014-01-23 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Fri Jan 24 04:00:27 CET 2014
git branch: test
git hash:   587d1b06e07b4a079453c74ba9edf17d21931049
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-6.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-x86_64: OK
apps: OK
spec-git: OK
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html