dvb-apps scan files

2012-09-07 Thread Hernán Rossetto
Please add the attached files for Argentina and Brazil to the DVB-T scan list.

You will notice they have the same content already published here
http://www.linuxtv.org/wiki/index.php/ISDB-T_Frequency_Table

Thanks,
Hernán.-


ar-Argentina
Description: Binary data


br-Brazil
Description: Binary data


Re: [RFC PATCH v6] media: add v4l2 subdev driver for S5K4ECGX sensor

2012-09-07 Thread Sylwester Nawrocki

Hi Sangwook,

On 09/06/2012 05:08 PM, Sangwook Lee wrote:

This patch adds driver for S5K4ECGX sensor with embedded ISP SoC,
S5K4ECGX, which is a 5M CMOS Image sensor from Samsung
The driver implements preview mode of the S5K4ECGX sensor.
capture (snapshot) operation, face detection are missing now.
Following controls are supported:
contrast/saturation/brightness/sharpness

Signed-off-by: Sangwook Lee
Reviewed-by: Sylwester Nawrocki


Thanks for the update. I've done a few more minor fixes and improved
s_stream() subdev op handling, so it really enables/disables data
stream on the sensor's output. It's pushed to

git://linuxtv.org/snawrocki/media.git samsung_s5k4ecgx

Could you please squash the changes that you are willing to accept
and test if the last patch really does what it is intended to ?

After you send v7 I could add this patch to my tree for v3.7,
unless you want to handle it yourself.

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


Re: [RFCv2 API PATCH 14/28] DocBook: clarify that sequence is also set for output devices.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

It was not entirely obvious that the sequence count should also
be set for output devices. Also made it more explicit that this
sequence counter counts frames, not fields.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 

--
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 API PATCH 13/28] Add V4L2_CAP_MONOTONIC_TS where applicable.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

Add the new V4L2_CAP_MONOTONIC_TS capability to those drivers that
use monotomic timestamps instead of the system time.

Signed-off-by: Hans Verkuil


For s5p-fimc,

Acked-by: Sylwester Nawrocki 
--
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 API PATCH 12/28] v4l2-core: Add new V4L2_CAP_MONOTONIC_TS capability.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

Add a new flag that tells userspace that the monotonic clock is used
for timestamps and update the documentation accordingly.

We decided on this new flag during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 
--
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 API PATCH 11/28] DocBook: fix awkward language and fix the documented return value.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

The Video Standard section contains some awkward language. It also wasn't
updated when the error code for unimplemented ioctls changed from EINVAL
to ENOTTY.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 
--
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 API PATCH 08/28] v4l2: remove experimental tag from a number of old drivers.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

A number of old drivers still had the experimental tag. Time to remove it.

It concerns the following drivers:

VIDEO_TLV320AIC23B
USB_STKWEBCAM
VIDEO_CX18
VIDEO_CX18_ALSA
VIDEO_ZORAN_AVS6EYES
DVB_USB_AF9005
MEDIA_TUNER_TEA5761
VIDEO_NOON010PC30

This decision was taken during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 
--
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 API PATCH 05/28] DocBook: bus_info can no longer be empty.

2012-09-07 Thread Sylwester Nawrocki
On 09/07/2012 03:29 PM, Hans Verkuil wrote:
> From: Hans Verkuil
> 
> During the 2012 Media Workshop it was decided that bus_info as returned
> by VIDIOC_QUERYCAP can no longer be empty. It should be a unique identifier,
> and empty strings are obviously not unique.
> 
> Signed-off-by: Hans Verkuil

Reviewed-by: Sylwester Nawrocki 

> ---
>   Documentation/DocBook/media/v4l/vidioc-querycap.xml |   14 ++
>   1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml 
> b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> index f33dd74..d5b1248 100644
> --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
> @@ -90,11 +90,17 @@ ambiguities.
>   __u8
>   bus_info[32]
>   Location of the device in the system, a
> -NUL-terminated ASCII string. For example: "PCI Slot 4". This
> +NUL-terminated ASCII string. For example: "PCI::05:06.0". This
>   information is intended for users, to distinguish multiple
> -identical devices. If no such information is available the field may
> -simply count the devices controlled by the driver, or contain the
> -empty string (bus_info[0] = 0).
> +identical devices. If no such information is available the field must
> +simply count the devices controlled by the driver ("vivi-000"). The bus_info
> +must start with "PCI:" for PCI boards, "PCIe:" for PCI Express boards,
> +"usb-" for USB devices, "I2C:" for i2c devices, "ISA:" for ISA devices and
> +"parport" for parallel port devices.
> +For devices without a bus it should start with the driver name, optionally

Most, if not all, devices are on some sort of bus. What would be an example
of a device "without a bus" ?

Could we just be saying here "For other devices" instead of "For devices
without a bus", or something similar ?

> +followed by "-" and an index if multiple instances of the device as possible.
> +Many platform devices can have only one instance, so in that case bus_info
> +is identical to thedriver  field.
>   
>   
>   __u32

--

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 API PATCH 04/28] DocBook: make the G/S/TRY_FMT specification more strict.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

- S/TRY_FMT should always succeed, unless an invalid type field is passed in.
- TRY_FMT should give the same result as S_FMT, all other things being equal.
- ENUMFMT may return different formats for different inputs or outputs.

This was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 

A typo managed to snick in below...


---
  Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml |3 +++
  Documentation/DocBook/media/v4l/vidioc-g-fmt.xml|9 ++---
  2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
index 81ebe48..0bd3324 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
@@ -58,6 +58,9 @@ structure. Drivers fill the rest of the structure or return an
  incrementing by one untilEINVAL  is
  returned.

+Note that after switching input or output the list of enumerated image
+formats may be different.
+
  
structv4l2_fmtdesc

diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index 52acff1..9ef279a 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -81,7 +81,7 @@ the application calls theVIDIOC_S_FMT  
ioctl
  with a pointer to av4l2_format  structure
  the driver checks
  and adjusts the parameters against hardware abilities. Drivers
-should not return an error code unless the input is ambiguous, this is
+should not return an error code unless thetype  
field is invalid, this is
  a mechanism to fathom device capabilities and to approach parameters
  acceptable for both the application and driver. On success the driver
  may program the hardware, allocate resources and generally prepare for
@@ -107,6 +107,10 @@ disabling I/O or possibly time consuming hardware 
preparations.
  Although strongly recommended drivers are not required to implement
  this ioctl.

+The format as returned byVIDIOC_TRY_FMT
+must be identical to whatVIDIOC_S_FMT  returns for
+the same input or output.
+
  
structv4l2_format

@@ -187,8 +191,7 @@ capture and output devices.
EINVAL

The&v4l2-format;type
-field is invalid, the requested buffer type not supported, or the
-format is not supported with this buffer type.
+field is invalia or the requested buffer type not supported.


invalia -> invalid




  


--

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 API PATCH 03/28] DocBook: improve STREAMON/OFF documentation.

2012-09-07 Thread Sylwester Nawrocki

On 09/07/2012 03:29 PM, Hans Verkuil wrote:

From: Hans Verkuil

Specify that STREAMON/OFF should return 0 if the stream is already
started/stopped.

The spec never specified what the correct behavior is. This ambiguity
was resolved during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil


Reviewed-by: Sylwester Nawrocki 

--

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


cron job: media_tree daily build: WARNINGS

2012-09-07 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 Sep  7 19:00:20 CEST 2012
git hash:79e8c7bebb467bbc3f2514d75bba669a3f354324
gcc version:  i686-linux-gcc (GCC) 4.7.1
host hardware:x86_64
host os:  3.4.07-marune

linux-git-arm-eabi-davinci: WARNINGS
linux-git-arm-eabi-exynos: OK
linux-git-arm-eabi-omap: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
linux-2.6.31.12-x86_64: WARNINGS
linux-2.6.32.6-x86_64: WARNINGS
linux-2.6.33-x86_64: WARNINGS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
linux-3.4-x86_64: WARNINGS
linux-3.5-x86_64: WARNINGS
linux-3.6-rc2-x86_64: WARNINGS
linux-2.6.31.12-i686: WARNINGS
linux-2.6.32.6-i686: WARNINGS
linux-2.6.33-i686: WARNINGS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-i686: WARNINGS
linux-3.5-i686: WARNINGS
linux-3.6-rc2-i686: WARNINGS
apps: WARNINGS
spec-git: OK
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 V4L-DVB specification 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


Re: [PATCH v2] media: v4l2-ctrls: add control for test pattern

2012-09-07 Thread Prabhakar Lad
Hi Sakari,

Thanks for the review.

On Fri, Sep 7, 2012 at 11:50 PM, Sakari Ailus  wrote:
> Hi Prabhakar,
>
> Thanks for the patch!
>
>
> Prabhakar Lad wrote:
>>
>> From: Lad, Prabhakar 
>>
>> add V4L2_CID_TEST_PATTERN of type menu, which determines
>> the internal test pattern selected by the device.
>>
>> Signed-off-by: Lad, Prabhakar 
>> Signed-off-by: Manjunath Hadli 
>> Cc: Sakari Ailus 
>> Cc: Hans Verkuil 
>> Cc: Laurent Pinchart 
>> Cc: Mauro Carvalho Chehab 
>> Cc: Sylwester Nawrocki 
>> Cc: Hans de Goede 
>> Cc: Kyungmin Park 
>> Cc: Rob Landley 
>> ---
>> This patches has one checkpatch warning for line over
>> 80 characters altough it can be avoided I have kept it
>> for consistency.
>>
>> Changes for v2:
>> 1: Included display devices in the description for test pattern
>> as pointed by Hans.
>> 2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
>> pointed by Sylwester.
>> 3: Removed the test patterns from menu as the are hardware specific
>> as pointed by Sakari.
>>
>>   Documentation/DocBook/media/v4l/controls.xml |   20 
>>   drivers/media/v4l2-core/v4l2-ctrls.c |8 
>>   include/linux/videodev2.h|4 
>>   3 files changed, 32 insertions(+), 0 deletions(-)
>>
>> diff --git a/Documentation/DocBook/media/v4l/controls.xml
>> b/Documentation/DocBook/media/v4l/controls.xml
>> index ad873ea..173934e 100644
>> --- a/Documentation/DocBook/media/v4l/controls.xml
>> +++ b/Documentation/DocBook/media/v4l/controls.xml
>> @@ -4311,6 +4311,26 @@ interface and may change in the future.
>>   
>> 
>>   
>> + 
>> +   > spanname="id">V4L2_CID_TEST_PATTERN
>> +   menu
>> + 
>> + 
>> +The Capture/Display/Sensors have the
>> capability
>> +   to generate internal test patterns and this are hardware
>> specific. This
>> +   test patterns are used to test a device is properly working
>> and can generate
>> +   the desired waveforms that it supports.
>> + 
>> + 
>> +   
>> + 
>> +   
>> +
>> V4L2_TEST_PATTERN_DISABLED
>> + Test pattern generation is disabled
>> +   
>> + 
>> +   
>> + 
>> 
>> 
>> 
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c
>> b/drivers/media/v4l2-core/v4l2-ctrls.c
>> index 8f2f40b..d731422 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
>> @@ -430,6 +430,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>> "Advanced",
>> NULL,
>> };
>> +   static const char * const test_pattern[] = {
>> +   "Disabled",
>> +   NULL,
>> +   };
>>
>> switch (id) {
>> case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
>> @@ -509,6 +513,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
>> return jpeg_chroma_subsampling;
>> case V4L2_CID_DPCM_PREDICTOR:
>> return dpcm_predictor;
>> +   case V4L2_CID_TEST_PATTERN:
>> +   return test_pattern;
>
>
> I think it's not necessary to define test_pattern (nor be prepared to return
> it) since the menu is going to be device specific. So the driver is
> responsible for all of the menu items. Such menus are created using
> v4l2_ctrl_new_custom() instead of v4l2_ctrl_new_std_menu().
>
Ok.

Regrads,
--Prabhakar Lad

> Looks good to me otherwise.
>
> Kind regards,
>
> --
> Sakari Ailus
> sakari.ai...@iki.fi
>
> ___
> Davinci-linux-open-source mailing list
> davinci-linux-open-sou...@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
--
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 v4] media: v4l2-ctrls: add control for dpcm predictor

2012-09-07 Thread Prabhakar Lad
Hi Sakari,

On Sat, Sep 8, 2012 at 12:16 AM, Sakari Ailus  wrote:
> Hi Prabhakar,
>
>
> Prabhakar Lad wrote:
>>
>> Hi Sakari,
>>
>> Thanks for the review.
>>
>> On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:
>>>
>>> Hi Prabhakar,
>>>
>>> Thanks for the patch. I've got a few comments below.
>>>
>>> On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:

 From: Lad, Prabhakar 

 add V4L2_CID_DPCM_PREDICTOR control of type menu, which
 determines the dpcm predictor. The predictor can be either
 simple or advanced.

 Signed-off-by: Lad, Prabhakar 
 Signed-off-by: Manjunath Hadli 
 Acked-by: Hans Verkuil 
 Reviewed-by: Sylwester Nawrocki 
 Cc: Sakari Ailus 
 Cc: Laurent Pinchart 
 Cc: Mauro Carvalho Chehab 
 Cc: Hans de Goede 
 Cc: Kyungmin Park 
 Cc: Rob Landley 
 ---
 This patches has one checkpatch warning for line over
 80 characters altough it can be avoided I have kept it
 for consistency.

 Changes for v4:
 1: Aligned the description to fit appropriately in the
 para tag, pointed by Sylwester.

 Changes for v3:
 1: Added better explanation for DPCM, pointed by Hans.

 Changes for v2:
 1: Added documentaion in controls.xml pointed by Sylwester.
 2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
 pointed by Sakari.

   Documentation/DocBook/media/v4l/controls.xml |   46
 +-
   drivers/media/v4l2-core/v4l2-ctrls.c |9 +
   include/linux/videodev2.h|5 +++
   3 files changed, 59 insertions(+), 1 deletions(-)

 diff --git a/Documentation/DocBook/media/v4l/controls.xml
 b/Documentation/DocBook/media/v4l/controls.xml
 index 93b9c68..ad873ea 100644
 --- a/Documentation/DocBook/media/v4l/controls.xml
 +++ b/Documentation/DocBook/media/v4l/controls.xml
 @@ -4267,7 +4267,51 @@ interface and may change in the future.
 pixels / second.
 
   
 - 
 + 
 +   >>> spanname="id">V4L2_CID_DPCM_PREDICTOR
 +   menu
 + 
 + 
 +Differential pulse-code modulation
 (DPCM) is a signal
 +   encoder that uses the baseline of pulse-code modulation
 (PCM) but adds some
 +   functionalities based on the prediction of the samples of
 the signal. The input
 +   can be an analog signal or a digital signal.
 +
 +   If the input is a continuous-time analog signal, it
 needs to be sampled
 +   first so that a discrete-time signal is the input to the
 DPCM encoder.
 +
 +   Simple: take the values of two consecutive samples; if
 they are analog
 +   samples, quantize them; calculate the difference between the
 first one and the
 +   next; the output is the difference, and it can be further
 entropy coded.
 +
 +   Advanced: instead of taking a difference relative to a
 previous input sample,
 +   take the difference relative to the output of a local model
 of the decoder process;
 +   in this option, the difference can be quantized, which
 allows a good way to
 +   incorporate a controlled loss in the encoding.
>>>
>>>
>>> This is directly from Wikipedia, isn't it?
>>>
>> Yes.
>>
>>> What comes to the content, DPCM in the context of V4L2 media bus codes,
>>> as a
>>> digital interface, is always digital. So there's no need to document it.
>>> Entropy coding is also out of the question: the samples of the currently
>>> defined formats are equal in size.
>>>
>> Ok.
>
>
> Could you replace the above with this text (with appropriate indentation
> etc.) while keeping the reference to Wikipedia?
>
> --8<--
> Differential pulse-code modulation (DPCM) compression can be used to
> compress the samples into fewer bits than they would otherwise require. This
> is done by calculating the difference between consecutive samples and
> outputting the difference which in average is much smaller than the values
> of the samples themselves since there is generally lots of correlation
> between adjacent pixels. In decompression the original samples are
> reconstructed. The process isn't lossless as the encoded sample size in bits
> is less than the original.
>
> Formats using DPCM compression include  />.
>
> This control is used to select the predictor used to encode the samples.
>
> The main difference between the simple and the advanced predictors is image
> quality, with advanced predictor supposed to produce better quality images
> as a result. Simple predictor can be used e.g. for testing purposes.
> --8<--
>
Thanks for the definition. :)

Thanks and Regards,
--Prabhakar Lad

>
> Kind regards,
>
> --
> Sakari Ailus
> sakari.ai...@i

Re: [PATCH v4] media: v4l2-ctrls: add control for dpcm predictor

2012-09-07 Thread Sakari Ailus

Hi Prabhakar,

Prabhakar Lad wrote:

Hi Sakari,

Thanks for the review.

On Wednesday 05 September 2012 12:42 AM, Sakari Ailus wrote:

Hi Prabhakar,

Thanks for the patch. I've got a few comments below.

On Tue, Sep 04, 2012 at 11:07:52AM +0530, Prabhakar Lad wrote:

From: Lad, Prabhakar 

add V4L2_CID_DPCM_PREDICTOR control of type menu, which
determines the dpcm predictor. The predictor can be either
simple or advanced.

Signed-off-by: Lad, Prabhakar 
Signed-off-by: Manjunath Hadli 
Acked-by: Hans Verkuil 
Reviewed-by: Sylwester Nawrocki 
Cc: Sakari Ailus 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: Hans de Goede 
Cc: Kyungmin Park 
Cc: Rob Landley 
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v4:
1: Aligned the description to fit appropriately in the
para tag, pointed by Sylwester.

Changes for v3:
1: Added better explanation for DPCM, pointed by Hans.

Changes for v2:
1: Added documentaion in controls.xml pointed by Sylwester.
2: Chnaged V4L2_DPCM_PREDICTOR_ADVANCE to V4L2_DPCM_PREDICTOR_ADVANCED
pointed by Sakari.

  Documentation/DocBook/media/v4l/controls.xml |   46 +-
  drivers/media/v4l2-core/v4l2-ctrls.c |9 +
  include/linux/videodev2.h|5 +++
  3 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index 93b9c68..ad873ea 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4267,7 +4267,51 @@ interface and may change in the future.
pixels / second.

  
- 
+ 
+   V4L2_CID_DPCM_PREDICTOR
+   menu
+ 
+ 
+Differential pulse-code modulation (DPCM) 
is a signal
+   encoder that uses the baseline of pulse-code modulation (PCM) but 
adds some
+   functionalities based on the prediction of the samples of the 
signal. The input
+   can be an analog signal or a digital signal.
+
+   If the input is a continuous-time analog signal, it needs to 
be sampled
+   first so that a discrete-time signal is the input to the DPCM 
encoder.
+
+   Simple: take the values of two consecutive samples; if they 
are analog
+   samples, quantize them; calculate the difference between the first 
one and the
+   next; the output is the difference, and it can be further entropy 
coded.
+
+   Advanced: instead of taking a difference relative to a 
previous input sample,
+   take the difference relative to the output of a local model of the 
decoder process;
+   in this option, the difference can be quantized, which allows a 
good way to
+   incorporate a controlled loss in the encoding.


This is directly from Wikipedia, isn't it?


Yes.


What comes to the content, DPCM in the context of V4L2 media bus codes, as a
digital interface, is always digital. So there's no need to document it.
Entropy coding is also out of the question: the samples of the currently
defined formats are equal in size.


Ok.


Could you replace the above with this text (with appropriate indentation 
etc.) while keeping the reference to Wikipedia?


--8<--
Differential pulse-code modulation (DPCM) compression can be used to 
compress the samples into fewer bits than they would otherwise require. 
This is done by calculating the difference between consecutive samples 
and outputting the difference which in average is much smaller than the 
values of the samples themselves since there is generally lots of 
correlation between adjacent pixels. In decompression the original 
samples are reconstructed. The process isn't lossless as the encoded 
sample size in bits is less than the original.


Formats using DPCM compression include linkend="pixfmt-srggb10dpcm8" />.


This control is used to select the predictor used to encode the samples.

The main difference between the simple and the advanced predictors is 
image quality, with advanced predictor supposed to produce better 
quality images as a result. Simple predictor can be used e.g. for 
testing purposes.

--8<--

Kind regards,

--
Sakari Ailus
sakari.ai...@iki.fi
--
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 v2] media: v4l2-ctrls: add control for test pattern

2012-09-07 Thread Sakari Ailus

Hi Prabhakar,

Thanks for the patch!

Prabhakar Lad wrote:

From: Lad, Prabhakar 

add V4L2_CID_TEST_PATTERN of type menu, which determines
the internal test pattern selected by the device.

Signed-off-by: Lad, Prabhakar 
Signed-off-by: Manjunath Hadli 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: Sylwester Nawrocki 
Cc: Hans de Goede 
Cc: Kyungmin Park 
Cc: Rob Landley 
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v2:
1: Included display devices in the description for test pattern
as pointed by Hans.
2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
pointed by Sylwester.
3: Removed the test patterns from menu as the are hardware specific
as pointed by Sakari.

  Documentation/DocBook/media/v4l/controls.xml |   20 
  drivers/media/v4l2-core/v4l2-ctrls.c |8 
  include/linux/videodev2.h|4 
  3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index ad873ea..173934e 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4311,6 +4311,26 @@ interface and may change in the future.
  

  
+ 
+   V4L2_CID_TEST_PATTERN
+   menu
+ 
+ 
+The Capture/Display/Sensors have the 
capability
+   to generate internal test patterns and this are hardware specific. 
This
+   test patterns are used to test a device is properly working and can 
generate
+   the desired waveforms that it supports.
+ 
+ 
+   
+ 
+   
+V4L2_TEST_PATTERN_DISABLED
+ Test pattern generation is disabled
+   
+ 
+   
+ 



diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 8f2f40b..d731422 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -430,6 +430,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Advanced",
NULL,
};
+   static const char * const test_pattern[] = {
+   "Disabled",
+   NULL,
+   };

switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -509,6 +513,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return jpeg_chroma_subsampling;
case V4L2_CID_DPCM_PREDICTOR:
return dpcm_predictor;
+   case V4L2_CID_TEST_PATTERN:
+   return test_pattern;


I think it's not necessary to define test_pattern (nor be prepared to 
return it) since the menu is going to be device specific. So the driver 
is responsible for all of the menu items. Such menus are created using 
v4l2_ctrl_new_custom() instead of v4l2_ctrl_new_std_menu().


Looks good to me otherwise.

Kind regards,

--
Sakari Ailus
sakari.ai...@iki.fi
--
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 11/14] drivers/media/usb/stk1160/stk1160-i2c.c: fix error return code

2012-09-07 Thread Ezequiel Garcia
On Thu, Sep 6, 2012 at 12:23 PM, Peter Senna Tschudin
 wrote:
> From: Peter Senna Tschudin 
>
> Convert a nonnegative error return code to a negative one, as returned
> elsewhere in the function.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // 
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
>   ... when != ret = e2
>   when forall
>  return ret;
> }
>
> // 
>
> Signed-off-by: Peter Senna Tschudin 
>
> ---
>  drivers/media/usb/stk1160/stk1160-i2c.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/stk1160/stk1160-i2c.c 
> b/drivers/media/usb/stk1160/stk1160-i2c.c
> index 176ac93..850cf28 100644
> --- a/drivers/media/usb/stk1160/stk1160-i2c.c
> +++ b/drivers/media/usb/stk1160/stk1160-i2c.c
> @@ -116,7 +116,7 @@ static int stk1160_i2c_read_reg(struct stk1160 *dev, u8 
> addr,
> if (rc < 0)
> return rc;
>
> -   stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> +   rc = stk1160_read_reg(dev, STK1160_SBUSR_RD, value);
> if (rc < 0)
> return rc;
>
>
> --

Acked-by: Ezequiel Garcia 
--
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 9/10] drivers/media/dvb-frontends/tda10071.c: removes unnecessary semicolon

2012-09-07 Thread Antti Palosaari

On 09/07/2012 06:24 PM, Peter Senna Tschudin wrote:

From: Peter Senna Tschudin 

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin 

---
  drivers/media/dvb-frontends/tda10071.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/media/dvb-frontends/tda10071.c 
b/drivers/media/dvb-frontends/tda10071.c
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -257,7 +257,7 @@ static int tda10071_set_voltage(struct d
__func__);
ret = -EINVAL;
goto error;
-   };
+   }

cmd.args[0] = CMD_LNB_SET_DC_LEVEL;
cmd.args[1] = 0;
@@ -369,7 +369,7 @@ static int tda10071_diseqc_recv_slave_re
if (ret)
goto error;

-   reply->msg_len = tmp & 0x1f; /* [4:0] */;
+   reply->msg_len = tmp & 0x1f; /* [4:0] */
if (reply->msg_len > sizeof(reply->msg))
reply->msg_len = sizeof(reply->msg); /* truncate API max */




Acked-by: Antti Palosaari 

Antti
--
http://palosaari.fi/
--
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 9/10] drivers/media/dvb-frontends/tda10071.c: removes unnecessary semicolon

2012-09-07 Thread Peter Senna Tschudin
From: Peter Senna Tschudin 

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin 

---
 drivers/media/dvb-frontends/tda10071.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/media/dvb-frontends/tda10071.c 
b/drivers/media/dvb-frontends/tda10071.c
--- a/drivers/media/dvb-frontends/tda10071.c
+++ b/drivers/media/dvb-frontends/tda10071.c
@@ -257,7 +257,7 @@ static int tda10071_set_voltage(struct d
__func__);
ret = -EINVAL;
goto error;
-   };
+   }
 
cmd.args[0] = CMD_LNB_SET_DC_LEVEL;
cmd.args[1] = 0;
@@ -369,7 +369,7 @@ static int tda10071_diseqc_recv_slave_re
if (ret)
goto error;
 
-   reply->msg_len = tmp & 0x1f; /* [4:0] */;
+   reply->msg_len = tmp & 0x1f; /* [4:0] */
if (reply->msg_len > sizeof(reply->msg))
reply->msg_len = sizeof(reply->msg); /* truncate API max */
 

--
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 8/10] drivers/media/dvb-core/dvb_demux.c: removes unnecessary semicolon

2012-09-07 Thread Peter Senna Tschudin
From: Peter Senna Tschudin 

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin 

---
 drivers/media/dvb-core/dvb_demux.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff -u -p a/drivers/media/dvb-core/dvb_demux.c 
b/drivers/media/dvb-core/dvb_demux.c
--- a/drivers/media/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb-core/dvb_demux.c
@@ -424,12 +424,12 @@ static void dvb_dmx_swfilter_packet(stru
printk(KERN_INFO "TS speed %llu Kbits/sec \n",
div64_u64(speed_bytes,
speed_timedelta));
-   };
+   }
 
demux->speed_last_time = cur_time;
demux->speed_pkts_cnt = 0;
-   };
-   };
+   }
+   }
 
if (buf[1] & 0x80) {
dprintk_tscheck("TEI detected. "
@@ -451,9 +451,9 @@ static void dvb_dmx_swfilter_packet(stru
buf[3] & 0xf);
 
demux->cnt_storage[pid] = ((buf[3] & 0xf) + 1)&0xf;
-   };
+   }
/* end check */
-   };
+   }
 
list_for_each_entry(feed, &demux->feed_list, list_head) {
if ((feed->pid != pid) && (feed->pid != 0x2000))

--
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 7/10] drivers/media/tuners/tda18271-common.c: removes unnecessary semicolon

2012-09-07 Thread Peter Senna Tschudin
From: Peter Senna Tschudin 

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin 

---
 drivers/media/tuners/tda18271-common.c |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff -u -p a/drivers/media/tuners/tda18271-common.c 
b/drivers/media/tuners/tda18271-common.c
--- a/drivers/media/tuners/tda18271-common.c
+++ b/drivers/media/tuners/tda18271-common.c
@@ -275,7 +275,7 @@ int tda18271_init_regs(struct dvb_fronte
case TDA18271HDC2:
regs[R_ID]   = 0x84;
break;
-   };
+   }
 
regs[R_TM]   = 0x08;
regs[R_PL]   = 0x80;
@@ -300,7 +300,7 @@ int tda18271_init_regs(struct dvb_fronte
case TDA18271HDC2:
regs[R_EB1]  = 0xfc;
break;
-   };
+   }
 
regs[R_EB2]  = 0x01;
regs[R_EB3]  = 0x84;
@@ -320,7 +320,7 @@ int tda18271_init_regs(struct dvb_fronte
case TDA18271HDC2:
regs[R_EB12] = 0x33;
break;
-   };
+   }
 
regs[R_EB13] = 0xc1;
regs[R_EB14] = 0x00;
@@ -335,7 +335,7 @@ int tda18271_init_regs(struct dvb_fronte
case TDA18271HDC2:
regs[R_EB18] = 0x8c;
break;
-   };
+   }
 
regs[R_EB19] = 0x00;
regs[R_EB20] = 0x20;
@@ -347,7 +347,7 @@ int tda18271_init_regs(struct dvb_fronte
case TDA18271HDC2:
regs[R_EB21] = 0xb3;
break;
-   };
+   }
 
regs[R_EB22] = 0x48;
regs[R_EB23] = 0xb0;

--
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 6/10] drivers/media/i2c/tea6415c.c: removes unnecessary semicolon

2012-09-07 Thread Peter Senna Tschudin
From: Peter Senna Tschudin 

removes unnecessary semicolon

Found by Coccinelle: http://coccinelle.lip6.fr/

Signed-off-by: Peter Senna Tschudin 

---
 drivers/media/i2c/tea6415c.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -u -p a/drivers/media/i2c/tea6415c.c b/drivers/media/i2c/tea6415c.c
--- a/drivers/media/i2c/tea6415c.c
+++ b/drivers/media/i2c/tea6415c.c
@@ -81,7 +81,7 @@ static int tea6415c_s_routing(struct v4l
case 13:
byte = 0x28;
break;
-   };
+   }
 
switch (i) {
case 5:
@@ -108,7 +108,7 @@ static int tea6415c_s_routing(struct v4l
case 11:
byte |= 0x07;
break;
-   };
+   }
 
ret = i2c_smbus_write_byte(client, byte);
if (ret) {

--
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 API PATCH 00/28] Full series of API fixes from the 2012 Media Workshop

2012-09-07 Thread Devin Heitmueller
On Fri, Sep 7, 2012 at 9:29 AM, Hans Verkuil  wrote:
> I have also tested this patch series (actually a slightly older version)
> with em28xx. That driver needed a lot of changes to get it to pass the
> v4l2-compliance tests. Those can be found here:
>
> http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/em28xx

This is mostly informational, but problems found with the em28xx v4l
driver will likely also be in the au0828 (since when doing the analog
support for au0828 I derived large portions of the code from em28xx).

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.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


[PATCH] drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c: fix error return code

2012-09-07 Thread Peter Senna Tschudin
From: Peter Senna Tschudin 

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// 
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
when != &ret
*if(...)
{
  ... when != ret = e2
  when forall
 return ret;
}

// 

Signed-off-by: Peter Senna Tschudin 

---
 drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/../linux-next/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c 
b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
index c8c94fb..273df94 100644
--- a/../linux-next/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
+++ b/drivers/media/pci/cx25821/cx25821-video-upstream-ch2.c
@@ -704,7 +704,6 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, 
int channel_select,
 {
struct sram_channel *sram_ch;
u32 tmp;
-   int retval = 0;
int err = 0;
int data_frame_size = 0;
int risc_buffer_size = 0;
@@ -749,15 +748,19 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, 
int channel_select,
dev->_filename_ch2 = kmemdup(dev->input_filename_ch2,
 str_length + 1, GFP_KERNEL);
 
-   if (!dev->_filename_ch2)
+   if (!dev->_filename_ch2) {
+   err = -ENOENT;
goto error;
+   }
} else {
str_length = strlen(dev->_defaultname_ch2);
dev->_filename_ch2 = kmemdup(dev->_defaultname_ch2,
 str_length + 1, GFP_KERNEL);
 
-   if (!dev->_filename_ch2)
+   if (!dev->_filename_ch2) {
+   err = -ENOENT;
goto error;
+   }
}
 
/* Default if filename is empty string */
@@ -773,7 +776,7 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, 
int channel_select,
}
}
 
-   retval = cx25821_sram_channel_setup_upstream(dev, sram_ch,
+   err = cx25821_sram_channel_setup_upstream(dev, sram_ch,
dev->_line_size_ch2, 0);
 
/* setup fifo + format */
@@ -783,9 +786,9 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, 
int channel_select,
dev->upstream_databuf_size_ch2 = data_frame_size * 2;
 
/* Allocating buffers and prepare RISC program */
-   retval = cx25821_upstream_buffer_prepare_ch2(dev, sram_ch,
+   err = cx25821_upstream_buffer_prepare_ch2(dev, sram_ch,
dev->_line_size_ch2);
-   if (retval < 0) {
+   if (err < 0) {
pr_err("%s: Failed to set up Video upstream buffers!\n",
   dev->name);
goto error;

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


[RFCv2 API PATCH 15/28] DocBook: Mark CROPCAP as optional instead of as compulsory.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

While the documentation says that VIDIOC_CROPCAP is compulsory for
all video capture and output devices, in practice VIDIOC_CROPCAP is
only implemented for devices that can do cropping and/or scaling.

Update the documentation to no longer require VIDIOC_CROPCAP if the
driver does not support cropping or scaling or non-square pixels.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/common.xml |  145 +---
 Documentation/DocBook/media/v4l/vidioc-cropcap.xml |   10 +-
 2 files changed, 75 insertions(+), 80 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/common.xml 
b/Documentation/DocBook/media/v4l/common.xml
index 9378d7b..454258b 100644
--- a/Documentation/DocBook/media/v4l/common.xml
+++ b/Documentation/DocBook/media/v4l/common.xml
@@ -628,7 +628,7 @@ are available for the device.
 if (-1 == ioctl (fd, &VIDIOC-G-STD;, &std_id)) {
/* Note when VIDIOC_ENUMSTD always returns EINVAL this
   is no video device or it falls under the USB exception,
-  and VIDIOC_G_STD returning EINVAL is no error. */
+  and VIDIOC_G_STD returning ENOTTY is no error. */
 
perror ("VIDIOC_G_STD");
exit (EXIT_FAILURE);
@@ -905,9 +905,9 @@ inserted.
 Source and target rectangles are defined even if the device
 does not support scaling or the VIDIOC_G/S_CROP
 ioctls. Their size (and position where applicable) will be fixed in
-this case. All capture and output device must support the
-VIDIOC_CROPCAP ioctl such that applications can
-determine if scaling takes place.
+this case. All capture and output device that support cropping
+and/or scaling and/or have non-square pixels must support the 
VIDIOC_CROPCAP
+ioctl such that applications can determine if scaling takes 
place.
 
 
   Cropping Structures
@@ -1032,24 +1032,21 @@ devices.)
 &v4l2-cropcap; cropcap;
 &v4l2-crop; crop;
 
-memset (&cropcap, 0, sizeof (cropcap));
+memset(&cropcap, 0, sizeof(cropcap));
 cropcap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-if (-1 == ioctl (fd, &VIDIOC-CROPCAP;, &cropcap)) {
-   perror ("VIDIOC_CROPCAP");
-   exit (EXIT_FAILURE);
-}
-
-memset (&crop, 0, sizeof (crop));
-crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-crop.c = cropcap.defrect;
+if (0 == ioctl(fd, &VIDIOC-CROPCAP;, &cropcap)) {
+   memset(&crop, 0, sizeof(crop));
+   crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+   crop.c = cropcap.defrect;
 
-/* Ignore if cropping is not supported (EINVAL). */
+   /* Ignore if cropping is not supported (ENOTTY). */
 
-if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &crop)
-&& errno != EINVAL) {
-   perror ("VIDIOC_S_CROP");
-   exit (EXIT_FAILURE);
+   if (-1 == ioctl(fd, &VIDIOC-S-CROP;, &crop)
+   && errno != ENOTTY) {
+   perror("VIDIOC_S_CROP");
+   exit(EXIT_FAILURE);
+   }
 }
   
   
@@ -1063,11 +1060,11 @@ if (-1 == ioctl (fd, &VIDIOC-S-CROP;, &crop)
 &v4l2-cropcap; cropcap;
 &v4l2-format; format;
 
-reset_cropping_parameters ();
+reset_cropping_parameters();
 
 /* Scale down to 1/4 size of full picture. */
 
-memset (&format, 0, sizeof (format)); /* defaults */
+memset(&format, 0, sizeof(format)); /* defaults */
 
 format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
@@ -1075,9 +1072,9 @@ format.fmt.pix.width = cropcap.defrect.width >> 1;
 format.fmt.pix.height = cropcap.defrect.height >> 1;
 format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
 
-if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &format)) {
-   perror ("VIDIOC_S_FORMAT");
-   exit (EXIT_FAILURE);
+if (-1 == ioctl(fd, &VIDIOC-S-FMT;, &format)) {
+   perror("VIDIOC_S_FORMAT");
+   exit(EXIT_FAILURE);
 }
 
 /* We could check the actual image size now, the actual scaling factor
@@ -1092,33 +1089,30 @@ if (-1 == ioctl (fd, &VIDIOC-S-FMT;, &format)) {
 &v4l2-cropcap; cropcap;
 &v4l2-crop; crop;
 
-memset (&cropcap, 0, sizeof (cropcap));
+memset(&cropcap, 0, sizeof (cropcap));
 cropcap.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
 
-if (-1 == ioctl (fd, VIDIOC_CROPCAP;, &cropcap)) {
-   perror ("VIDIOC_CROPCAP");
-   exit (EXIT_FAILURE);
-}
-
-memset (&crop, 0, sizeof (crop));
+if (0 == ioctl(fd, &VIDIOC-CROPCAP;, &cropcap)) {
+   memset(&crop, 0, sizeof (crop));
 
-crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
-crop.c = cropcap.defrect;
+   crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
+   crop.c = cropcap.defrect;
 
-/* Scale the width and height to 50 % of their original size
-   and center the output. */
+   /* Scale the width and height to 50 % of their original size
+  and center the output. */
 
-crop.c.width /= 2;
-crop.c.height /= 2;
-crop.c.left += crop.c.width / 2;
-crop.c.top += crop.c.height / 2;
+   crop.c.width /= 2;
+   crop.c.height /= 2;
+   crop.c.left += crop.c.width / 2;
+   crop.c.top += crop.c.height / 2;
 
-/* Ignore if cropping is not supported (EINVAL). */
+   /* Ignore if cropping is not supported (ENOTTY). */
 
-if (-1 == ioctl (fd, VIDIOC_S_CRO

[RFCv2 API PATCH 28/28] Add vfl_dir field documentation.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 Documentation/video4linux/v4l2-framework.txt |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 89318be..20f1c05 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -583,11 +583,18 @@ You should also set these fields:
 
 - name: set to something descriptive and unique.
 
+- vfl_dir: set to VFL_DIR_TX for output devices and VFL_DIR_M2M for mem2mem
+  (codec) devices.
+
 - fops: set to the v4l2_file_operations struct.
 
 - ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance
   (highly recommended to use this and it might become compulsory in the
-  future!), then set this to your v4l2_ioctl_ops struct.
+  future!), then set this to your v4l2_ioctl_ops struct. The vfl_type and
+  vfl_dir fields are used to disable ops that do not match the type/dir
+  combination. E.g. VBI ops are disabled for non-VBI nodes, and output ops
+  are disabled for a capture device. This makes it possible to provide
+  just one v4l2_ioctl_ops struct for both vbi and video nodes.
 
 - lock: leave to NULL if you want to do all the locking in the driver.
   Otherwise you give it a pointer to a struct mutex_lock and before the
-- 
1.7.10.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


[RFCv2 API PATCH 23/28] v4l2: make vidioc_s_crop const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_crop.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/i2c/soc_camera/mt9m001.c |2 +-
 drivers/media/i2c/soc_camera/mt9m111.c |2 +-
 drivers/media/i2c/soc_camera/mt9t031.c |2 +-
 drivers/media/i2c/soc_camera/mt9t112.c |4 +--
 drivers/media/i2c/soc_camera/mt9v022.c |2 +-
 drivers/media/i2c/soc_camera/ov5642.c  |   20 ++--
 drivers/media/i2c/soc_camera/ov6650.c  |   32 ++--
 drivers/media/i2c/soc_camera/rj54n1cb0c.c  |4 +--
 drivers/media/i2c/tvp5150.c|2 +-
 drivers/media/pci/bt8xx/bttv-driver.c  |   10 +++---
 drivers/media/pci/cx18/cx18-ioctl.c|2 +-
 drivers/media/pci/cx25821/cx25821-video.c  |2 +-
 drivers/media/pci/cx25821/cx25821-video.h  |2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c|2 +-
 drivers/media/pci/saa7134/saa7134-video.c  |   32 ++--
 drivers/media/pci/zoran/zoran_driver.c |2 +-
 drivers/media/platform/davinci/vpbe_display.c  |2 +-
 drivers/media/platform/davinci/vpfe_capture.c  |2 +-
 drivers/media/platform/omap/omap_vout.c|2 +-
 drivers/media/platform/s5p-fimc/fimc-m2m.c |2 +-
 drivers/media/platform/s5p-g2d/g2d.c   |2 +-
 drivers/media/platform/sh_vou.c|2 +-
 .../platform/soc_camera/sh_mobile_ceu_camera.c |4 +--
 drivers/media/platform/soc_camera/soc_camera.c |6 ++--
 drivers/media/platform/vino.c  |2 +-
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c   |2 +-
 drivers/staging/media/go7007/go7007-v4l2.c |2 +-
 include/media/soc_camera.h |4 +--
 include/media/v4l2-ioctl.h |2 +-
 include/media/v4l2-subdev.h|2 +-
 30 files changed, 79 insertions(+), 79 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/mt9m001.c 
b/drivers/media/i2c/soc_camera/mt9m001.c
index d85be41..19f8a07 100644
--- a/drivers/media/i2c/soc_camera/mt9m001.c
+++ b/drivers/media/i2c/soc_camera/mt9m001.c
@@ -171,7 +171,7 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int 
enable)
return 0;
 }
 
-static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int mt9m001_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9m001 *mt9m001 = to_mt9m001(client);
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c 
b/drivers/media/i2c/soc_camera/mt9m111.c
index 938c5c3..62fd94a 100644
--- a/drivers/media/i2c/soc_camera/mt9m111.c
+++ b/drivers/media/i2c/soc_camera/mt9m111.c
@@ -383,7 +383,7 @@ static int mt9m111_reset(struct mt9m111 *mt9m111)
return ret;
 }
 
-static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int mt9m111_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
 {
struct v4l2_rect rect = a->c;
struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev);
diff --git a/drivers/media/i2c/soc_camera/mt9t031.c 
b/drivers/media/i2c/soc_camera/mt9t031.c
index d74607a..40800b1 100644
--- a/drivers/media/i2c/soc_camera/mt9t031.c
+++ b/drivers/media/i2c/soc_camera/mt9t031.c
@@ -294,7 +294,7 @@ static int mt9t031_set_params(struct i2c_client *client,
return ret < 0 ? ret : 0;
 }
 
-static int mt9t031_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int mt9t031_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
 {
struct v4l2_rect rect = a->c;
struct i2c_client *client = v4l2_get_subdevdata(sd);
diff --git a/drivers/media/i2c/soc_camera/mt9t112.c 
b/drivers/media/i2c/soc_camera/mt9t112.c
index 9ba428e..de7cd83 100644
--- a/drivers/media/i2c/soc_camera/mt9t112.c
+++ b/drivers/media/i2c/soc_camera/mt9t112.c
@@ -907,11 +907,11 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct 
v4l2_crop *a)
return 0;
 }
 
-static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
+static int mt9t112_s_crop(struct v4l2_subdev *sd, const struct v4l2_crop *a)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct mt9t112_priv *priv = to_mt9t112(client);
-   struct v4l2_rect *rect = &a->c;
+   const struct v4l2_rect *rect = &a->c;
 
return mt9t112_set_params(priv, rect, priv->format->code);
 }
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c 
b/drivers/media/i2c/soc_camera/mt9v022.c
index 350d0d8..13057b9 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -237,7 +237,7 @@ static int mt9v022_s_stream(struct v4l2_subdev *sd

[RFCv2 API PATCH 03/28] DocBook: improve STREAMON/OFF documentation.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Specify that STREAMON/OFF should return 0 if the stream is already
started/stopped.

The spec never specified what the correct behavior is. This ambiguity
was resolved during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/vidioc-streamon.xml |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-streamon.xml 
b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
index 81cca45..716ea15 100644
--- a/Documentation/DocBook/media/v4l/vidioc-streamon.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-streamon.xml
@@ -74,7 +74,12 @@ not transmitted yet. I/O returns to the same state as after 
calling
 stream type. This is the same as &v4l2-requestbuffers;
 type.
 
-Note applications can be preempted for unknown periods right
+If VIDIOC_STREAMON is called when streaming
+is already in progress, or if VIDIOC_STREAMOFF is called
+when streaming is already stopped, then the ioctl does nothing and 0 is
+returned.
+
+Note that applications can be preempted for unknown periods right
 before or after the VIDIOC_STREAMON or
 VIDIOC_STREAMOFF calls, there is no notion of
 starting or stopping "now". Buffer timestamps can be used to
-- 
1.7.10.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


[RFCv2 API PATCH 18/28] v4l2: make vidioc_s_freq_hw_seek const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_freq_hw_seek.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/radio/radio-mr800.c|2 +-
 drivers/media/radio/radio-tea5777.c  |2 +-
 drivers/media/radio/radio-wl1273.c   |2 +-
 drivers/media/radio/si470x/radio-si470x-common.c |4 ++--
 drivers/media/radio/wl128x/fmdrv_v4l2.c  |2 +-
 include/media/v4l2-ioctl.h   |2 +-
 sound/i2c/other/tea575x-tuner.c  |2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/radio/radio-mr800.c 
b/drivers/media/radio/radio-mr800.c
index 3182b26..720bf0d 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -348,7 +348,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_hw_freq_seek(struct file *file, void *priv,
-   struct v4l2_hw_freq_seek *seek)
+   const struct v4l2_hw_freq_seek *seek)
 {
static u8 buf[8] = {
0x3d, 0x32, 0x0f, 0x08, 0x3d, 0x32, 0x0f, 0x08
diff --git a/drivers/media/radio/radio-tea5777.c 
b/drivers/media/radio/radio-tea5777.c
index 5bc9fa6..82a1617 100644
--- a/drivers/media/radio/radio-tea5777.c
+++ b/drivers/media/radio/radio-tea5777.c
@@ -303,7 +303,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
 }
 
 static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
-   struct v4l2_hw_freq_seek *a)
+   const struct v4l2_hw_freq_seek *a)
 {
struct radio_tea5777 *tea = video_drvdata(file);
u32 orig_freq = tea->freq;
diff --git a/drivers/media/radio/radio-wl1273.c 
b/drivers/media/radio/radio-wl1273.c
index a22ad1c..71968a6 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -1682,7 +1682,7 @@ static int wl1273_fm_vidioc_s_frequency(struct file 
*file, void *priv,
 #define WL1273_DEFAULT_SEEK_LEVEL  7
 
 static int wl1273_fm_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-  struct v4l2_hw_freq_seek *seek)
+  const struct v4l2_hw_freq_seek *seek)
 {
struct wl1273_device *radio = video_get_drvdata(video_devdata(file));
struct wl1273_core *core = radio->core;
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index 9bb65e1..74a5c90 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -296,7 +296,7 @@ int si470x_set_freq(struct si470x_device *radio, unsigned 
int freq)
  * si470x_set_seek - set seek
  */
 static int si470x_set_seek(struct si470x_device *radio,
-  struct v4l2_hw_freq_seek *seek)
+  const struct v4l2_hw_freq_seek *seek)
 {
int band, retval;
unsigned int freq;
@@ -701,7 +701,7 @@ static int si470x_vidioc_s_frequency(struct file *file, 
void *priv,
  * si470x_vidioc_s_hw_freq_seek - set hardware frequency seek
  */
 static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-   struct v4l2_hw_freq_seek *seek)
+   const struct v4l2_hw_freq_seek *seek)
 {
struct si470x_device *radio = video_drvdata(file);
 
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c 
b/drivers/media/radio/wl128x/fmdrv_v4l2.c
index db2248e..f816ea6 100644
--- a/drivers/media/radio/wl128x/fmdrv_v4l2.c
+++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c
@@ -403,7 +403,7 @@ static int fm_v4l2_vidioc_s_freq(struct file *file, void 
*priv,
 
 /* Set hardware frequency seek. If current mode is NOT RX, set it RX. */
 static int fm_v4l2_vidioc_s_hw_freq_seek(struct file *file, void *priv,
-   struct v4l2_hw_freq_seek *seek)
+   const struct v4l2_hw_freq_seek *seek)
 {
struct fmdev *fmdev = video_drvdata(file);
int ret;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index 21f6245..865f95d 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -233,7 +233,7 @@ struct v4l2_ioctl_ops {
int (*vidioc_log_status)   (struct file *file, void *fh);
 
int (*vidioc_s_hw_freq_seek)   (struct file *file, void *fh,
-   struct v4l2_hw_freq_seek *a);
+   const struct v4l2_hw_freq_seek *a);
 
/* Debugging ioctls */
 #ifdef CONFIG_VIDEO_ADV_DEBUG
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index d14edb7..59cebe2 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -255,7 +255,7 @@ static int vidioc_s_frequency(struct file *file, vo

[RFCv2 API PATCH 27/28] v4l2-dev: reorder checks into blocks of ioctls with similar properties.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

This makes it easier to read and also ties in more closely with the
profile concept.

Signed-off-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-dev.c |  156 +---
 1 file changed, 74 insertions(+), 82 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index 3e15a079..4b86065 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -559,6 +559,8 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
 
bitmap_zero(valid_ioctls, BASE_VIDIOC_PRIVATE);
 
+   /* vfl_type and vfl_dir independent ioctls */
+
SET_VALID_IOCTL(ops, VIDIOC_QUERYCAP, vidioc_querycap);
if (ops->vidioc_g_priority ||
test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags))
@@ -566,7 +568,49 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
if (ops->vidioc_s_priority ||
test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags))
set_bit(_IOC_NR(VIDIOC_S_PRIORITY), valid_ioctls);
+   SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs);
+   SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf);
+   SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf);
+   SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf);
+   SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon);
+   SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff);
+   /* Note: the control handler can also be passed through the filehandle,
+  and that can't be tested here. If the bit for these control ioctls
+  is set, then the ioctl is valid. But if it is 0, then it can still
+  be valid if the filehandle passed the control handler. */
+   if (vdev->ctrl_handler || ops->vidioc_queryctrl)
+   set_bit(_IOC_NR(VIDIOC_QUERYCTRL), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_g_ctrl || ops->vidioc_g_ext_ctrls)
+   set_bit(_IOC_NR(VIDIOC_G_CTRL), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_s_ctrl || ops->vidioc_s_ext_ctrls)
+   set_bit(_IOC_NR(VIDIOC_S_CTRL), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_g_ext_ctrls)
+   set_bit(_IOC_NR(VIDIOC_G_EXT_CTRLS), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_s_ext_ctrls)
+   set_bit(_IOC_NR(VIDIOC_S_EXT_CTRLS), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_try_ext_ctrls)
+   set_bit(_IOC_NR(VIDIOC_TRY_EXT_CTRLS), valid_ioctls);
+   if (vdev->ctrl_handler || ops->vidioc_querymenu)
+   set_bit(_IOC_NR(VIDIOC_QUERYMENU), valid_ioctls);
+   SET_VALID_IOCTL(ops, VIDIOC_G_FREQUENCY, vidioc_g_frequency);
+   SET_VALID_IOCTL(ops, VIDIOC_S_FREQUENCY, vidioc_s_frequency);
+   SET_VALID_IOCTL(ops, VIDIOC_LOG_STATUS, vidioc_log_status);
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+   SET_VALID_IOCTL(ops, VIDIOC_DBG_G_REGISTER, vidioc_g_register);
+   SET_VALID_IOCTL(ops, VIDIOC_DBG_S_REGISTER, vidioc_s_register);
+#endif
+   SET_VALID_IOCTL(ops, VIDIOC_DBG_G_CHIP_IDENT, vidioc_g_chip_ident);
+   /* yes, really vidioc_subscribe_event */
+   SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event);
+   SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event);
+   SET_VALID_IOCTL(ops, VIDIOC_UNSUBSCRIBE_EVENT, 
vidioc_unsubscribe_event);
+   SET_VALID_IOCTL(ops, VIDIOC_CREATE_BUFS, vidioc_create_bufs);
+   SET_VALID_IOCTL(ops, VIDIOC_PREPARE_BUF, vidioc_prepare_buf);
+   if (ops->vidioc_enum_freq_bands || ops->vidioc_g_tuner || 
ops->vidioc_g_modulator)
+   set_bit(_IOC_NR(VIDIOC_ENUM_FREQ_BANDS), valid_ioctls);
+
if (is_vid) {
+   /* video specific ioctls */
if ((is_rx && (ops->vidioc_enum_fmt_vid_cap ||
   ops->vidioc_enum_fmt_vid_cap_mplane ||
   ops->vidioc_enum_fmt_vid_overlay)) ||
@@ -594,7 +638,20 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
   ops->vidioc_try_fmt_vid_out_mplane ||
   ops->vidioc_try_fmt_vid_out_overlay)))
 set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls);
+   SET_VALID_IOCTL(ops, VIDIOC_OVERLAY, vidioc_overlay);
+   SET_VALID_IOCTL(ops, VIDIOC_G_FBUF, vidioc_g_fbuf);
+   SET_VALID_IOCTL(ops, VIDIOC_S_FBUF, vidioc_s_fbuf);
+   SET_VALID_IOCTL(ops, VIDIOC_G_JPEGCOMP, vidioc_g_jpegcomp);
+   SET_VALID_IOCTL(ops, VIDIOC_S_JPEGCOMP, vidioc_s_jpegcomp);
+   SET_VALID_IOCTL(ops, VIDIOC_G_ENC_INDEX, vidioc_g_enc_index);
+   SET_VALID_IOCTL(ops, VIDIOC_ENCODER_CMD, vidioc_encoder_cmd);
+   SET_VALID_IOCTL(ops, VIDIOC_TRY_ENCODER_CMD, 
vidioc_try_encoder_cmd);
+   SET_VALID_IOCTL(ops, VIDIOC_DECODER_CMD, vidioc_decoder_cmd);
+ 

[RFCv2 API PATCH 26/28] v4l2-dev: improve ioctl validity checks.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

The ioctl validity checks have been improved and now take vfl_type
and vfl_dir into account.

During the 2012 Media Workshop it was decided that these improved
v4l2 core checks should be added as they simplified drivers and
made drivers behave consistently.

Signed-off-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-dev.c   |  228 --
 drivers/media/v4l2-core/v4l2-ioctl.c |  182 +++
 2 files changed, 237 insertions(+), 173 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index 95f92ea..3e15a079 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -551,6 +551,11 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
 {
DECLARE_BITMAP(valid_ioctls, BASE_VIDIOC_PRIVATE);
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_rx = vdev->vfl_dir != VFL_DIR_TX;
+   bool is_tx = vdev->vfl_dir != VFL_DIR_RX;
 
bitmap_zero(valid_ioctls, BASE_VIDIOC_PRIVATE);
 
@@ -561,66 +566,87 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
if (ops->vidioc_s_priority ||
test_bit(V4L2_FL_USE_FH_PRIO, &vdev->flags))
set_bit(_IOC_NR(VIDIOC_S_PRIORITY), valid_ioctls);
-   if (ops->vidioc_enum_fmt_vid_cap ||
-   ops->vidioc_enum_fmt_vid_out ||
-   ops->vidioc_enum_fmt_vid_cap_mplane ||
-   ops->vidioc_enum_fmt_vid_out_mplane ||
-   ops->vidioc_enum_fmt_vid_overlay)
-   set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls);
-   if (ops->vidioc_g_fmt_vid_cap ||
-   ops->vidioc_g_fmt_vid_out ||
-   ops->vidioc_g_fmt_vid_cap_mplane ||
-   ops->vidioc_g_fmt_vid_out_mplane ||
-   ops->vidioc_g_fmt_vid_overlay ||
-   ops->vidioc_g_fmt_vbi_cap ||
-   ops->vidioc_g_fmt_vid_out_overlay ||
-   ops->vidioc_g_fmt_vbi_out ||
-   ops->vidioc_g_fmt_sliced_vbi_cap ||
-   ops->vidioc_g_fmt_sliced_vbi_out)
-   set_bit(_IOC_NR(VIDIOC_G_FMT), valid_ioctls);
-   if (ops->vidioc_s_fmt_vid_cap ||
-   ops->vidioc_s_fmt_vid_out ||
-   ops->vidioc_s_fmt_vid_cap_mplane ||
-   ops->vidioc_s_fmt_vid_out_mplane ||
-   ops->vidioc_s_fmt_vid_overlay ||
-   ops->vidioc_s_fmt_vbi_cap ||
-   ops->vidioc_s_fmt_vid_out_overlay ||
-   ops->vidioc_s_fmt_vbi_out ||
-   ops->vidioc_s_fmt_sliced_vbi_cap ||
-   ops->vidioc_s_fmt_sliced_vbi_out)
-   set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls);
-   if (ops->vidioc_try_fmt_vid_cap ||
-   ops->vidioc_try_fmt_vid_out ||
-   ops->vidioc_try_fmt_vid_cap_mplane ||
-   ops->vidioc_try_fmt_vid_out_mplane ||
-   ops->vidioc_try_fmt_vid_overlay ||
-   ops->vidioc_try_fmt_vbi_cap ||
-   ops->vidioc_try_fmt_vid_out_overlay ||
-   ops->vidioc_try_fmt_vbi_out ||
-   ops->vidioc_try_fmt_sliced_vbi_cap ||
-   ops->vidioc_try_fmt_sliced_vbi_out)
-   set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls);
+   if (is_vid) {
+   if ((is_rx && (ops->vidioc_enum_fmt_vid_cap ||
+  ops->vidioc_enum_fmt_vid_cap_mplane ||
+  ops->vidioc_enum_fmt_vid_overlay)) ||
+   (is_tx && (ops->vidioc_enum_fmt_vid_out ||
+  ops->vidioc_enum_fmt_vid_out_mplane)))
+   set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls);
+   if ((is_rx && (ops->vidioc_g_fmt_vid_cap ||
+  ops->vidioc_g_fmt_vid_cap_mplane ||
+  ops->vidioc_g_fmt_vid_overlay)) ||
+   (is_tx && (ops->vidioc_g_fmt_vid_out ||
+  ops->vidioc_g_fmt_vid_out_mplane ||
+  ops->vidioc_g_fmt_vid_out_overlay)))
+set_bit(_IOC_NR(VIDIOC_G_FMT), valid_ioctls);
+   if ((is_rx && (ops->vidioc_s_fmt_vid_cap ||
+  ops->vidioc_s_fmt_vid_cap_mplane ||
+  ops->vidioc_s_fmt_vid_overlay)) ||
+   (is_tx && (ops->vidioc_s_fmt_vid_out ||
+  ops->vidioc_s_fmt_vid_out_mplane ||
+  ops->vidioc_s_fmt_vid_out_overlay)))
+set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls);
+   if ((is_rx && (ops->vidioc_try_fmt_vid_cap ||
+  ops->vidioc_try_fmt_vid_cap_mplane ||
+  ops->vidioc_try_fmt_vid_overlay)) ||
+   (is_tx && (ops->vidioc_try_fmt_vid_out ||
+ 

[RFCv2 API PATCH 22/28] v4l2: make vidioc_s_modulator const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_modulator.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/radio/radio-keene.c   |2 +-
 drivers/media/radio/radio-si4713.c  |2 +-
 drivers/media/radio/radio-wl1273.c  |2 +-
 drivers/media/radio/si4713-i2c.c|4 ++--
 drivers/media/radio/wl128x/fmdrv_v4l2.c |2 +-
 include/media/v4l2-ioctl.h  |2 +-
 include/media/v4l2-subdev.h |2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/radio/radio-keene.c 
b/drivers/media/radio/radio-keene.c
index 79adf3e..e10e525 100644
--- a/drivers/media/radio/radio-keene.c
+++ b/drivers/media/radio/radio-keene.c
@@ -203,7 +203,7 @@ static int vidioc_g_modulator(struct file *file, void *priv,
 }
 
 static int vidioc_s_modulator(struct file *file, void *priv,
-   struct v4l2_modulator *v)
+   const struct v4l2_modulator *v)
 {
struct keene_device *radio = video_drvdata(file);
 
diff --git a/drivers/media/radio/radio-si4713.c 
b/drivers/media/radio/radio-si4713.c
index 1e04101..a082e40 100644
--- a/drivers/media/radio/radio-si4713.c
+++ b/drivers/media/radio/radio-si4713.c
@@ -200,7 +200,7 @@ static int radio_si4713_g_modulator(struct file *file, void 
*p,
 }
 
 static int radio_si4713_s_modulator(struct file *file, void *p,
-   struct v4l2_modulator *vm)
+   const struct v4l2_modulator *vm)
 {
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
s_modulator, vm);
diff --git a/drivers/media/radio/radio-wl1273.c 
b/drivers/media/radio/radio-wl1273.c
index 2d93354..b53ecbc 100644
--- a/drivers/media/radio/radio-wl1273.c
+++ b/drivers/media/radio/radio-wl1273.c
@@ -1715,7 +1715,7 @@ out:
 }
 
 static int wl1273_fm_vidioc_s_modulator(struct file *file, void *priv,
-   struct v4l2_modulator *modulator)
+   const struct v4l2_modulator *modulator)
 {
struct wl1273_device *radio = video_get_drvdata(video_devdata(file));
struct wl1273_core *core = radio->core;
diff --git a/drivers/media/radio/si4713-i2c.c b/drivers/media/radio/si4713-i2c.c
index b898c89..a9e6d17 100644
--- a/drivers/media/radio/si4713-i2c.c
+++ b/drivers/media/radio/si4713-i2c.c
@@ -1213,7 +1213,7 @@ exit:
 }
 
 static int si4713_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency 
*f);
-static int si4713_s_modulator(struct v4l2_subdev *sd, struct v4l2_modulator *);
+static int si4713_s_modulator(struct v4l2_subdev *sd, const struct 
v4l2_modulator *);
 /*
  * si4713_setup - Sets the device up with current configuration.
  * @sdev: si4713_device structure for the device we are communicating
@@ -1873,7 +1873,7 @@ exit:
 }
 
 /* si4713_s_modulator - set modulator attributes */
-static int si4713_s_modulator(struct v4l2_subdev *sd, struct v4l2_modulator 
*vm)
+static int si4713_s_modulator(struct v4l2_subdev *sd, const struct 
v4l2_modulator *vm)
 {
struct si4713_device *sdev = to_si4713_device(sd);
int rval = 0;
diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c 
b/drivers/media/radio/wl128x/fmdrv_v4l2.c
index 09585a9..8a672a3 100644
--- a/drivers/media/radio/wl128x/fmdrv_v4l2.c
+++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c
@@ -448,7 +448,7 @@ static int fm_v4l2_vidioc_g_modulator(struct file *file, 
void *priv,
 
 /* Set modulator attributes. If mode is not TX, set to TX. */
 static int fm_v4l2_vidioc_s_modulator(struct file *file, void *priv,
-   struct v4l2_modulator *mod)
+   const struct v4l2_modulator *mod)
 {
struct fmdev *fmdev = video_drvdata(file);
u8 rds_mode;
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index d4c7729..fbeb00e 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -179,7 +179,7 @@ struct v4l2_ioctl_ops {
int (*vidioc_g_modulator)  (struct file *file, void *fh,
struct v4l2_modulator *a);
int (*vidioc_s_modulator)  (struct file *file, void *fh,
-   struct v4l2_modulator *a);
+   const struct v4l2_modulator *a);
/* Crop ioctls */
int (*vidioc_cropcap)  (struct file *file, void *fh,
struct v4l2_cropcap *a);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 4cc1652..279bd8d 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -194,7 +194,7 @@ struct v4l2_subdev_tuner_ops {
int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
  

[RFCv2 API PATCH 14/28] DocBook: clarify that sequence is also set for output devices.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

It was not entirely obvious that the sequence count should also
be set for output devices. Also made it more explicit that this
sequence counter counts frames, not fields.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/io.xml |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index b680d66..d1c2369 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -617,8 +617,8 @@ field is independent of the 
timestamp and
__u32
sequence

-   Set by the driver, counting the frames in the
-sequence.
+   Set by the driver, counting the frames (not fields!) in the
+sequence. This field is set for both input and output devices.
  
  
In http://vger.kernel.org/majordomo-info.html


[RFCv2 API PATCH 01/28] v4l: Remove experimental tag from certain API elements

2012-09-07 Thread Hans Verkuil
From: Sakari Ailus 

Remove experimantal tag from the following API elements:

V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY buffer type.
V4L2_CAP_VIDEO_OUTPUT_OVERLAY capability flag.
VIDIOC_ENUM_FRAMESIZES IOCTL.
VIDIOC_ENUM_FRAMEINTERVALS IOCTL.
VIDIOC_G_ENC_INDEX IOCTL.
VIDIOC_ENCODER_CMD and VIDIOC_TRY_ENCODER_CMD IOCTLs.
VIDIOC_DECODER_CMD and VIDIOC_TRY_DECODER_CMD IOCTLs.

Signed-off-by: Sakari Ailus 
Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/compat.xml |   23 
 Documentation/DocBook/media/v4l/dev-osd.xml|7 --
 Documentation/DocBook/media/v4l/io.xml |3 +--
 .../DocBook/media/v4l/vidioc-decoder-cmd.xml   |7 --
 .../DocBook/media/v4l/vidioc-encoder-cmd.xml   |7 --
 .../DocBook/media/v4l/vidioc-enum-framesizes.xml   |7 --
 .../DocBook/media/v4l/vidioc-g-enc-index.xml   |7 --
 7 files changed, 1 insertion(+), 60 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 98e8d08..578135e 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2555,29 +2555,6 @@ and may change in the future.
  Video Output Overlay (OSD) Interface, .
 
-   
- V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
-   &v4l2-buf-type;, .
-
-
- V4L2_CAP_VIDEO_OUTPUT_OVERLAY,
-&VIDIOC-QUERYCAP; ioctl, .
-
-
- &VIDIOC-ENUM-FRAMESIZES; and
-&VIDIOC-ENUM-FRAMEINTERVALS; ioctls.
-
-
- &VIDIOC-G-ENC-INDEX; ioctl.
-
-
- &VIDIOC-ENCODER-CMD; and &VIDIOC-TRY-ENCODER-CMD;
-ioctls.
-
-
- &VIDIOC-DECODER-CMD; and &VIDIOC-TRY-DECODER-CMD;
-ioctls.
-
 
  &VIDIOC-DBG-G-REGISTER; and &VIDIOC-DBG-S-REGISTER;
 ioctls.
diff --git a/Documentation/DocBook/media/v4l/dev-osd.xml 
b/Documentation/DocBook/media/v4l/dev-osd.xml
index 479d943..dd91d61 100644
--- a/Documentation/DocBook/media/v4l/dev-osd.xml
+++ b/Documentation/DocBook/media/v4l/dev-osd.xml
@@ -1,13 +1,6 @@
   Video Output Overlay Interface
   Also known as On-Screen Display (OSD)
 
-  
-Experimental
-
-This is an experimental
-interface and may change in the future.
-  
-
   Some video output devices can overlay a framebuffer image onto
 the outgoing video signal. Applications can set up such an overlay
 using this interface, which borrows structures and ioctls of the 

V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY
8
Buffer for video output overlay (OSD), see . Status: Experimental.
+   linkend="osd" />.
  
  
V4L2_BUF_TYPE_PRIVATE
diff --git a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml 
b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
index 74b87f6..9215627 100644
--- a/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-decoder-cmd.xml
@@ -49,13 +49,6 @@
   
 Description
 
-
-  Experimental
-
-  This is an experimental
-interface and may change in the future.
-
-
 These ioctls control an audio/video (usually MPEG-) decoder.
 VIDIOC_DECODER_CMD sends a command to the
 decoder, VIDIOC_TRY_DECODER_CMD can be used to
diff --git a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml 
b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
index f431b3b..0619ca5 100644
--- a/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-encoder-cmd.xml
@@ -49,13 +49,6 @@
   
 Description
 
-
-  Experimental
-
-  This is an experimental
-interface and may change in the future.
-
-
 These ioctls control an audio/video (usually MPEG-) encoder.
 VIDIOC_ENCODER_CMD sends a command to the
 encoder, VIDIOC_TRY_ENCODER_CMD can be used to
diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml 
b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml
index f77a13f..a78454b 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-framesizes.xml
@@ -50,13 +50,6 @@ and pixel format and receives a frame width and 
height.
   
 Description
 
-
-  Experimental
-
-  This is an experimental
-interface and may change in the future.
-
-
 This ioctl allows applications to enumerate all frame sizes
 (&ie; width and height in pixels) that the device supports for the
 given pixel format.
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml
index 2aef02c..be25029 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-enc-index.xml
@@ -48,13 +48,6 @@
   
 Description
 
-
-  Experimental
-
-  This is an experimental
-interface and may change in the futur

[RFCv2 API PATCH 05/28] DocBook: bus_info can no longer be empty.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

During the 2012 Media Workshop it was decided that bus_info as returned
by VIDIOC_QUERYCAP can no longer be empty. It should be a unique identifier,
and empty strings are obviously not unique.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/vidioc-querycap.xml |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml 
b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
index f33dd74..d5b1248 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
@@ -90,11 +90,17 @@ ambiguities.
__u8
bus_info[32]
Location of the device in the system, a
-NUL-terminated ASCII string. For example: "PCI Slot 4". This
+NUL-terminated ASCII string. For example: "PCI::05:06.0". This
 information is intended for users, to distinguish multiple
-identical devices. If no such information is available the field may
-simply count the devices controlled by the driver, or contain the
-empty string (bus_info[0] = 0).
+identical devices. If no such information is available the field must
+simply count the devices controlled by the driver ("vivi-000"). The bus_info
+must start with "PCI:" for PCI boards, "PCIe:" for PCI Express boards,
+"usb-" for USB devices, "I2C:" for i2c devices, "ISA:" for ISA devices and
+"parport" for parallel port devices.
+For devices without a bus it should start with the driver name, optionally
+followed by "-" and an index if multiple instances of the device as possible.
+Many platform devices can have only one instance, so in that case bus_info
+is identical to the driver field.
  
  
__u32
-- 
1.7.10.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


[RFCv2 API PATCH 08/28] v4l2: remove experimental tag from a number of old drivers.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

A number of old drivers still had the experimental tag. Time to remove it.

It concerns the following drivers:

VIDEO_TLV320AIC23B
USB_STKWEBCAM
VIDEO_CX18
VIDEO_CX18_ALSA
VIDEO_ZORAN_AVS6EYES
DVB_USB_AF9005
MEDIA_TUNER_TEA5761
VIDEO_NOON010PC30

This decision was taken during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/i2c/Kconfig   |4 ++--
 drivers/media/pci/cx18/Kconfig  |4 ++--
 drivers/media/pci/zoran/Kconfig |4 ++--
 drivers/media/tuners/Kconfig|5 ++---
 drivers/media/usb/dvb-usb/Kconfig   |2 +-
 drivers/media/usb/stkwebcam/Kconfig |2 +-
 6 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 9a5a059..64e0c5c 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -117,7 +117,7 @@ config VIDEO_CS53L32A
 
 config VIDEO_TLV320AIC23B
tristate "Texas Instruments TLV320AIC23B audio codec"
-   depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
+   depends on VIDEO_V4L2 && I2C
---help---
  Support for the Texas Instruments TLV320AIC23B audio codec.
 
@@ -469,7 +469,7 @@ config VIDEO_SR030PC30
 
 config VIDEO_NOON010PC30
tristate "Siliconfile NOON010PC30 sensor support"
-   depends on I2C && VIDEO_V4L2 && EXPERIMENTAL && VIDEO_V4L2_SUBDEV_API
+   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
depends on MEDIA_CAMERA_SUPPORT
---help---
  This driver supports NOON010PC30 CIF camera from Siliconfile
diff --git a/drivers/media/pci/cx18/Kconfig b/drivers/media/pci/cx18/Kconfig
index 9a9f765..c675b83 100644
--- a/drivers/media/pci/cx18/Kconfig
+++ b/drivers/media/pci/cx18/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_CX18
tristate "Conexant cx23418 MPEG encoder support"
-   depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C && EXPERIMENTAL
+   depends on VIDEO_V4L2 && DVB_CORE && PCI && I2C
select I2C_ALGOBIT
select VIDEOBUF_VMALLOC
depends on RC_CORE
@@ -25,7 +25,7 @@ config VIDEO_CX18
 
 config VIDEO_CX18_ALSA
tristate "Conexant 23418 DMA audio support"
-   depends on VIDEO_CX18 && SND && EXPERIMENTAL
+   depends on VIDEO_CX18 && SND
select SND_PCM
---help---
  This is a video4linux driver for direct (DMA) audio on
diff --git a/drivers/media/pci/zoran/Kconfig b/drivers/media/pci/zoran/Kconfig
index a9b2318..26ca870 100644
--- a/drivers/media/pci/zoran/Kconfig
+++ b/drivers/media/pci/zoran/Kconfig
@@ -65,8 +65,8 @@ config VIDEO_ZORAN_LML33R10
  card.
 
 config VIDEO_ZORAN_AVS6EYES
-   tristate "AverMedia 6 Eyes support (EXPERIMENTAL)"
-   depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL
+   tristate "AverMedia 6 Eyes support"
+   depends on VIDEO_ZORAN_ZR36060
select VIDEO_BT856 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_BT866 if MEDIA_SUBDRV_AUTOSELECT
select VIDEO_KS0127 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/tuners/Kconfig b/drivers/media/tuners/Kconfig
index 80238b9..901d886 100644
--- a/drivers/media/tuners/Kconfig
+++ b/drivers/media/tuners/Kconfig
@@ -28,7 +28,7 @@ config MEDIA_TUNER
select MEDIA_TUNER_XC4000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT20XX if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA8290 if MEDIA_SUBDRV_AUTOSELECT
-   select MEDIA_TUNER_TEA5761 if MEDIA_SUBDRV_AUTOSELECT && 
MEDIA_RADIO_SUPPORT && EXPERIMENTAL
+   select MEDIA_TUNER_TEA5761 if MEDIA_SUBDRV_AUTOSELECT && 
MEDIA_RADIO_SUPPORT
select MEDIA_TUNER_TEA5767 if MEDIA_SUBDRV_AUTOSELECT && 
MEDIA_RADIO_SUPPORT
select MEDIA_TUNER_SIMPLE if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA9887 if MEDIA_SUBDRV_AUTOSELECT
@@ -78,9 +78,8 @@ config MEDIA_TUNER_TDA9887
  analog IF demodulator.
 
 config MEDIA_TUNER_TEA5761
-   tristate "TEA 5761 radio tuner (EXPERIMENTAL)"
+   tristate "TEA 5761 radio tuner"
depends on MEDIA_SUPPORT && I2C
-   depends on EXPERIMENTAL
default m if !MEDIA_SUBDRV_AUTOSELECT
help
  Say Y here to include support for the Philips TEA5761 radio tuner.
diff --git a/drivers/media/usb/dvb-usb/Kconfig 
b/drivers/media/usb/dvb-usb/Kconfig
index 3c5fff8..fa0b293 100644
--- a/drivers/media/usb/dvb-usb/Kconfig
+++ b/drivers/media/usb/dvb-usb/Kconfig
@@ -227,7 +227,7 @@ config DVB_USB_OPERA1
 
 config DVB_USB_AF9005
tristate "Afatech AF9005 DVB-T USB1.1 support"
-   depends on DVB_USB && EXPERIMENTAL
+   depends on DVB_USB
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
help
diff --git a/drivers/media/usb/stkwebcam/Kconfig 
b/drivers/media/usb/stkwebcam/Kconfig
index 2fb0c2b..a6a00aa 100644
--- a/drivers/media/usb/stkwebcam/Kconfig
+++ b/drivers/media/usb/stkwebcam/Kconfig
@@ -1,6 +1,6 @@
 config USB_STKWEBCAM
tristate "USB Sy

[RFCv2 API PATCH 17/28] v4l2: make vidioc_s_jpegcomp const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_jpegcomp.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/zoran/zoran_driver.c |4 ++--
 drivers/media/usb/cpia2/cpia2_v4l.c|5 ++---
 drivers/media/usb/gspca/gspca.c|2 +-
 drivers/media/usb/gspca/gspca.h|8 +---
 drivers/media/usb/gspca/jeilinj.c  |2 +-
 drivers/media/usb/gspca/ov519.c|2 +-
 drivers/media/usb/gspca/topro.c|2 +-
 drivers/media/usb/gspca/zc3xx.c|9 ++---
 drivers/media/usb/s2255/s2255drv.c |2 +-
 drivers/media/v4l2-core/v4l2-ioctl.c   |2 ++
 drivers/staging/media/go7007/go7007-v4l2.c |2 +-
 include/media/v4l2-ioctl.h |2 +-
 12 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index f91b551..9ecd7d7 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -2674,7 +2674,7 @@ static int zoran_g_jpegcomp(struct file *file, void *__fh,
 }
 
 static int zoran_s_jpegcomp(struct file *file, void *__fh,
-   struct v4l2_jpegcompression *params)
+   const struct v4l2_jpegcompression 
*params)
 {
struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr;
@@ -2701,7 +2701,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh,
if (!fh->buffers.allocated)
fh->buffers.buffer_size =
zoran_v4l2_calc_bufsize(&fh->jpg_settings);
-   fh->jpg_settings.jpg_comp = *params = settings.jpg_comp;
+   fh->jpg_settings.jpg_comp = settings.jpg_comp;
 sjpegc_unlock_and_return:
mutex_unlock(&zr->resource_lock);
 
diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c 
b/drivers/media/usb/cpia2/cpia2_v4l.c
index 5ca6f44..aeb9d22 100644
--- a/drivers/media/usb/cpia2/cpia2_v4l.c
+++ b/drivers/media/usb/cpia2/cpia2_v4l.c
@@ -734,7 +734,8 @@ static int cpia2_g_jpegcomp(struct file *file, void *fh, 
struct v4l2_jpegcompres
  *
  */
 
-static int cpia2_s_jpegcomp(struct file *file, void *fh, struct 
v4l2_jpegcompression *parms)
+static int cpia2_s_jpegcomp(struct file *file, void *fh,
+   const struct v4l2_jpegcompression *parms)
 {
struct camera_data *cam = video_drvdata(file);
 
@@ -743,8 +744,6 @@ static int cpia2_s_jpegcomp(struct file *file, void *fh, 
struct v4l2_jpegcompres
 
cam->params.compression.inhibit_htables =
!(parms->jpeg_markers & V4L2_JPEG_MARKER_DHT);
-   parms->jpeg_markers &= V4L2_JPEG_MARKER_DQT | V4L2_JPEG_MARKER_DRI |
-  V4L2_JPEG_MARKER_DHT;
 
if(parms->APP_len != 0) {
if(parms->APP_len > 0 &&
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 5d3bcdc..a89de17 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1687,7 +1687,7 @@ static int vidioc_g_jpegcomp(struct file *file, void 
*priv,
 }
 
 static int vidioc_s_jpegcomp(struct file *file, void *priv,
-   struct v4l2_jpegcompression *jpegcomp)
+   const struct v4l2_jpegcompression *jpegcomp)
 {
struct gspca_dev *gspca_dev = video_drvdata(file);
 
diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h
index dc688c7..e3eab82 100644
--- a/drivers/media/usb/gspca/gspca.h
+++ b/drivers/media/usb/gspca/gspca.h
@@ -83,8 +83,10 @@ struct gspca_frame;
 typedef int (*cam_op) (struct gspca_dev *);
 typedef void (*cam_v_op) (struct gspca_dev *);
 typedef int (*cam_cf_op) (struct gspca_dev *, const struct usb_device_id *);
-typedef int (*cam_jpg_op) (struct gspca_dev *,
+typedef int (*cam_get_jpg_op) (struct gspca_dev *,
struct v4l2_jpegcompression *);
+typedef int (*cam_set_jpg_op) (struct gspca_dev *,
+   const struct v4l2_jpegcompression *);
 typedef int (*cam_reg_op) (struct gspca_dev *,
struct v4l2_dbg_register *);
 typedef int (*cam_ident_op) (struct gspca_dev *,
@@ -126,8 +128,8 @@ struct sd_desc {
cam_v_op stopN; /* called on stream off - main alt */
cam_v_op stop0; /* called on stream off & disconnect - alt 0 */
cam_v_op dq_callback;   /* called when a frame has been dequeued */
-   cam_jpg_op get_jcomp;
-   cam_jpg_op set_jcomp;
+   cam_get_jpg_op get_jcomp;
+   cam_set_jpg_op set_jcomp;
cam_qmnu_op querymenu;
cam_streamparm_op get_streamparm;
cam_streamparm_op set_streamparm;
diff --git a/drivers/media/usb/gspca/jeilinj.c 
b/drivers/medi

[RFCv2 API PATCH 19/28] v4l2: make vidioc_(un)subscribe_event const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_(un)subscribe_event.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtv-ioctl.c   |2 +-
 drivers/media/platform/omap3isp/ispccdc.c |4 ++--
 drivers/media/platform/omap3isp/ispstat.c |4 ++--
 drivers/media/platform/omap3isp/ispstat.h |4 ++--
 drivers/media/v4l2-core/v4l2-ctrls.c  |2 +-
 drivers/media/v4l2-core/v4l2-event.c  |4 ++--
 include/media/v4l2-ctrls.h|2 +-
 include/media/v4l2-event.h|4 ++--
 include/media/v4l2-ioctl.h|4 ++--
 9 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index d3b32c2..966abb4 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -1460,7 +1460,7 @@ static int ivtv_overlay(struct file *file, void *fh, 
unsigned int on)
return 0;
 }
 
-static int ivtv_subscribe_event(struct v4l2_fh *fh, struct 
v4l2_event_subscription *sub)
+static int ivtv_subscribe_event(struct v4l2_fh *fh, const struct 
v4l2_event_subscription *sub)
 {
switch (sub->type) {
case V4L2_EVENT_VSYNC:
diff --git a/drivers/media/platform/omap3isp/ispccdc.c 
b/drivers/media/platform/omap3isp/ispccdc.c
index aa9df9d..60181ab 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -1706,7 +1706,7 @@ static long ccdc_ioctl(struct v4l2_subdev *sd, unsigned 
int cmd, void *arg)
 }
 
 static int ccdc_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
-   struct v4l2_event_subscription *sub)
+   const struct v4l2_event_subscription *sub)
 {
if (sub->type != V4L2_EVENT_FRAME_SYNC)
return -EINVAL;
@@ -1719,7 +1719,7 @@ static int ccdc_subscribe_event(struct v4l2_subdev *sd, 
struct v4l2_fh *fh,
 }
 
 static int ccdc_unsubscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
- struct v4l2_event_subscription *sub)
+ const struct v4l2_event_subscription *sub)
 {
return v4l2_event_unsubscribe(fh, sub);
 }
diff --git a/drivers/media/platform/omap3isp/ispstat.c 
b/drivers/media/platform/omap3isp/ispstat.c
index b8640be..d7ac76b 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -1025,7 +1025,7 @@ void omap3isp_stat_dma_isr(struct ispstat *stat)
 
 int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
  struct v4l2_fh *fh,
- struct v4l2_event_subscription *sub)
+ const struct v4l2_event_subscription *sub)
 {
struct ispstat *stat = v4l2_get_subdevdata(subdev);
 
@@ -1037,7 +1037,7 @@ int omap3isp_stat_subscribe_event(struct v4l2_subdev 
*subdev,
 
 int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
struct v4l2_fh *fh,
-   struct v4l2_event_subscription *sub)
+   const struct v4l2_event_subscription *sub)
 {
return v4l2_event_unsubscribe(fh, sub);
 }
diff --git a/drivers/media/platform/omap3isp/ispstat.h 
b/drivers/media/platform/omap3isp/ispstat.h
index 9b7c865..a6fe653 100644
--- a/drivers/media/platform/omap3isp/ispstat.h
+++ b/drivers/media/platform/omap3isp/ispstat.h
@@ -147,10 +147,10 @@ int omap3isp_stat_init(struct ispstat *stat, const char 
*name,
 void omap3isp_stat_cleanup(struct ispstat *stat);
 int omap3isp_stat_subscribe_event(struct v4l2_subdev *subdev,
  struct v4l2_fh *fh,
- struct v4l2_event_subscription *sub);
+ const struct v4l2_event_subscription *sub);
 int omap3isp_stat_unsubscribe_event(struct v4l2_subdev *subdev,
struct v4l2_fh *fh,
-   struct v4l2_event_subscription *sub);
+   const struct v4l2_event_subscription *sub);
 int omap3isp_stat_s_stream(struct v4l2_subdev *subdev, int enable);
 
 int omap3isp_stat_busy(struct ispstat *stat);
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6a2ee7..ac3bfe5 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -2631,7 +2631,7 @@ int v4l2_ctrl_log_status(struct file *file, void *fh)
 EXPORT_SYMBOL(v4l2_ctrl_log_status);
 
 int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
-   struct v4l2_event_subscription *sub)
+   const struct v4l2_event_subscription *sub)
 {
if (sub->type == V4L2_EV

[RFCv2 API PATCH 12/28] v4l2-core: Add new V4L2_CAP_MONOTONIC_TS capability.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Add a new flag that tells userspace that the monotonic clock is used
for timestamps and update the documentation accordingly.

We decided on this new flag during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/io.xml  |   10 +++---
 Documentation/DocBook/media/v4l/vidioc-dqevent.xml  |3 ++-
 Documentation/DocBook/media/v4l/vidioc-querycap.xml |7 +++
 include/linux/videodev2.h   |1 +
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 2dc39d8..b680d66 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -582,10 +582,14 @@ applications when an output stream.
struct timeval
timestamp

-   For input streams this is the
+   This is either the
 system time (as returned by the gettimeofday()
-function) when the first data byte was captured. For output streams
-the data will not be displayed before this time, secondary to the
+function) or a monotonic timestamp (as returned by the
+clock_gettime(CLOCK_MONOTONIC, &ts) function).
+A monotonic timestamp is used if the V4L2_CAP_MONOTONIC_TS
+capability is set, otherwise the system time is used.
+For input streams this is the timestamp when the first data byte was captured.
+For output streams the data will not be displayed before this time, secondary 
to the
 nominal frame rate determined by the current video standard in
 enqueued order. Applications can for example zero this field to
 display frames as soon as possible. The driver stores the time at
diff --git a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml 
b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
index 98a856f..00757d4 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dqevent.xml
@@ -120,7 +120,8 @@
struct timespec
timestamp
 
-   Event timestamp.
+   Event timestamp using the monotonic clock as returned by the
+   clock_gettime(CLOCK_MONOTONIC, &ts) 
function.
  
  
u32
diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml 
b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
index d5b1248..48aa7ac 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
@@ -319,6 +319,13 @@ linkend="async">asynchronous I/O methods.
 linkend="mmap">streaming I/O method.
  
  
+   V4L2_CAP_MONOTONIC_TS
+   0x4000
+   The driver uses a monotonic timestamp instead of wallclock 
time for the
+   &v4l2-buffer; timestamp field.
+   
+ 
+ 
V4L2_CAP_DEVICE_CAPS
0x8000
The driver fills the device_caps
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 47d58ed..00f464d 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -290,6 +290,7 @@ struct v4l2_capability {
 #define V4L2_CAP_ASYNCIO0x0200  /* async I/O */
 #define V4L2_CAP_STREAMING  0x0400  /* streaming I/O ioctls */
 
+#define V4L2_CAP_MONOTONIC_TS   0x4000  /* uses monotonic 
timestamps */
 #define V4L2_CAP_DEVICE_CAPS0x8000  /* sets device 
capabilities field */
 
 /*
-- 
1.7.10.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


[RFCv2 API PATCH 25/28] Set vfl_dir for all display or m2m drivers.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtv-streams.c |3 +++
 drivers/media/pci/zoran/zoran_card.c  |4 
 drivers/media/platform/coda.c |1 +
 drivers/media/platform/davinci/vpbe_display.c |1 +
 drivers/media/platform/davinci/vpif_display.c |1 +
 drivers/media/platform/m2m-deinterlace.c  |1 +
 drivers/media/platform/mem2mem_testdev.c  |1 +
 drivers/media/platform/mx2_emmaprp.c  |1 +
 drivers/media/platform/omap/omap_vout.c   |1 +
 drivers/media/platform/omap3isp/ispvideo.c|1 +
 drivers/media/platform/s5p-fimc/fimc-m2m.c|1 +
 drivers/media/platform/s5p-g2d/g2d.c  |1 +
 drivers/media/platform/s5p-jpeg/jpeg-core.c   |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c  |1 +
 drivers/media/platform/s5p-tv/mixer_video.c   |1 +
 drivers/media/platform/sh_vou.c   |1 +
 drivers/media/usb/uvc/uvc_driver.c|2 ++
 17 files changed, 23 insertions(+)

diff --git a/drivers/media/pci/ivtv/ivtv-streams.c 
b/drivers/media/pci/ivtv/ivtv-streams.c
index f08ec17..1d0e04a 100644
--- a/drivers/media/pci/ivtv/ivtv-streams.c
+++ b/drivers/media/pci/ivtv/ivtv-streams.c
@@ -223,6 +223,9 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
 
s->vdev->num = num;
s->vdev->v4l2_dev = &itv->v4l2_dev;
+   if (ivtv_stream_info[type].buf_type == V4L2_BUF_TYPE_VIDEO_OUTPUT ||
+   ivtv_stream_info[type].buf_type == V4L2_BUF_TYPE_VBI_OUTPUT)
+   s->vdev->vfl_dir = VFL_DIR_TX;
s->vdev->fops = ivtv_stream_info[type].fops;
s->vdev->ctrl_handler = itv->v4l2_dev.ctrl_handler;
s->vdev->release = video_device_release;
diff --git a/drivers/media/pci/zoran/zoran_card.c 
b/drivers/media/pci/zoran/zoran_card.c
index c3602d6..fffc54b 100644
--- a/drivers/media/pci/zoran/zoran_card.c
+++ b/drivers/media/pci/zoran/zoran_card.c
@@ -1055,6 +1055,10 @@ zr36057_init (struct zoran *zr)
memcpy(zr->video_dev, &zoran_template, sizeof(zoran_template));
zr->video_dev->parent = &zr->pci_dev->dev;
strcpy(zr->video_dev->name, ZR_DEVNAME(zr));
+   /* It's not a mem2mem device, but you can both capture and output from
+  one and the same device. This should really be split up into two
+  device nodes, but that's a job for another day. */
+   zr->video_dev->vfl_dir = VFL_DIR_M2M;
err = video_register_device(zr->video_dev, VFL_TYPE_GRABBER, 
video_nr[zr->id]);
if (err < 0)
goto exit_free;
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 6908514..c483a6c 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1641,6 +1641,7 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
dev->vfd.release= video_device_release_empty,
dev->vfd.lock   = &dev->dev_mutex;
dev->vfd.v4l2_dev   = &dev->v4l2_dev;
+   dev->vfd.vfl_dir= VFL_DIR_M2M;
snprintf(dev->vfd.name, sizeof(dev->vfd.name), "%s", CODA_NAME);
video_set_drvdata(&dev->vfd, dev);
 
diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index c7e5fd9..ed30c71 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1634,6 +1634,7 @@ static __devinit int init_vpbe_layer(int i, struct 
vpbe_display *disp_dev,
vbd->minor  = -1;
vbd->v4l2_dev   = &disp_dev->vpbe_dev->v4l2_dev;
vbd->lock   = &vpbe_display_layer->opslock;
+   vbd->vfl_dir= VFL_DIR_TX;
 
if (disp_dev->vpbe_dev->current_timings.timings_type &
VPBE_ENC_STD) {
diff --git a/drivers/media/platform/davinci/vpif_display.c 
b/drivers/media/platform/davinci/vpif_display.c
index 4a24848..ff6e432 100644
--- a/drivers/media/platform/davinci/vpif_display.c
+++ b/drivers/media/platform/davinci/vpif_display.c
@@ -1745,6 +1745,7 @@ static __init int vpif_probe(struct platform_device *pdev)
*vfd = vpif_video_template;
vfd->v4l2_dev = &vpif_obj.v4l2_dev;
vfd->release = video_device_release;
+   vfd->vfl_dir = VFL_DIR_TX;
snprintf(vfd->name, sizeof(vfd->name),
 "VPIF_Display_DRIVER_V%s",
 VPIF_DISPLAY_VERSION);
diff --git a/drivers/media/platform/m2m-deinterlace.c 
b/drivers/media/platform/m2m-deinterlace.c
index a38c152..a534a9c 100644
--- a/drivers/media/platform/m2m-deinterlace.c
+++ b/drivers/media/platform/m2m-deinterlace.c
@@ -982,6 +982,7 @@ static struct video_device deinterlace_videodev = {
.ioctl_ops  = &deinterlace_ioctl_ops,
.minor  = -1,
.release= video_device_release,
+   .vfl_dir= VFL_DIR_M2M,
 };
 
 static struct v4l2_m2m_ops m2m_ops = 

[RFCv2 API PATCH 24/28] v4l2-dev: add new VFL_DIR_ defines.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

These will be used by v4l2-dev.c to improve ioctl checking.
I.e. ioctls for capture should return -ENOTTY when called for
an output device.

Signed-off-by: Hans Verkuil 
---
 include/media/v4l2-dev.h |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 6ee8897..95d1c91 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -26,6 +26,12 @@
 #define VFL_TYPE_SUBDEV3
 #define VFL_TYPE_MAX   4
 
+/* Is this a receiver, transmitter or mem-to-mem? */
+/* Ignored for VFL_TYPE_SUBDEV. */
+#define VFL_DIR_RX 0
+#define VFL_DIR_TX 1
+#define VFL_DIR_M2M2
+
 struct v4l2_ioctl_callbacks;
 struct video_device;
 struct v4l2_device;
@@ -105,7 +111,8 @@ struct video_device
 
/* device info */
char name[32];
-   int vfl_type;
+   int vfl_type;   /* device type */
+   int vfl_dir;/* receiver, transmitter or m2m */
/* 'minor' is set to -1 if the registration failed */
int minor;
u16 num;
-- 
1.7.10.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


[RFCv2 API PATCH 20/28] v4l2: make vidioc_s_audio const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_audio.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/bt8xx/bttv-driver.c |4 ++--
 drivers/media/pci/cx18/cx18-ioctl.c   |2 +-
 drivers/media/pci/cx23885/cx23885-video.c |2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c   |2 +-
 drivers/media/pci/saa7134/saa7134-video.c |4 ++--
 drivers/media/pci/saa7146/mxb.c   |2 +-
 drivers/media/pci/ttpci/av7110_v4l.c  |2 +-
 drivers/media/radio/radio-miropcm20.c |2 +-
 drivers/media/radio/radio-sf16fmi.c   |2 +-
 drivers/media/radio/radio-tea5764.c   |2 +-
 drivers/media/radio/radio-timb.c  |2 +-
 drivers/media/radio/radio-wl1273.c|2 +-
 drivers/media/radio/wl128x/fmdrv_v4l2.c   |2 +-
 drivers/media/usb/au0828/au0828-video.c   |2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c |4 ++--
 drivers/media/usb/em28xx/em28xx-video.c   |4 ++--
 drivers/media/usb/hdpvr/hdpvr-video.c |2 +-
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c  |2 +-
 drivers/media/usb/tlg2300/pd-radio.c  |2 +-
 drivers/media/usb/tlg2300/pd-video.c  |2 +-
 drivers/media/usb/tm6000/tm6000-video.c   |2 +-
 drivers/media/usb/usbvision/usbvision-video.c |2 +-
 include/media/v4l2-ioctl.h|2 +-
 23 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c 
b/drivers/media/pci/bt8xx/bttv-driver.c
index 26bf309..31b2826 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -3076,7 +3076,7 @@ static int bttv_g_audio(struct file *file, void *priv, 
struct v4l2_audio *a)
return 0;
 }
 
-static int bttv_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
+static int bttv_s_audio(struct file *file, void *priv, const struct v4l2_audio 
*a)
 {
if (unlikely(a->index))
return -EINVAL;
@@ -3480,7 +3480,7 @@ static int radio_s_tuner(struct file *file, void *priv,
 }
 
 static int radio_s_audio(struct file *file, void *priv,
-   struct v4l2_audio *a)
+   const struct v4l2_audio *a)
 {
if (unlikely(a->index))
return -EINVAL;
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c 
b/drivers/media/pci/cx18/cx18-ioctl.c
index 51675bc..ffc00ef 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -492,7 +492,7 @@ static int cx18_g_audio(struct file *file, void *fh, struct 
v4l2_audio *vin)
return cx18_get_audio_input(cx, vin->index, vin);
 }
 
-static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
+static int cx18_s_audio(struct file *file, void *fh, const struct v4l2_audio 
*vout)
 {
struct cx18 *cx = fh2id(fh)->cx;
 
diff --git a/drivers/media/pci/cx23885/cx23885-video.c 
b/drivers/media/pci/cx23885/cx23885-video.c
index 22f8e7f..8c4a9a5 100644
--- a/drivers/media/pci/cx23885/cx23885-video.c
+++ b/drivers/media/pci/cx23885/cx23885-video.c
@@ -1426,7 +1426,7 @@ static int vidioc_g_audinput(struct file *file, void 
*priv,
 }
 
 static int vidioc_s_audinput(struct file *file, void *priv,
-   struct v4l2_audio *i)
+   const struct v4l2_audio *i)
 {
struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev;
if (i->index >= 2)
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 966abb4..99e35dd 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -784,7 +784,7 @@ static int ivtv_g_audio(struct file *file, void *fh, struct 
v4l2_audio *vin)
return ivtv_get_audio_input(itv, vin->index, vin);
 }
 
-static int ivtv_s_audio(struct file *file, void *fh, struct v4l2_audio *vout)
+static int ivtv_s_audio(struct file *file, void *fh, const struct v4l2_audio 
*vout)
 {
struct ivtv *itv = fh2id(fh)->itv;
 
diff --git a/drivers/media/pci/saa7134/saa7134-video.c 
b/drivers/media/pci/saa7134/saa7134-video.c
index bac4386..135bfd8 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -2089,7 +2089,7 @@ static int saa7134_g_audio(struct file *file, void *priv, 
struct v4l2_audio *a)
return 0;
 }
 
-static int saa7134_s_audio(struct file *file, void *priv, struct v4l2_audio *a)
+static int saa7134_s_audio(struct file *file, void *priv, const struct 
v4l2_audio *a)
 {
return 0;
 }
@@ -2373,7 +2373,7 @@ static int radio_g_audio(struct file *file, void *priv,
 }
 
 static int radio_s_audio(struct file *file, void *priv,
-   struct v4l2_audio *a)
+   const stru

[RFCv2 API PATCH 16/28] v4l2: make vidioc_s_fbuf const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_fbuf.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/common/saa7146/saa7146_video.c |2 +-
 drivers/media/pci/bt8xx/bttv-driver.c|2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c  |4 ++--
 drivers/media/pci/saa7134/saa7134-video.c|2 +-
 drivers/media/pci/zoran/zoran_driver.c   |2 +-
 drivers/media/platform/fsl-viu.c |2 +-
 drivers/media/platform/omap/omap_vout.c  |2 +-
 include/media/v4l2-ioctl.h   |2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_video.c 
b/drivers/media/common/saa7146/saa7146_video.c
index 6d14785..4143d61 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -479,7 +479,7 @@ static int vidioc_g_fbuf(struct file *file, void *fh, 
struct v4l2_framebuffer *f
return 0;
 }
 
-static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer 
*fb)
+static int vidioc_s_fbuf(struct file *file, void *fh, const struct 
v4l2_framebuffer *fb)
 {
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
struct saa7146_vv *vv = dev->vv_data;
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c 
b/drivers/media/pci/bt8xx/bttv-driver.c
index b58ff87..26bf309 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2740,7 +2740,7 @@ static int bttv_overlay(struct file *file, void *f, 
unsigned int on)
 }
 
 static int bttv_s_fbuf(struct file *file, void *f,
-   struct v4l2_framebuffer *fb)
+   const struct v4l2_framebuffer *fb)
 {
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 32a5910..d3b32c2 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -1427,7 +1427,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, 
struct v4l2_framebuffer *fb)
return 0;
 }
 
-static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer 
*fb)
+static int ivtv_s_fbuf(struct file *file, void *fh, const struct 
v4l2_framebuffer *fb)
 {
struct ivtv_open_id *id = fh2id(fh);
struct ivtv *itv = id->itv;
@@ -1444,7 +1444,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, 
struct v4l2_framebuffer *fb)
itv->osd_chroma_key_state = (fb->flags & V4L2_FBUF_FLAG_CHROMAKEY) != 0;
ivtv_set_osd_alpha(itv);
yi->track_osd = (fb->flags & V4L2_FBUF_FLAG_OVERLAY) != 0;
-   return ivtv_g_fbuf(file, fh, fb);
+   return 0;
 }
 
 static int ivtv_overlay(struct file *file, void *fh, unsigned int on)
diff --git a/drivers/media/pci/saa7134/saa7134-video.c 
b/drivers/media/pci/saa7134/saa7134-video.c
index 6de10b1..bac4386 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -2158,7 +2158,7 @@ static int saa7134_g_fbuf(struct file *file, void *f,
 }
 
 static int saa7134_s_fbuf(struct file *file, void *f,
-   struct v4l2_framebuffer *fb)
+   const struct v4l2_framebuffer *fb)
 {
struct saa7134_fh *fh = f;
struct saa7134_dev *dev = fh->dev;
diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index c6ccdeb..f91b551 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -1978,7 +1978,7 @@ static int zoran_g_fbuf(struct file *file, void *__fh,
 }
 
 static int zoran_s_fbuf(struct file *file, void *__fh,
-   struct v4l2_framebuffer *fb)
+   const struct v4l2_framebuffer *fb)
 {
struct zoran_fh *fh = __fh;
struct zoran *zr = fh->zr;
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 20f9810..897250b 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -860,7 +860,7 @@ int vidioc_g_fbuf(struct file *file, void *priv, struct 
v4l2_framebuffer *arg)
return 0;
 }
 
-int vidioc_s_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
+int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer 
*arg)
 {
struct viu_fh  *fh = priv;
struct viu_dev *dev = fh->dev;
diff --git a/drivers/media/platform/omap/omap_vout.c 
b/drivers/media/platform/omap/omap_vout.c
index 88cf9d9..92845f8 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -1744,7 +1744,7 @@ static int vidioc_streamoff(struct file *file, void *fh, 
enum v4l2_buf_type i)
 }
 
 static int vidioc_s_fbuf(struct file *file, void *f

[RFCv2 API PATCH 10/28] Rename V4L2_(IN|OUT)_CAP_CUSTOM_TIMINGS.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

The 'custom' timings are no longer just for custom timings, but also for 
standard
CEA/VESA timings. So rename to V4L2_IN/OUT_CAP_DV_TIMINGS.

The old define is still kept for backwards compatibility.

This decision was taken during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/vidioc-enuminput.xml|2 +-
 Documentation/DocBook/media/v4l/vidioc-enumoutput.xml   |2 +-
 Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml |2 +-
 drivers/media/v4l2-core/v4l2-ioctl.c|8 
 include/linux/videodev2.h   |6 --
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-enuminput.xml 
b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
index 46d5a04..3c9a813 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enuminput.xml
@@ -283,7 +283,7 @@ input/output interface to linux-media@vger.kernel.org on 19 
Oct 2009.
This input supports setting DV presets by using 
VIDIOC_S_DV_PRESET.
  
  
-   V4L2_IN_CAP_CUSTOM_TIMINGS
+   V4L2_IN_CAP_DV_TIMINGS
0x0002
This input supports setting video timings by using 
VIDIOC_S_DV_TIMINGS.
  
diff --git a/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml 
b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
index 4280200..f4ab079 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enumoutput.xml
@@ -168,7 +168,7 @@ input/output interface to linux-media@vger.kernel.org on 19 
Oct 2009.
This output supports setting DV presets by using 
VIDIOC_S_DV_PRESET.
  
  
-   V4L2_OUT_CAP_CUSTOM_TIMINGS
+   V4L2_OUT_CAP_DV_TIMINGS
0x0002
This output supports setting video timings by using 
VIDIOC_S_DV_TIMINGS.
  
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
index feaa180..7236970 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
@@ -57,7 +57,7 @@ or the timing values are not correct, the driver returns 
&EINVAL;.
 The linux/v4l2-dv-timings.h header can be used to 
get the
 timings of the formats in the  and 
 standards. If the current input or output does not support DV timings (e.g. if
-&VIDIOC-ENUMINPUT; does not set the 
V4L2_IN_CAP_CUSTOM_TIMINGS flag), then
+&VIDIOC-ENUMINPUT; does not set the 
V4L2_IN_CAP_DV_TIMINGS flag), then
 &ENODATA; is returned.
   
 
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 473ebea..99a8ad7 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -982,7 +982,7 @@ static int v4l_enuminput(const struct v4l2_ioctl_ops *ops,
struct v4l2_input *p = arg;
 
/*
-* We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS &
+* We set the flags for CAP_PRESETS, CAP_DV_TIMINGS &
 * CAP_STD here based on ioctl handler provided by the
 * driver. If the driver doesn't support these
 * for a specific input, it must override these flags.
@@ -992,7 +992,7 @@ static int v4l_enuminput(const struct v4l2_ioctl_ops *ops,
if (ops->vidioc_s_dv_preset)
p->capabilities |= V4L2_IN_CAP_PRESETS;
if (ops->vidioc_s_dv_timings)
-   p->capabilities |= V4L2_IN_CAP_CUSTOM_TIMINGS;
+   p->capabilities |= V4L2_IN_CAP_DV_TIMINGS;
 
return ops->vidioc_enum_input(file, fh, p);
 }
@@ -1003,7 +1003,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops 
*ops,
struct v4l2_output *p = arg;
 
/*
-* We set the flags for CAP_PRESETS, CAP_CUSTOM_TIMINGS &
+* We set the flags for CAP_PRESETS, CAP_DV_TIMINGS &
 * CAP_STD here based on ioctl handler provided by the
 * driver. If the driver doesn't support these
 * for a specific output, it must override these flags.
@@ -1013,7 +1013,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops 
*ops,
if (ops->vidioc_s_dv_preset)
p->capabilities |= V4L2_OUT_CAP_PRESETS;
if (ops->vidioc_s_dv_timings)
-   p->capabilities |= V4L2_OUT_CAP_CUSTOM_TIMINGS;
+   p->capabilities |= V4L2_OUT_CAP_DV_TIMINGS;
 
return ops->vidioc_enum_output(file, fh, p);
 }
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index b06342b..47d58ed 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1190,7 +1190,8 @@ struct v4l2_input {
 
 /* capabilities flags */
 #define V4L2_IN_CAP_PRESETS0x0001 /* Supports S_DV_PRESET */
-#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x0002 /* Support

[RFCv2 API PATCH 11/28] DocBook: fix awkward language and fix the documented return value.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

The Video Standard section contains some awkward language. It also wasn't
updated when the error code for unimplemented ioctls changed from EINVAL
to ENOTTY.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/common.xml |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/common.xml 
b/Documentation/DocBook/media/v4l/common.xml
index b91d253..9378d7b 100644
--- a/Documentation/DocBook/media/v4l/common.xml
+++ b/Documentation/DocBook/media/v4l/common.xml
@@ -589,8 +589,8 @@ switch to a standard by &v4l2-std-id;.
 when the device has one or more video inputs or outputs.
 
 Special rules apply to USB cameras where the notion of video
-standards makes little sense. More generally any capture device,
-output devices accordingly, which is 
+standards makes little sense. More generally for any capture or output device
+which is: 

  incapable of capturing fields or frames at the nominal
 rate of the video standard, or
@@ -605,17 +605,17 @@ capture time, or
 refer to the frames received by the driver, not the captured
 frames.

-   Here the driver shall set the
+   the driver shall set the
 std field of &v4l2-input; and &v4l2-output;
-to zero, the VIDIOC_G_STD,
+to zero and the VIDIOC_G_STD,
 VIDIOC_S_STD,
 VIDIOC_QUERYSTD and
 VIDIOC_ENUMSTD ioctls shall return the
-&EINVAL;.
-   See  for a rationale. Probably
-even USB cameras follow some well known video standard. It might have
-been better to explicitly indicate elsewhere if a device cannot live
-up to normal expectations, instead of this exception.
+&ENOTTY;.
+   See  for a rationale.
+   Applications can make use of the  and
+ flags to determine whether the video 
standard ioctls
+are available for the device.

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


[RFCv2 API PATCH 21/28] v4l2: make vidioc_s_audout const.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Write-only ioctls should have a const argument in the ioctl op.

Do this conversion for vidioc_s_audout.

Adding const for write-only ioctls was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/ivtv/ivtv-ioctl.c |6 --
 drivers/media/radio/radio-si4713.c  |2 +-
 include/media/v4l2-ioctl.h  |2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 99e35dd..d5cbb61 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -813,11 +813,13 @@ static int ivtv_g_audout(struct file *file, void *fh, 
struct v4l2_audioout *vin)
return ivtv_get_audio_output(itv, vin->index, vin);
 }
 
-static int ivtv_s_audout(struct file *file, void *fh, struct v4l2_audioout 
*vout)
+static int ivtv_s_audout(struct file *file, void *fh, const struct 
v4l2_audioout *vout)
 {
struct ivtv *itv = fh2id(fh)->itv;
 
-   return ivtv_get_audio_output(itv, vout->index, vout);
+   if (itv->card->video_outputs == NULL || vout->index != 0)
+   return -EINVAL;
+   return 0;
 }
 
 static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input *vin)
diff --git a/drivers/media/radio/radio-si4713.c 
b/drivers/media/radio/radio-si4713.c
index 5f366d1..1e04101 100644
--- a/drivers/media/radio/radio-si4713.c
+++ b/drivers/media/radio/radio-si4713.c
@@ -83,7 +83,7 @@ static int radio_si4713_g_audout(struct file *file, void 
*priv,
 }
 
 static int radio_si4713_s_audout(struct file *file, void *priv,
-   struct v4l2_audioout *vao)
+   const struct v4l2_audioout *vao)
 {
return vao->index ? -EINVAL : 0;
 }
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index babbe09..d4c7729 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -175,7 +175,7 @@ struct v4l2_ioctl_ops {
int (*vidioc_g_audout) (struct file *file, void *fh,
struct v4l2_audioout *a);
int (*vidioc_s_audout) (struct file *file, void *fh,
-   struct v4l2_audioout *a);
+   const struct v4l2_audioout *a);
int (*vidioc_g_modulator)  (struct file *file, void *fh,
struct v4l2_modulator *a);
int (*vidioc_s_modulator)  (struct file *file, void *fh,
-- 
1.7.10.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


[RFCv2 API PATCH 09/28] DocBook: document when to return ENODATA.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

ENODATA should be returned if the API used for getting/changing/querying
the current video timings is not supported by the current input or output.

This was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml|9 ++---
 Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml   |   13 +
 Documentation/DocBook/media/v4l/vidioc-g-std.xml  |   10 +-
 .../DocBook/media/v4l/vidioc-query-dv-preset.xml  |9 +
 .../DocBook/media/v4l/vidioc-query-dv-timings.xml |6 ++
 Documentation/DocBook/media/v4l/vidioc-querystd.xml   |8 
 6 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml
index 61be9fa..b9ea376 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-preset.xml
@@ -78,6 +78,12 @@ If the preset is not supported, it returns an &EINVAL; 


   
   
+   ENODATA
+   
+ Digital video presets are not supported for this input or 
output.
+   
+  
+  
EBUSY

  The device is busy and therefore can not change the 
preset.
@@ -104,7 +110,4 @@ If the preset is not supported, it returns an &EINVAL; 

   
 
   
-  
-&return-value;
-  
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
index eda1a29..feaa180 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-dv-timings.xml
@@ -56,7 +56,9 @@ a pointer to the &v4l2-dv-timings; structure as argument. If 
the ioctl is not su
 or the timing values are not correct, the driver returns &EINVAL;.
 The linux/v4l2-dv-timings.h header can be used to 
get the
 timings of the formats in the  and 
-standards.
+standards. If the current input or output does not support DV timings (e.g. if
+&VIDIOC-ENUMINPUT; does not set the 
V4L2_IN_CAP_CUSTOM_TIMINGS flag), then
+&ENODATA; is returned.
   
 
   
@@ -71,6 +73,12 @@ standards.

   
   
+   ENODATA
+   
+ Digital video timings are not supported for this input or 
output.
+   
+  
+  
EBUSY

  The device is busy and therefore can not change the 
timings.
@@ -320,7 +328,4 @@ detected or used depends on the hardware.
   
 
   
-  
-&return-value;
-  
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-std.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-std.xml
index 99ff1a0..4a89841 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-std.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-std.xml
@@ -72,7 +72,9 @@ flags, being a write-only ioctl it does not return the actual 
new standard as
 the current input does not support the requested standard the driver
 returns an &EINVAL;. When the standard set is ambiguous drivers may
 return EINVAL or choose any of the requested
-standards.
+standards. If the current input or output does not support standard video 
timings (e.g. if
+&VIDIOC-ENUMINPUT; does not set the V4L2_IN_CAP_STD 
flag), then
+&ENODATA; is returned.
   
 
   
@@ -85,6 +87,12 @@ standards.
  The VIDIOC_S_STD parameter was 
unsuitable.

   
+  
+   ENODATA
+   
+ Standard video timings are not supported for this input or 
output.
+   
+  
 
   
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml 
b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml
index 1bc8aeb..68b49d0 100644
--- a/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-preset.xml
@@ -65,5 +65,14 @@ returned.
 
   
 &return-value;
+
+
+  
+   ENODATA
+   
+ Digital video presets are not supported for this input or 
output.
+   
+  
+
   
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml 
b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
index 44935a0..e185f14 100644
--- a/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-query-dv-timings.xml
@@ -78,6 +78,12 @@ capabilities in order to give more precise feedback to the 
user.
 
 
   
+   ENODATA
+   
+ Digital video timings are not supported for this input or 
output.
+   
+  
+  
ENOLINK

  No timings could be detected because no signal was found.
diff --git a/Documentation/DocBook/media/v4l/vidioc-querystd.xml 
b/Documentation/DocBook/media/v4l/vidioc-querystd.xml
index 4b79c7c..fe80a18 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querystd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querystd.xml
@@ -62,5 +62

[RFCv2 API PATCH 07/28] DocBook: deprecate V4L2_BUF_TYPE_PRIVATE.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

As per decision taken during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/compat.xml  |2 +-
 Documentation/DocBook/media/v4l/io.xml  |   14 ++
 Documentation/DocBook/media/v4l/vidioc-cropcap.xml  |6 ++
 Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml |6 ++
 Documentation/DocBook/media/v4l/vidioc-g-crop.xml   |6 ++
 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml|4 +---
 Documentation/DocBook/media/v4l/vidioc-g-parm.xml   |4 +---
 Documentation/DocBook/media/v4l/vidioc-reqbufs.xml  |5 ++---
 8 files changed, 13 insertions(+), 34 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index 578135e..c6ae4c9 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -1476,7 +1476,7 @@ follows.
  
  

V4L2_BUF_TYPE_PRIVATE_BASE
-   V4L2_BUF_TYPE_PRIVATE
+   V4L2_BUF_TYPE_PRIVATE (but this 
is deprecated)
  

  
diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 2512649..2dc39d8 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -685,18 +685,14 @@ memory, set by the application. See  for details.
__u32
reserved2

-   A place holder for future extensions and custom
-(driver defined) buffer types
-V4L2_BUF_TYPE_PRIVATE and higher. Applications
+   A place holder for future extensions. Applications
 should set this to 0.
  
  
__u32
reserved

-   A place holder for future extensions and custom
-(driver defined) buffer types
-V4L2_BUF_TYPE_PRIVATE and higher. Applications
+   A place holder for future extensions. Applications
 should set this to 0.
  

@@ -829,12 +825,6 @@ should set this to 0.
Buffer for video output overlay (OSD), see .
  
- 
-   V4L2_BUF_TYPE_PRIVATE
-   0x80
- This and higher values are reserved for custom
-(driver defined) buffer types.
- 

   
 
diff --git a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml 
b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml
index f1bac2c..4559c45 100644
--- a/Documentation/DocBook/media/v4l/vidioc-cropcap.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-cropcap.xml
@@ -70,10 +70,8 @@ output.
Type of the data stream, set by the application.
 Only these types are valid here:
 V4L2_BUF_TYPE_VIDEO_CAPTURE,
-V4L2_BUF_TYPE_VIDEO_OUTPUT,
-V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver
-defined) types with code V4L2_BUF_TYPE_PRIVATE
-and higher. See .
+V4L2_BUF_TYPE_VIDEO_OUTPUT and
+V4L2_BUF_TYPE_VIDEO_OVERLAY. See .
  
  
struct v4l2_rect
diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
index 0bd3324..f8dfeed 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
@@ -81,10 +81,8 @@ Only these types are valid here:
 V4L2_BUF_TYPE_VIDEO_CAPTURE,
 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
 V4L2_BUF_TYPE_VIDEO_OUTPUT,
-V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
-V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver
-defined) types with code V4L2_BUF_TYPE_PRIVATE
-and higher. See .
+V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE and
+V4L2_BUF_TYPE_VIDEO_OVERLAY. See .
  
  
__u32
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml
index c4ff3b1..75c6a93 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-crop.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-crop.xml
@@ -104,10 +104,8 @@ changed and VIDIOC_S_CROP returns the
type
Type of the data stream, set by the application.
 Only these types are valid here: 
V4L2_BUF_TYPE_VIDEO_CAPTURE,
-V4L2_BUF_TYPE_VIDEO_OUTPUT,
-V4L2_BUF_TYPE_VIDEO_OVERLAY, and custom (driver
-defined) types with code V4L2_BUF_TYPE_PRIVATE
-and higher. See .
+V4L2_BUF_TYPE_VIDEO_OUTPUT and
+V4L2_BUF_TYPE_VIDEO_OVERLAY. See .
  
  
&v4l2-rect;
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index 9ef279a..6b16af95 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -174,9 +174,7 @@ capture and output devices.

__u8
raw_data[200]
-   Place holder for future extensions and custom
-(driver defined) formats with type
-V4L2_BUF_TYPE_PRIVATE and higher.
+   Place holder for future extensions.
  

[RFCv2 API PATCH 04/28] DocBook: make the G/S/TRY_FMT specification more strict.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

- S/TRY_FMT should always succeed, unless an invalid type field is passed in.
- TRY_FMT should give the same result as S_FMT, all other things being equal.
- ENUMFMT may return different formats for different inputs or outputs.

This was decided during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml |3 +++
 Documentation/DocBook/media/v4l/vidioc-g-fmt.xml|9 ++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
index 81ebe48..0bd3324 100644
--- a/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-enum-fmt.xml
@@ -58,6 +58,9 @@ structure. Drivers fill the rest of the structure or return an
 incrementing by one until EINVAL is
 returned.
 
+Note that after switching input or output the list of enumerated 
image
+formats may be different.
+
 
   struct v4l2_fmtdesc
   
diff --git a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml 
b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
index 52acff1..9ef279a 100644
--- a/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-g-fmt.xml
@@ -81,7 +81,7 @@ the application calls the VIDIOC_S_FMT 
ioctl
 with a pointer to a v4l2_format structure
 the driver checks
 and adjusts the parameters against hardware abilities. Drivers
-should not return an error code unless the input is ambiguous, this is
+should not return an error code unless the type 
field is invalid, this is
 a mechanism to fathom device capabilities and to approach parameters
 acceptable for both the application and driver. On success the driver
 may program the hardware, allocate resources and generally prepare for
@@ -107,6 +107,10 @@ disabling I/O or possibly time consuming hardware 
preparations.
 Although strongly recommended drivers are not required to implement
 this ioctl.
 
+The format as returned by VIDIOC_TRY_FMT
+must be identical to what VIDIOC_S_FMT returns for
+the same input or output.
+
 
   struct v4l2_format
   
@@ -187,8 +191,7 @@ capture and output devices.
EINVAL

  The &v4l2-format; type
-field is invalid, the requested buffer type not supported, or the
-format is not supported with this buffer type.
+field is invalia or the requested buffer type not supported.

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


[RFCv2 API PATCH 13/28] Add V4L2_CAP_MONOTONIC_TS where applicable.

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

Add the new V4L2_CAP_MONOTONIC_TS capability to those drivers that
use monotomic timestamps instead of the system time.

Signed-off-by: Hans Verkuil 
---
 drivers/media/pci/cx18/cx18-ioctl.c   |2 +-
 drivers/media/platform/davinci/vpbe_display.c |3 ++-
 drivers/media/platform/omap3isp/ispvideo.c|5 +++--
 drivers/media/platform/s5p-fimc/fimc-lite.c   |2 +-
 drivers/media/usb/gspca/gspca.c   |1 +
 drivers/media/usb/uvc/uvc_v4l2.c  |7 +++
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-ioctl.c 
b/drivers/media/pci/cx18/cx18-ioctl.c
index e9912db..51675bc 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -473,7 +473,7 @@ static int cx18_querycap(struct file *file, void *fh,
 "PCI:%s", pci_name(cx->pci_dev));
vcap->capabilities = cx->v4l2_cap;  /* capabilities */
if (id->type == CX18_ENC_STREAM_TYPE_YUV)
-   vcap->capabilities |= V4L2_CAP_STREAMING;
+   vcap->capabilities |= V4L2_CAP_STREAMING | 
V4L2_CAP_MONOTONIC_TS;
return 0;
 }
 
diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 9a05c81..3a50547 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -620,7 +620,8 @@ static int vpbe_display_querycap(struct file *file, void  
*priv,
struct vpbe_device *vpbe_dev = fh->disp_dev->vpbe_dev;
 
cap->version = VPBE_DISPLAY_VERSION_CODE;
-   cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+   cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING |
+   V4L2_MONOTONIC_TS;
strlcpy(cap->driver, VPBE_DISPLAY_DRIVER, sizeof(cap->driver));
strlcpy(cap->bus_info, "platform", sizeof(cap->bus_info));
strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card));
diff --git a/drivers/media/platform/omap3isp/ispvideo.c 
b/drivers/media/platform/omap3isp/ispvideo.c
index 3a5085e..a25aa1d 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -663,10 +663,11 @@ isp_video_querycap(struct file *file, void *fh, struct 
v4l2_capability *cap)
strlcpy(cap->card, video->video.name, sizeof(cap->card));
strlcpy(cap->bus_info, "media", sizeof(cap->bus_info));
 
+   cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_MONOTONIC_TS;
if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-   cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+   cap->capabilities |= V4L2_CAP_VIDEO_CAPTURE;
else
-   cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
+   cap->capabilities |= V4L2_CAP_VIDEO_OUTPUT;
 
return 0;
 }
diff --git a/drivers/media/platform/s5p-fimc/fimc-lite.c 
b/drivers/media/platform/s5p-fimc/fimc-lite.c
index c5b57e8..ab12928 100644
--- a/drivers/media/platform/s5p-fimc/fimc-lite.c
+++ b/drivers/media/platform/s5p-fimc/fimc-lite.c
@@ -629,7 +629,7 @@ static int fimc_vidioc_querycap_capture(struct file *file, 
void *priv,
strlcpy(cap->driver, FIMC_LITE_DRV_NAME, sizeof(cap->driver));
cap->bus_info[0] = 0;
cap->card[0] = 0;
-   cap->capabilities = V4L2_CAP_STREAMING;
+   cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_MONOTONIC_TS;
return 0;
 }
 
diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index d4e8343..5d3bcdc 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1351,6 +1351,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
usb_make_path(gspca_dev->dev, (char *) cap->bus_info,
sizeof(cap->bus_info));
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE
+ | V4L2_CAP_MONOTONIC_TS
  | V4L2_CAP_STREAMING
  | V4L2_CAP_READWRITE;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index f00db30..1c6dff0 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -564,12 +564,11 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned 
int cmd, void *arg)
usb_make_path(stream->dev->udev,
  cap->bus_info, sizeof(cap->bus_info));
cap->version = LINUX_VERSION_CODE;
+   cap->capabilities = V4L2_CAP_STREAMING | V4L2_CAP_MONOTONIC_TS;
if (stream->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
-   cap->capabilities = V4L2_CAP_VIDEO_CAPTURE
- | V4L2_CAP_STREAMING;
+   cap->capabilities |= V4L2_CAP_VIDEO_CAPTURE;
else
-   

[RFCv2 API PATCH 06/28] v4l2-core: deprecate V4L2_BUF_TYPE_PRIVATE

2012-09-07 Thread Hans Verkuil
From: Hans Verkuil 

This buffer type isn't used at all, and since it is effectively undefined
what it should do it is deprecated. The define still exists, but any
internal support for such buffers is removed.

The decisions to deprecate this was taken during the 2012 Media Workshop.

Signed-off-by: Hans Verkuil 
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c |8 
 drivers/media/v4l2-core/v4l2-dev.c|   12 
 drivers/media/v4l2-core/v4l2-ioctl.c  |   26 +
 include/linux/videodev2.h |1 +
 include/media/v4l2-ioctl.h|8 
 5 files changed, 6 insertions(+), 49 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 9ebd5c5..5d97fd1 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -194,10 +194,6 @@ static int __get_v4l2_format32(struct v4l2_format *kp, 
struct v4l2_format32 __us
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
return get_v4l2_sliced_vbi_format(&kp->fmt.sliced, 
&up->fmt.sliced);
-   case V4L2_BUF_TYPE_PRIVATE:
-   if (copy_from_user(kp, up, sizeof(kp->fmt.raw_data)))
-   return -EFAULT;
-   return 0;
default:
printk(KERN_INFO "compat_ioctl32: unexpected VIDIOC_FMT type 
%d\n",
kp->type);
@@ -240,10 +236,6 @@ static int __put_v4l2_format32(struct v4l2_format *kp, 
struct v4l2_format32 __us
case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
return put_v4l2_sliced_vbi_format(&kp->fmt.sliced, 
&up->fmt.sliced);
-   case V4L2_BUF_TYPE_PRIVATE:
-   if (copy_to_user(up, kp, sizeof(up->fmt.raw_data)))
-   return -EFAULT;
-   return 0;
default:
printk(KERN_INFO "compat_ioctl32: unexpected VIDIOC_FMT type 
%d\n",
kp->type);
diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index 71237f5..95f92ea 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -565,8 +565,7 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
ops->vidioc_enum_fmt_vid_out ||
ops->vidioc_enum_fmt_vid_cap_mplane ||
ops->vidioc_enum_fmt_vid_out_mplane ||
-   ops->vidioc_enum_fmt_vid_overlay ||
-   ops->vidioc_enum_fmt_type_private)
+   ops->vidioc_enum_fmt_vid_overlay)
set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls);
if (ops->vidioc_g_fmt_vid_cap ||
ops->vidioc_g_fmt_vid_out ||
@@ -577,8 +576,7 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
ops->vidioc_g_fmt_vid_out_overlay ||
ops->vidioc_g_fmt_vbi_out ||
ops->vidioc_g_fmt_sliced_vbi_cap ||
-   ops->vidioc_g_fmt_sliced_vbi_out ||
-   ops->vidioc_g_fmt_type_private)
+   ops->vidioc_g_fmt_sliced_vbi_out)
set_bit(_IOC_NR(VIDIOC_G_FMT), valid_ioctls);
if (ops->vidioc_s_fmt_vid_cap ||
ops->vidioc_s_fmt_vid_out ||
@@ -589,8 +587,7 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
ops->vidioc_s_fmt_vid_out_overlay ||
ops->vidioc_s_fmt_vbi_out ||
ops->vidioc_s_fmt_sliced_vbi_cap ||
-   ops->vidioc_s_fmt_sliced_vbi_out ||
-   ops->vidioc_s_fmt_type_private)
+   ops->vidioc_s_fmt_sliced_vbi_out)
set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls);
if (ops->vidioc_try_fmt_vid_cap ||
ops->vidioc_try_fmt_vid_out ||
@@ -601,8 +598,7 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
ops->vidioc_try_fmt_vid_out_overlay ||
ops->vidioc_try_fmt_vbi_out ||
ops->vidioc_try_fmt_sliced_vbi_cap ||
-   ops->vidioc_try_fmt_sliced_vbi_out ||
-   ops->vidioc_try_fmt_type_private)
+   ops->vidioc_try_fmt_sliced_vbi_out)
set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls);
SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs);
SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 6bc47fc..473ebea 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -316,9 +316,6 @@ 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_PRIVATE:
-   pr_cont("\n");
-   

[RFCv2 API PATCH 00/28] Full series of API fixes from the 2012 Media Workshop

2012-09-07 Thread Hans Verkuil
Hi all,

This is the full patch series containing API fixes as discussed during the
2012 Media Workshop.

Regarding the 'make ioctl const' patches: I've only done the easy ones in
this patch series. The remaining write-only ioctls are used much more widely,
so changing those will happen later.

The last few patches that enhance the core code with more stringent tests
against what ioctls can be called for which types of device node will need
reviewing. I have tested it exhaustively with ivtv (which is one of the
most complex drivers, and the only one that has exotic devices like VBI
out).

To use v4l2-compliance with ivtv I also needed to make a few other fixes
elsewhere. The tree with both this patch series and the addition ivtv fixes
can be found here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/ivtv

I have also tested this patch series (actually a slightly older version)
with em28xx. That driver needed a lot of changes to get it to pass the
v4l2-compliance tests. Those can be found here:

http://git.linuxtv.org/hverkuil/media_tree.git/shortlog/refs/heads/em28xx

Comments are welcome.

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


[PATCH] Unregister device and unlock mutex before exit when error

2012-09-07 Thread Peter Senna Tschudin
Signed-off-by: Peter Senna Tschudin 
---
Depends on patch 14167: http://patchwork.linuxtv.org/patch/14167/ 
[PATCH 1/5] drivers/media/platform/davinci/vpbe.c: fix error return code

 drivers/media/platform/davinci/vpbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe.c 
b/drivers/media/platform/davinci/vpbe.c
index 2e4a0da..3057030 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -648,7 +648,7 @@ static int vpbe_initialize(struct device *dev, struct 
vpbe_device *vpbe_dev)
ret = bus_for_each_dev(&platform_bus_type, NULL, vpbe_dev,
   platform_device_get);
if (ret < 0)
-   return ret;
+   goto vpbe_fail_v4l2_device;
 
vpbe_dev->venc = venc_sub_dev_init(&vpbe_dev->v4l2_dev,
   vpbe_dev->cfg->venc.module_name);
-- 
1.7.11.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: go7007 question

2012-09-07 Thread volokh
On Thu, Sep 06, 2012 at 11:10:14PM +0400, Volokh Konstantin wrote:
> On Mon, Sep 03, 2012 at 02:37:16PM -0400, Adam Rosi-Kessel wrote:
> > 
> > [469.928881] wis-saa7115: initializing SAA7115 at address 32 on WIS
> > GO7007SB EZ-USB
> > 
> > [469.989083] go7007: probing for module i2c:wis_saa7115 failed
> > 
> > [470.004785] wis-uda1342: initializing UDA1342 at address 26 on WIS
> > GO7007SB EZ-USB
> > 
> > [470.005454] go7007: probing for module i2c:wis_uda1342 failed
> > 
> > [470.011659] wis-sony-tuner: initializing tuner at address 96 on WIS
> > GO7007SB EZ-USB
Hi, I generated patchs, that u may in your own go7007/ folder
It contains go7007 initialization and i2c_subdev fixing

It was checked for 3.6 branch (compile only)
 
Regards,
Volokh Konstantin
diff --git a/drivers/staging/media/go7007/go7007-driver.c 
b/drivers/staging/media/go7007/go7007-driver.c
index ece2dd1..2dff9b5 100644
--- a/drivers/staging/media/go7007/go7007-driver.c
+++ b/drivers/staging/media/go7007/go7007-driver.c
@@ -173,6 +173,11 @@ static int go7007_init_encoder(struct go7007 *go)
go7007_write_addr(go, 0x3c82, 0x0001);
go7007_write_addr(go, 0x3c80, 0x00fe);
}
+   if (go->board_id == GO7007_BOARDID_ADLINK_MPG24) {
+   /* set GPIO5 to be an output, currently low */
+   go7007_write_addr(go, 0x3c82, 0x);
+   go7007_write_addr(go, 0x3c80, 0x00df);
+   }
return 0;
 }
 
@@ -192,17 +197,23 @@ int go7007_reset_encoder(struct go7007 *go)
 /*
  * Attempt to instantiate an I2C client by ID, probably loading a module.
  */
-static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
-  int addr)
+static int init_i2c_module(struct i2c_adapter *adapter, const struct go_i2c 
*const i2c)
 {
struct go7007 *go = i2c_get_adapdata(adapter);
struct v4l2_device *v4l2_dev = &go->v4l2_dev;
+   struct i2c_board_info info;
+
+   memset(&info, 0, sizeof(info));
+   strlcpy(info.type, i2c->type, sizeof(info.type));
+   info.addr = i2c->addr;
 
-   if (v4l2_i2c_new_subdev(v4l2_dev, adapter, type, addr, NULL))
+   if (i2c->id == I2C_DRIVERID_WIS_TW2804)
+   info.flags |= I2C_CLIENT_TEN;
+   if (v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, NULL))
return 0;
 
-   printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", type);
-   return -1;
+   printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", 
i2c->type);
+   return -EINVAL;
 }
 
 /*
@@ -238,9 +249,7 @@ int go7007_register_encoder(struct go7007 *go)
}
if (go->i2c_adapter_online) {
for (i = 0; i < go->board_info->num_i2c_devs; ++i)
-   init_i2c_module(&go->i2c_adapter,
-   go->board_info->i2c_devs[i].type,
-   go->board_info->i2c_devs[i].addr);
+   init_i2c_module(&go->i2c_adapter, 
&go->board_info->i2c_devs[i]);
if (go->board_id == GO7007_BOARDID_ADLINK_MPG24)
i2c_clients_command(&go->i2c_adapter,
DECODER_SET_CHANNEL, &go->channel_number);
@@ -571,7 +580,7 @@ struct go7007 *go7007_alloc(struct go7007_board_info 
*board, struct device *dev)
struct go7007 *go;
int i;
 
-   go = kmalloc(sizeof(struct go7007), GFP_KERNEL);
+   go = kzalloc(sizeof(struct go7007), GFP_KERNEL);
if (go == NULL)
return NULL;
go->dev = dev;
diff --git a/drivers/staging/media/go7007/go7007-priv.h 
b/drivers/staging/media/go7007/go7007-priv.h
index b58c394..b7b939a 100644
--- a/drivers/staging/media/go7007/go7007-priv.h
+++ b/drivers/staging/media/go7007/go7007-priv.h
@@ -88,7 +88,7 @@ struct go7007_board_info {
int audio_bclk_div;
int audio_main_div;
int num_i2c_devs;
-   struct {
+   struct go_i2c {
const char *type;
int id;
int addr;
diff --git a/drivers/staging/media/go7007/go7007-usb.c 
b/drivers/staging/media/go7007/go7007-usb.c
index 5443e25..9dbf5ec 100644
--- a/drivers/staging/media/go7007/go7007-usb.c
+++ b/drivers/staging/media/go7007/go7007-usb.c
@@ -1110,9 +1110,6 @@ static int go7007_usb_probe(struct usb_interface *intf,
} else {
u16 channel;
 
-   /* set GPIO5 to be an output, currently low */
-   go7007_write_addr(go, 0x3c82, 0x);
-   go7007_write_addr(go, 0x3c80, 0x00df);
/* read channel number from GPIO[1:0] */
go7007_read_addr(go, 0x3c81, &channel);
channel &= 0x3;
@@ -1245,7 +1242,6 @@ static void go7007_usb_disconnect(struct usb_interface 
*intf)
struct urb *vurb, *aurb;
int i;
 

Re: [PATCH] drivers: media: video: Add support for Aptina ar0130 sensor

2012-09-07 Thread Hans Verkuil
Hi Prashanth!

Thanks for working on this driver.

I do have a few comments about this driver, mostly coding style and v4l2 API
related things.

On Fri September 7 2012 11:30:26 Prashanth Subramanya wrote:
> This driver adds basic support for Aptina ar0130 1.2M sensor.
> 
> Signed-off-by: Prashanth Subramanya 
> ---
>  drivers/media/video/Kconfig   |7 +
>  drivers/media/video/Makefile  |1 +
>  drivers/media/video/ar0130.c  | 1114 
> +
>  drivers/media/video/ar0130_regs.h |  107 
>  include/media/ar0130.h|   52 ++
>  include/media/v4l2-chip-ident.h   |1 +
>  6 files changed, 1282 insertions(+)
>  create mode 100644 drivers/media/video/ar0130.c
>  create mode 100644 drivers/media/video/ar0130_regs.h
>  create mode 100644 include/media/ar0130.h
> 
> diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
> index 99937c9..54d7063 100644
> --- a/drivers/media/video/Kconfig
> +++ b/drivers/media/video/Kconfig
> @@ -493,6 +493,13 @@ config VIDEO_VS6624
> To compile this driver as a module, choose M here: the
> module will be called vs6624.
>  
> +config VIDEO_AR0130
> + tristate "Aptina AR0130 support"
> + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
> + ---help---
> + This is a Video4Linux2 sensor-level driver for the Aptina
> + ar0130 1.2 Mpixel camera.
> +
>  config VIDEO_MT9M032
>   tristate "MT9M032 camera sensor support"
>   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
> diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
> index d209de0..a208911 100644
> --- a/drivers/media/video/Makefile
> +++ b/drivers/media/video/Makefile
> @@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
>  obj-$(CONFIG_VIDEO_OV7670)   += ov7670.o
>  obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
>  obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
> +obj-$(CONFIG_VIDEO_AR0130) += ar0130.o
>  obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o
>  obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
>  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
> diff --git a/drivers/media/video/ar0130.c b/drivers/media/video/ar0130.c
> new file mode 100644
> index 000..d257fe8
> --- /dev/null
> +++ b/drivers/media/video/ar0130.c
> @@ -0,0 +1,1114 @@
> +/*
> + * drivers/media/video/ar0130.c
> + *
> + * Aptina AR0130 sensor driver
> + *
> + * Copyright (C) 2012 Aptina Imaging
> + *
> + * Contributor Prashanth Subramanya 
> + *
> + * Based on MT9P031 driver
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
> + *
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "ar0130_regs.h"
> +
> +#define AR0130_ROW_START_MIN 0
> +#define AR0130_ROW_START_MAX 1280
> +#define AR0130_ROW_START_DEF 0
> +#define AR0130_COLUMN_START_MIN  0
> +#define AR0130_COLUMN_START_MAX  960
> +#define AR0130_COLUMN_START_DEF  0
> +#define AR0130_WINDOW_HEIGHT_MIN 360
> +#define AR0130_WINDOW_HEIGHT_MAX 960
> +#define AR0130_WINDOW_HEIGHT_DEF 960
> +#define AR0130_WINDOW_WIDTH_MIN  640
> +#define AR0130_WINDOW_WIDTH_MAX  1280
> +#define AR0130_WINDOW_WIDTH_DEF  1280
> +
> +#define AR0130_VGA_WIDTH 640
> +#define AR0130_VGA_HEIGHT480
> +#define AR0130_ENABLE1
> +#define AR0130_DISABLE   0
> +
> +#define AR0130_CHIP_VERSION_REG  0x3000
> +#define AR0130_CHIP_ID   0x2402
> +#define AR0130_RESET_REG 0x301A
> +#define AR0130_STREAM_ON 0x10DC
> +#define AR0130_STREAM_OFF0x10D8
> +#define AR0130_SEQ_PORT  0x3086
> +#define AR0130_SEQ_PORT_CTRL 0x3088
> +#define AR0130_TEST_REG  0x3070
> +#define AR0130_TEST_PATTERN_DISABLE  0x
> +#define AR0130_TEST_PATTERN_ENABLE   0x0002
> +/*
> +@AR0130_TEST_PATTERN
> +0 = Normal operation. Generate output data from pixel array
> +1 = Solid color test pattern.
> +2 = Full color bar test pattern
> +3 = Fade to grey color bar test pattern
> +256 = Marching 1 test pattern (12 bit)
> +*/
> +
> +#define AR0130_DCDS_PROG_START_ADDR  0x309E
> +#define AR0130_ADC_BITS_6_7  0x30E4
> +#define A

Using MMAP calls on a video capture device having underlying NOMMU arch

2012-09-07 Thread Bhupesh SHARMA
Hi,

I have been trying recently to make a usb-based-webcam device to work with
Linux. The entire scheme is a bit complex:

UVC gadget <--User Pointer--> User-Space Daemon <-- MMAP --> V4L2 capture 
device.

The UVC gadget is internally a v4l2 based device supporting VB2_VMALLOC 
operations,
whereas the V4L2 capture device supports VB2_DMA_CONTIG operations.

The application (user-space daemon), is responsible for getting memory allocated
from the V4L2 capture device via REQBUF calls. The V4L2 capture side exposes a
MMAP IO method, whereas the UVC gadget can get a USERPTR to the buffer filled 
with
video data from the V4L2 capture device and then send the same on a USB bus.

This scheme works absolutely fine on an architecture having a MMU, but when I 
try
the same on a NOMMU arch, I see MMAP calls from the user-space daemon failing.

I have implemented a .get_unmapped_area callback in my V4L2 capture driver using
the blackfin video capture driver as a reference (see [1]).

I make a MMAP call from the user-space application in a sequence like this
(pretty similar to the standard capture.c example, see[2]):

static void init_mmap (void)
{
struct v4l2_requestbuffers req;

CLEAR (req);

req.count   = 4;
req.type= V4L2_BUF_TYPE_VIDEO_CAPTURE;
req.memory  = V4L2_MEMORY_MMAP;

if (-1 == xioctl (fd, VIDIOC_REQBUFS, &req)) 
{
if (EINVAL == errno) 
{
fprintf (stderr, "%s does not support memory 
mapping\n", dev_name);
exit (EXIT_FAILURE);
} 
else 
{
errno_exit ("VIDIOC_REQBUFS");
}
}

if (req.count < 2) 
{
fprintf (stderr, "Insufficient buffer memory on %s\n",dev_name);
exit (EXIT_FAILURE);
}

buffers = (buffer*) calloc (req.count, sizeof (*buffers));

if (!buffers) 
{
fprintf (stderr, "Out of memory\n");
exit (EXIT_FAILURE);
}

for (n_buffers = 0; n_buffers < req.count; ++n_buffers) 
{
struct v4l2_buffer buf;

CLEAR (buf);

buf.type= V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory  = V4L2_MEMORY_MMAP;
buf.index   = n_buffers;

if (-1 == xioctl (fd, VIDIOC_QUERYBUF, &buf))
errno_exit ("VIDIOC_QUERYBUF");

buffers[n_buffers].length = buf.length;
buffers[n_buffers].start =
mmap (NULL /* start anywhere */,
buf.length,
PROT_READ | PROT_WRITE /* required */,
MAP_SHARED /* recommended */,
fd, buf.m.offset);

if (MAP_FAILED == buffers[n_buffers].start)
errno_exit ("mmap");
}
}

Now, I see that the requested videobuffers are correctly allocated via 
'vb2_dma_contig_alloc'
call (see [3] for reference). But the MMAP call fails in 'vb2_dma_contig_alloc' 
function
in mm/nommu.c (see [4] for reference) when it tries to make the following check:

if (addr != (pfn << PAGE_SHIFT))
return -EINVAL;

I address Scott also, as I see that he has worked on the Blackfin v4l2 capture 
driver using
DMA contiguous method and may have seen this issue (on a NOMMU system) with a 
v4l2 application
performing a MMAP operation.

Any comments on what I could be doing wrong here?

References:

[1] Blackfin capture driver, 
http://lxr.linux.no/linux+v3.5.3/drivers/media/video/blackfin/bfin_capture.c#L243
[2] capture.c, http://linuxtv.org/downloads/v4l-dvb-apis/capture-example.html
[3] vb2_dma_contig_alloc, 
http://lxr.linux.no/linux+v3.5.3/drivers/media/video/videobuf2-dma-contig.c#L37
[4] remap_pfn_range, http://lxr.linux.no/linux+v3.5.3/mm/nommu.c#L1819

Regards,
Bhupesh
--
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] drivers: media: video: Add support for Aptina ar0130 sensor

2012-09-07 Thread Prashanth Subramanya
This driver adds basic support for Aptina ar0130 1.2M sensor.

Signed-off-by: Prashanth Subramanya 
---
 drivers/media/video/Kconfig   |7 +
 drivers/media/video/Makefile  |1 +
 drivers/media/video/ar0130.c  | 1114 +
 drivers/media/video/ar0130_regs.h |  107 
 include/media/ar0130.h|   52 ++
 include/media/v4l2-chip-ident.h   |1 +
 6 files changed, 1282 insertions(+)
 create mode 100644 drivers/media/video/ar0130.c
 create mode 100644 drivers/media/video/ar0130_regs.h
 create mode 100644 include/media/ar0130.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 99937c9..54d7063 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -493,6 +493,13 @@ config VIDEO_VS6624
  To compile this driver as a module, choose M here: the
  module will be called vs6624.
 
+config VIDEO_AR0130
+   tristate "Aptina AR0130 support"
+   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+   This is a Video4Linux2 sensor-level driver for the Aptina
+   ar0130 1.2 Mpixel camera.
+
 config VIDEO_MT9M032
tristate "MT9M032 camera sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index d209de0..a208911 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
 obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
 obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
 obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
+obj-$(CONFIG_VIDEO_AR0130) += ar0130.o
 obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o
 obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
 obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
diff --git a/drivers/media/video/ar0130.c b/drivers/media/video/ar0130.c
new file mode 100644
index 000..d257fe8
--- /dev/null
+++ b/drivers/media/video/ar0130.c
@@ -0,0 +1,1114 @@
+/*
+ * drivers/media/video/ar0130.c
+ *
+ * Aptina AR0130 sensor driver
+ *
+ * Copyright (C) 2012 Aptina Imaging
+ *
+ * Contributor Prashanth Subramanya 
+ *
+ * Based on MT9P031 driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ar0130_regs.h"
+
+#define AR0130_ROW_START_MIN   0
+#define AR0130_ROW_START_MAX   1280
+#define AR0130_ROW_START_DEF   0
+#define AR0130_COLUMN_START_MIN0
+#define AR0130_COLUMN_START_MAX960
+#define AR0130_COLUMN_START_DEF0
+#define AR0130_WINDOW_HEIGHT_MIN   360
+#define AR0130_WINDOW_HEIGHT_MAX   960
+#define AR0130_WINDOW_HEIGHT_DEF   960
+#define AR0130_WINDOW_WIDTH_MIN640
+#define AR0130_WINDOW_WIDTH_MAX1280
+#define AR0130_WINDOW_WIDTH_DEF1280
+
+#define AR0130_VGA_WIDTH   640
+#define AR0130_VGA_HEIGHT  480
+#define AR0130_ENABLE  1
+#define AR0130_DISABLE 0
+
+#define AR0130_CHIP_VERSION_REG0x3000
+#define AR0130_CHIP_ID 0x2402
+#define AR0130_RESET_REG   0x301A
+#define AR0130_STREAM_ON   0x10DC
+#define AR0130_STREAM_OFF  0x10D8
+#define AR0130_SEQ_PORT0x3086
+#define AR0130_SEQ_PORT_CTRL   0x3088
+#define AR0130_TEST_REG0x3070
+#define AR0130_TEST_PATTERN_DISABLE0x
+#define AR0130_TEST_PATTERN_ENABLE 0x0002
+/*
+@AR0130_TEST_PATTERN
+0 = Normal operation. Generate output data from pixel array
+1 = Solid color test pattern.
+2 = Full color bar test pattern
+3 = Fade to grey color bar test pattern
+256 = Marching 1 test pattern (12 bit)
+*/
+
+#define AR0130_DCDS_PROG_START_ADDR0x309E
+#define AR0130_ADC_BITS_6_70x30E4
+#define AR0130_ADC_BITS_4_50x30E2
+#define AR0130_ADC_BITS_2_30x30E0
+#define AR0130_ADC_CONFIG1 0x30E6
+#define AR0130_ADC_CONFIG2 0x30E8
+
+#define AR0130_VT_SYS_CLK_DIV  0x302C
+#define AR0130_VT_PIX_CLK_DIV  0x302A
+#define AR0130_PRE_PLL_CLK_DIV 0x302E
+#define AR0130_PLL_MULTIPLIER  0x3030
+#define AR0130_DIGITAL_TEST0x30B0
+
+#define A

[PATCH v2] media: v4l2-ctrls: add control for test pattern

2012-09-07 Thread Prabhakar Lad
From: Lad, Prabhakar 

add V4L2_CID_TEST_PATTERN of type menu, which determines
the internal test pattern selected by the device.

Signed-off-by: Lad, Prabhakar 
Signed-off-by: Manjunath Hadli 
Cc: Sakari Ailus 
Cc: Hans Verkuil 
Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: Sylwester Nawrocki 
Cc: Hans de Goede 
Cc: Kyungmin Park 
Cc: Rob Landley 
---
This patches has one checkpatch warning for line over
80 characters altough it can be avoided I have kept it
for consistency.

Changes for v2:
1: Included display devices in the description for test pattern
   as pointed by Hans.
2: In the menu replaced 'Test Pattern Disabled' by 'Disabled' as
   pointed by Sylwester.
3: Removed the test patterns from menu as the are hardware specific
   as pointed by Sakari.

 Documentation/DocBook/media/v4l/controls.xml |   20 
 drivers/media/v4l2-core/v4l2-ctrls.c |8 
 include/linux/videodev2.h|4 
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index ad873ea..173934e 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4311,6 +4311,26 @@ interface and may change in the future.
  

  
+ 
+   V4L2_CID_TEST_PATTERN
+   menu
+ 
+ 
+The Capture/Display/Sensors have the 
capability
+   to generate internal test patterns and this are hardware specific. 
This
+   test patterns are used to test a device is properly working and can 
generate
+   the desired waveforms that it supports.
+ 
+ 
+   
+ 
+   
+V4L2_TEST_PATTERN_DISABLED
+ Test pattern generation is disabled
+   
+ 
+   
+ 


   
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 8f2f40b..d731422 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -430,6 +430,10 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Advanced",
NULL,
};
+   static const char * const test_pattern[] = {
+   "Disabled",
+   NULL,
+   };
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -509,6 +513,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return jpeg_chroma_subsampling;
case V4L2_CID_DPCM_PREDICTOR:
return dpcm_predictor;
+   case V4L2_CID_TEST_PATTERN:
+   return test_pattern;
 
default:
return NULL;
@@ -740,6 +746,7 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_LINK_FREQ:return "Link Frequency";
case V4L2_CID_PIXEL_RATE:   return "Pixel Rate";
case V4L2_CID_DPCM_PREDICTOR:   return "DPCM Predictor";
+   case V4L2_CID_TEST_PATTERN: return "Test Pattern";
 
default:
return NULL;
@@ -841,6 +848,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_EXPOSURE_METERING:
case V4L2_CID_SCENE_MODE:
case V4L2_CID_DPCM_PREDICTOR:
+   case V4L2_CID_TEST_PATTERN:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ca9fb78..6a2d499 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -2005,6 +2005,10 @@ enum v4l2_dpcm_predictor {
V4L2_DPCM_PREDICTOR_SIMPLE  = 0,
V4L2_DPCM_PREDICTOR_ADVANCED= 1,
 };
+#define V4L2_CID_TEST_PATTERN  (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 4)
+enum v4l2_test_pattern {
+   V4L2_TEST_PATTERN_DISABLED  = 0,
+};
 
 /*
  * T U N I N G
-- 
1.7.0.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