[GIT PULL FOR v3.9] Move cx2341x from media/i2c to media/common

2013-01-29 Thread Hans Verkuil
Hi Mauro,

The cx2341x module is a helper module for conexant-based MPEG encoders.
It isn't an i2c module at all, instead it should be in common since it is
used by 7 pci and usb drivers to handle the MPEG setup.

It also shouldn't be visible in the config menu as it is always
selected automatically by those drivers that need it.

This pull request moves it to the right directory.

Regards,

Hans

The following changes since commit a32f7d1ad3744914273c6907204c2ab3b5d496a0:

  Merge branch 'v4l_for_linus' into staging/for_v3.9 (2013-01-24 18:49:18 -0200)

are available in the git repository at:


  git://linuxtv.org/hverkuil/media_tree.git cx2341x

for you to fetch changes up to 15ee97480694257081933f3f78666de1c88eec5e:

  cx2341x: move from media/i2c to media/common (2013-01-29 09:47:49 +0100)


Hans Verkuil (1):
  cx2341x: move from media/i2c to media/common

 drivers/media/common/Kconfig|1 +
 drivers/media/common/Makefile   |2 +-
 drivers/media/common/cx2341x/Kconfig|2 ++
 drivers/media/common/cx2341x/Makefile   |1 +
 drivers/media/{i2c = common/cx2341x}/cx2341x.c |0
 drivers/media/i2c/Kconfig   |   14 --
 drivers/media/i2c/Makefile  |1 -
 7 files changed, 5 insertions(+), 16 deletions(-)
 create mode 100644 drivers/media/common/cx2341x/Kconfig
 create mode 100644 drivers/media/common/cx2341x/Makefile
 rename drivers/media/{i2c = common/cx2341x}/cx2341x.c (100%)
--
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: [FYI PATCH] Cisco's ths7353 driver...

2013-01-29 Thread Prabhakar Lad
Hi Hans,

On Fri, Jan 25, 2013 at 5:27 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 Hi Prabhakar,

 As mentioned in my review of your ths7353 driver we (Cisco) have a driver
 for this device as well. Below is our driver so you can take the best bits
 of both.

Thanks for sharing the patch.

 However, I wonder if instead the ths7353 driver and the already existing
 ths7303 driver should just be merged. They are awfully similar.

Yes, that would be good idea. It might take some time for me stitch things
since I am busy with other stuff hope you are ok with it.

Regards,
--Prabhakar

 Regards,

 Hans

 From 8db6b9c176ac6d7a7d5328fc96f38e0be0c2e8dc Mon Sep 17 00:00:00 2001
 Message-Id: 
 8db6b9c176ac6d7a7d5328fc96f38e0be0c2e8dc.1359114954.git.hans.verk...@cisco.com
 From: Hans Verkuil hans.verk...@cisco.com
 Date: Fri, 25 Jan 2013 12:55:31 +0100
 Subject: [PATCH] ths7353

 Signed-off-by: Martin Bugge marbu...@cisco.com
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/ths7353.c |  419 
 +++
  include/media/ths7353.h |   31 +++
  include/media/v4l2-chip-ident.h |3 +
  5 files changed, 464 insertions(+)
  create mode 100644 drivers/media/i2c/ths7353.c
  create mode 100644 include/media/ths7353.h

 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 1e4b2d0..a1bbb2f 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -570,6 +570,16 @@ config VIDEO_THS7303
   To compile this driver as a module, choose M here: the
   module will be called ths7303.

 +config VIDEO_THS7353
 +   tristate THS7353 Video Amplifier
 +   depends on I2C
 +   help
 + Support for TI THS7353 video amplifier
 +
 + To compile this driver as a module, choose M here: the
 + module will be called ths7353. This helps tvp7002 to amplify
 + the signals.
 +
  config VIDEO_M52790
 tristate Mitsubishi M52790 A/V switch
 depends on VIDEO_V4L2  I2C
 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
 index b1d62df..9944d06 100644
 --- a/drivers/media/i2c/Makefile
 +++ b/drivers/media/i2c/Makefile
 @@ -34,6 +34,7 @@ obj-$(CONFIG_VIDEO_BT856) += bt856.o
  obj-$(CONFIG_VIDEO_BT866) += bt866.o
  obj-$(CONFIG_VIDEO_KS0127) += ks0127.o
  obj-$(CONFIG_VIDEO_THS7303) += ths7303.o
 +obj-$(CONFIG_VIDEO_THS7353) += ths7353.o
  obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
  obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
  obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o
 diff --git a/drivers/media/i2c/ths7353.c b/drivers/media/i2c/ths7353.c
 new file mode 100644
 index 000..618cfbf
 --- /dev/null
 +++ b/drivers/media/i2c/ths7353.c
 @@ -0,0 +1,419 @@
 +/*
 + * ths7353 - Texas Instruments THS7353 Video Amplifier driver
 + *
 + * Copyright 2013 Cisco Systems, Inc. and/or its affiliates.  All rights 
 reserved.
 + *
 + * This program is free software; you may redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; version 2 of the License.
 + *
 + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 + * SOFTWARE.
 + */
 +
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/ctype.h
 +#include linux/slab.h
 +#include linux/i2c.h
 +#include linux/device.h
 +#include linux/delay.h
 +#include linux/module.h
 +#include linux/uaccess.h
 +#include linux/videodev2.h
 +
 +#include media/v4l2-device.h
 +#include media/v4l2-subdev.h
 +#include media/v4l2-chip-ident.h
 +#include media/ths7353.h
 +
 +MODULE_DESCRIPTION(TI THS7353 video amplifier driver);
 +MODULE_AUTHOR(Martin Bugge marbu...@cisco.com);
 +MODULE_LICENSE(GPL);
 +
 +static int debug;
 +module_param(debug, int, 0644);
 +MODULE_PARM_DESC(debug, Debug level 0-1);
 +
 +struct ths7353_state {
 +   struct v4l2_subdev sd;
 +   struct ths7353_platform_data pdata;
 +   struct v4l2_dv_timings dv_timings;
 +   int stream_on;
 +};
 +
 +/* --- */
 +
 +static inline struct ths7353_state *to_state(struct v4l2_subdev *sd)
 +{
 +   return container_of(sd, struct ths7353_state, sd);
 +}
 +
 +/* --- I2C 
  */
 +
 +static int ths7353_rd(struct v4l2_subdev *sd, u8 reg)
 +{
 +   struct i2c_client *client = v4l2_get_subdevdata(sd);
 +
 +   return 

[GIT PULL FOR v3.9] tuner-core: map audmode to STEREO for radio devices.

2013-01-29 Thread Hans Verkuil
Hi Mauro,

While cleaning up my outstanding git branches I came across this fix.

We discussed this here:

https://patchwork.kernel.org/patch/1457221/

And then I posted an RFCv2:

https://patchwork.kernel.org/patch/1518751/

Unfortunately, I forgot about it and never posted a pull request. So I've
rebased it and I am posting it now. The patch is unchanged from the RFCv2
patch.

Regards,

Hans

The following changes since commit a32f7d1ad3744914273c6907204c2ab3b5d496a0:

  Merge branch 'v4l_for_linus' into staging/for_v3.9 (2013-01-24 18:49:18 -0200)

are available in the git repository at:


  git://linuxtv.org/hverkuil/media_tree.git audmodefix

for you to fetch changes up to d5241f34f323a81c9fe5c23fa2b8436adfe1a716:

  tuner-core: map audmode to STEREO for radio devices. (2013-01-29 10:28:32 
+0100)


Hans Verkuil (1):
  tuner-core: map audmode to STEREO for radio devices.

 drivers/media/v4l2-core/tuner-core.c |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)
--
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


[RFC PATCH] em28xx: fix bytesperline calculation in TRY_FMT

2013-01-29 Thread Hans Verkuil
This was part of my original em28xx patch series. That particular patch
combined two things: this fix and the change where TRY_FMT would no
longer return -EINVAL for unsupported pixelformats. The latter change was
rejected (correctly), but we all forgot about the second part of the patch
which fixed a real bug. I'm reposting just that fix.

Regards,

Hans

The bytesperline calculation was incorrect: it used the old width instead
of the provided width, and it miscalculated the bytesperline value for the
depth == 12 case.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/em28xx/em28xx-video.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 2eabf2a..070506d 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -906,7 +906,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
*priv,
f-fmt.pix.width = width;
f-fmt.pix.height = height;
f-fmt.pix.pixelformat = fmt-fourcc;
-   f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
+   f-fmt.pix.bytesperline = width * ((fmt-depth + 7)  3);
f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
if (dev-progressive)
-- 
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


[RFC PATCH] meye: convert to the control framework

2013-01-29 Thread Hans Verkuil
This patch has been pending for a long time. I finally got around to posting
it. I've rebased it to for_v3.9.

It compiles fine, but since AFAIK nobody has the hardware I cannot test it.

Regards,

Hans


Convert the meye driver to the control framework. Some private controls
have been replaced with standardized controls (SHARPNESS and JPEGQUAL).

The AGC control looks like it can be replaced by the AUTOGAIN control, but
it isn't a boolean so I do not know how to interpret it.

The FRAMERATE control looks like it can be replaced by S_PARM, but again,
without knowing how to interpret it I decided to leave it alone.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/pci/meye/meye.c  |  278 
 drivers/media/pci/meye/meye.h  |2 +
 include/uapi/linux/meye.h  |8 +-
 include/uapi/linux/v4l2-controls.h |5 +
 4 files changed, 99 insertions(+), 194 deletions(-)

diff --git a/drivers/media/pci/meye/meye.c b/drivers/media/pci/meye/meye.c
index 3b39dea..7859c43 100644
--- a/drivers/media/pci/meye/meye.c
+++ b/drivers/media/pci/meye/meye.c
@@ -35,6 +35,8 @@
 #include media/v4l2-common.h
 #include media/v4l2-device.h
 #include media/v4l2-ioctl.h
+#include media/v4l2-fh.h
+#include media/v4l2-event.h
 #include asm/uaccess.h
 #include asm/io.h
 #include linux/delay.h
@@ -865,7 +867,7 @@ static int meye_open(struct file *file)
meye.grab_buffer[i].state = MEYE_BUF_UNUSED;
kfifo_reset(meye.grabq);
kfifo_reset(meye.doneq);
-   return 0;
+   return v4l2_fh_open(file);
 }
 
 static int meye_release(struct file *file)
@@ -873,7 +875,7 @@ static int meye_release(struct file *file)
mchip_hic_stop();
mchip_dma_free();
clear_bit(0, meye.in_use);
-   return 0;
+   return v4l2_fh_release(file);
 }
 
 static int meyeioc_g_params(struct meye_params *p)
@@ -1032,8 +1034,9 @@ static int vidioc_querycap(struct file *file, void *fh,
cap-version = (MEYE_DRIVER_MAJORVERSION  8) +
   MEYE_DRIVER_MINORVERSION;
 
-   cap-capabilities = V4L2_CAP_VIDEO_CAPTURE |
+   cap-device_caps = V4L2_CAP_VIDEO_CAPTURE |
V4L2_CAP_STREAMING;
+   cap-capabilities = cap-device_caps | V4L2_CAP_DEVICE_CAPS;
 
return 0;
 }
@@ -1063,191 +1066,50 @@ static int vidioc_s_input(struct file *file, void *fh, 
unsigned int i)
return 0;
 }
 
-static int vidioc_queryctrl(struct file *file, void *fh,
-   struct v4l2_queryctrl *c)
-{
-   switch (c-id) {
-
-   case V4L2_CID_BRIGHTNESS:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Brightness);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 32;
-   c-flags = 0;
-   break;
-   case V4L2_CID_HUE:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Hue);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 32;
-   c-flags = 0;
-   break;
-   case V4L2_CID_CONTRAST:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Contrast);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 32;
-   c-flags = 0;
-   break;
-   case V4L2_CID_SATURATION:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Saturation);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 32;
-   c-flags = 0;
-   break;
-   case V4L2_CID_AGC:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Agc);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 48;
-   c-flags = 0;
-   break;
-   case V4L2_CID_MEYE_SHARPNESS:
-   case V4L2_CID_SHARPNESS:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Sharpness);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 32;
-
-   /* Continue to report legacy private SHARPNESS ctrl but
-* say it is disabled in preference to ctrl in the spec
-*/
-   c-flags = (c-id == V4L2_CID_SHARPNESS) ? 0 :
-   V4L2_CTRL_FLAG_DISABLED;
-   break;
-   case V4L2_CID_PICTURE:
-   c-type = V4L2_CTRL_TYPE_INTEGER;
-   strcpy(c-name, Picture);
-   c-minimum = 0;
-   c-maximum = 63;
-   c-step = 1;
-   c-default_value = 0;
-   c-flags 

[PATCH 1/5] [media] ttusbir: do not set led twice on resume

2013-01-29 Thread Sean Young
led_classdev_resume already sets the led.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/ttusbir.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index 78be8a9..f9226b8 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -408,9 +408,8 @@ static int ttusbir_resume(struct usb_interface *intf)
struct ttusbir *tt = usb_get_intfdata(intf);
int i, rc;
 
-   led_classdev_resume(tt-led);
tt-is_led_on = true;
-   ttusbir_set_led(tt);
+   led_classdev_resume(tt-led);
 
for (i = 0; i  NUM_URBS; i++) {
rc = usb_submit_urb(tt-urb[i], GFP_KERNEL);
-- 
1.8.1

--
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 4/5] [media] mceusb: make transmit work on HP transceiver

2013-01-29 Thread Sean Young
This transceiver expects the set IR TX ports and IR data as seperate
packets, like the Windows driver does. Remove unnecessary kzalloc.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/mceusb.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 14fea35..bdd1ed8 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -62,7 +62,6 @@
 #define MCE_PACKET_SIZE4/* Normal length of packet 
(without header) */
 #define MCE_IRDATA_HEADER  0x84 /* Actual header format is 0x80 + 
num_bytes */
 #define MCE_IRDATA_TRAILER 0x80 /* End of IR data */
-#define MCE_TX_HEADER_LENGTH   3/* # of bytes in the initializing tx 
header */
 #define MCE_MAX_CHANNELS   2/* Two transmitters, hardware dependent? */
 #define MCE_DEFAULT_TX_MASK0x03 /* Vals: TX1=0x01, TX2=0x02, ALL=0x03 */
 #define MCE_PULSE_BIT  0x80 /* Pulse bit, MSB set == PULSE else SPACE 
*/
@@ -366,7 +365,8 @@ static struct usb_device_id mceusb_dev_table[] = {
/* Formosa Industrial Computing */
{ USB_DEVICE(VENDOR_FORMOSA, 0xe042) },
/* Fintek eHome Infrared Transceiver (HP branded) */
-   { USB_DEVICE(VENDOR_FINTEK, 0x5168) },
+   { USB_DEVICE(VENDOR_FINTEK, 0x5168),
+ .driver_info = MCE_GEN2_TX_INV },
/* Fintek eHome Infrared Transceiver */
{ USB_DEVICE(VENDOR_FINTEK, 0x0602) },
/* Fintek eHome Infrared Transceiver (in the AOpen MP45) */
@@ -789,19 +789,19 @@ static void mce_flush_rx_buffer(struct mceusb_dev *ir, 
int size)
 static int mceusb_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count)
 {
struct mceusb_dev *ir = dev-priv;
-   int i, ret = 0;
+   int i, length, ret = 0;
int cmdcount = 0;
-   unsigned char *cmdbuf; /* MCE command buffer */
-
-   cmdbuf = kzalloc(sizeof(unsigned) * MCE_CMDBUF_SIZE, GFP_KERNEL);
-   if (!cmdbuf)
-   return -ENOMEM;
+   unsigned char cmdbuf[MCE_CMDBUF_SIZE];
 
/* MCE tx init header */
cmdbuf[cmdcount++] = MCE_CMD_PORT_IR;
cmdbuf[cmdcount++] = MCE_CMD_SETIRTXPORTS;
cmdbuf[cmdcount++] = ir-tx_mask;
 
+   /* Send the set TX ports command */
+   mce_async_out(ir, cmdbuf, cmdcount);
+   cmdcount = 0;
+
/* Generate mce packet data */
for (i = 0; (i  count)  (cmdcount  MCE_CMDBUF_SIZE); i++) {
txbuf[i] = txbuf[i] / MCE_TIME_UNIT;
@@ -810,8 +810,7 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned 
*txbuf, unsigned count)
 
/* Insert mce packet header every 4th entry */
if ((cmdcount  MCE_CMDBUF_SIZE) 
-   (cmdcount - MCE_TX_HEADER_LENGTH) %
-MCE_CODE_LENGTH == 0)
+   (cmdcount % MCE_CODE_LENGTH) == 0)
cmdbuf[cmdcount++] = MCE_IRDATA_HEADER;
 
/* Insert mce packet data */
@@ -830,9 +829,8 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned 
*txbuf, unsigned count)
}
 
/* Fix packet length in last header */
-   cmdbuf[cmdcount - (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH] =
-   MCE_COMMAND_IRDATA + (cmdcount - MCE_TX_HEADER_LENGTH) %
-   MCE_CODE_LENGTH - 1;
+   length = cmdcount % MCE_CODE_LENGTH;
+   cmdbuf[cmdcount - length] -= MCE_CODE_LENGTH - length;
 
/* Check if we have room for the empty packet at the end */
if (cmdcount = MCE_CMDBUF_SIZE) {
@@ -847,7 +845,6 @@ static int mceusb_tx_ir(struct rc_dev *dev, unsigned 
*txbuf, unsigned count)
mce_async_out(ir, cmdbuf, cmdcount);
 
 out:
-   kfree(cmdbuf);
return ret ? ret : count;
 }
 
-- 
1.8.1

--
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 3/5] [media] mceusb: make transmit work on the Philips IR transceiver

2013-01-29 Thread Sean Young
The GET_REVISION command puts the device in an unresponsive state,
although it continues to report any IR activity. Note that GET_REVISION
command is not documented, nor is any possible response to it parsed.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/mceusb.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 9afb933..14fea35 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -291,7 +291,8 @@ static struct usb_device_id mceusb_dev_table[] = {
/* Philips/Spinel plus IR transceiver for ASUS */
{ USB_DEVICE(VENDOR_PHILIPS, 0x2088) },
/* Philips IR transceiver (Dell branded) */
-   { USB_DEVICE(VENDOR_PHILIPS, 0x2093) },
+   { USB_DEVICE(VENDOR_PHILIPS, 0x2093),
+ .driver_info = MCE_GEN2_TX_INV },
/* Realtek MCE IR Receiver and card reader */
{ USB_DEVICE(VENDOR_REALTEK, 0x0161),
  .driver_info = MULTIFUNCTION },
@@ -1121,16 +1122,13 @@ static void mceusb_gen1_init(struct mceusb_dev *ir)
mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION));
 
kfree(data);
-};
+}
 
 static void mceusb_gen2_init(struct mceusb_dev *ir)
 {
/* device resume */
mce_async_out(ir, DEVICE_RESUME, sizeof(DEVICE_RESUME));
 
-   /* get hw/sw revision? */
-   mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION));
-
/* get wake version (protocol, key, address) */
mce_async_out(ir, GET_WAKEVERSION, sizeof(GET_WAKEVERSION));
 
-- 
1.8.1

--
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 2/5] [media] ttusbir: add missing endian conversion

2013-01-29 Thread Sean Young
spotted by sparse.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/ttusbir.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index f9226b8..cf0d47f 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -213,19 +213,20 @@ static int ttusbir_probe(struct usb_interface *intf,
 
/* find the correct alt setting */
for (i = 0; i  intf-num_altsetting  altsetting == -1; i++) {
-   int bulk_out_endp = -1, iso_in_endp = -1;
+   int max_packet, bulk_out_endp = -1, iso_in_endp = -1;
 
idesc = intf-altsetting[i].desc;
 
for (j = 0; j  idesc-bNumEndpoints; j++) {
desc = intf-altsetting[i].endpoint[j].desc;
+   max_packet = le16_to_cpu(desc-wMaxPacketSize);
if (usb_endpoint_dir_in(desc) 
usb_endpoint_xfer_isoc(desc) 
-   desc-wMaxPacketSize == 0x10)
+   max_packet == 0x10)
iso_in_endp = j;
else if (usb_endpoint_dir_out(desc) 
usb_endpoint_xfer_bulk(desc) 
-   desc-wMaxPacketSize == 0x20)
+   max_packet == 0x20)
bulk_out_endp = j;
 
if (bulk_out_endp != -1  iso_in_endp != -1) {
-- 
1.8.1

--
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 5/5] [media] redrat3: fix transmit return value and overrun

2013-01-29 Thread Sean Young
If more than 127 different lengths are transmitted then the driver causes
an overrun on sample_lens. Try to send as much as possible and return the
amount sent.

Signed-off-by: Sean Young s...@mess.org
---
 drivers/media/rc/redrat3.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 1800326..1b37fe2 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -195,9 +195,6 @@ struct redrat3_dev {
dma_addr_t dma_in;
dma_addr_t dma_out;
 
-   /* locks this structure */
-   struct mutex lock;
-
/* rx signal timeout timer */
struct timer_list rx_timeout;
u32 hw_timeout;
@@ -922,8 +919,7 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
return -EAGAIN;
}
 
-   if (count  (RR3_DRIVER_MAXLENS * 2))
-   return -EINVAL;
+   count = min_t(unsigned, count, RR3_MAX_SIG_SIZE - RR3_TX_TRAILER_LEN);
 
/* rr3 will disable rc detector on transmit */
rr3-det_enabled = false;
@@ -936,24 +932,22 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, 
unsigned *txbuf,
}
 
for (i = 0; i  count; i++) {
+   cur_sample_len = redrat3_us_to_len(txbuf[i]);
for (lencheck = 0; lencheck  curlencheck; lencheck++) {
-   cur_sample_len = redrat3_us_to_len(txbuf[i]);
if (sample_lens[lencheck] == cur_sample_len)
break;
}
if (lencheck == curlencheck) {
-   cur_sample_len = redrat3_us_to_len(txbuf[i]);
rr3_dbg(dev, txbuf[%d]=%u, pos %d, enc %u\n,
i, txbuf[i], curlencheck, cur_sample_len);
-   if (curlencheck  255) {
+   if (curlencheck  RR3_DRIVER_MAXLENS) {
/* now convert the value to a proper
 * rr3 value.. */
sample_lens[curlencheck] = cur_sample_len;
curlencheck++;
} else {
-   dev_err(dev, signal too long\n);
-   ret = -EINVAL;
-   goto out;
+   count = i - 1;
+   break;
}
}
}
@@ -1087,6 +1081,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct 
redrat3_dev *rr3)
rc-tx_ir = redrat3_transmit_ir;
rc-s_tx_carrier = redrat3_set_tx_carrier;
rc-driver_name = DRIVER_NAME;
+   rc-rx_resolution = US_TO_NS(2);
rc-map_name = RC_MAP_HAUPPAUGE;
 
ret = rc_register_device(rc);
@@ -1202,7 +1197,6 @@ static int redrat3_dev_probe(struct usb_interface *intf,
  rr3-bulk_out_buf, ep_out-wMaxPacketSize,
  (usb_complete_t)redrat3_write_bulk_callback, rr3);
 
-   mutex_init(rr3-lock);
rr3-udev = udev;
 
redrat3_reset(rr3);
-- 
1.8.1

--
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 RFC v2] media: tvp514x: add OF support

2013-01-29 Thread Prabhakar Lad
From: Lad, Prabhakar prabhakar@ti.com

add OF support for the tvp514x driver.

Signed-off-by: Lad, Prabhakar prabhakar@ti.com
Cc: Hans Verkuil hans.verk...@cisco.com
Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Grant Likely grant.lik...@secretlab.ca
Cc: Rob Herring rob.herr...@calxeda.com
Cc: Rob Landley r...@landley.net
Cc: devicetree-disc...@lists.ozlabs.org
Cc: linux-...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
---
 Changes for v2:
  1: Fixed review comment pointed by Heiko.
  2: Fixed review comment pointed by Laurent.

 This patch is on top of following patches:
  1: https://patchwork.kernel.org/patch/1930941/
  2: http://patchwork.linuxtv.org/patch/16193/
  3: https://patchwork.kernel.org/patch/1944901

 .../devicetree/bindings/media/i2c/tvp514x.txt  |   38 +++
 drivers/media/i2c/tvp514x.c|   70 ++--
 2 files changed, 103 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp514x.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/tvp514x.txt 
b/Documentation/devicetree/bindings/media/i2c/tvp514x.txt
new file mode 100644
index 000..55d3ffd
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/tvp514x.txt
@@ -0,0 +1,38 @@
+* Texas Instruments TVP514x video decoder
+
+The TVP5146/TVP5146m2/TVP5147/TVP5147m1 device is high quality, single-chip
+digital video decoder that digitizes and decodes all popular baseband analog
+video formats into digital video component. The tvp514x decoder supports 
analog-
+to-digital (A/D) conversion of component RGB and YPbPr signals as well as A/D
+conversion and decoding of NTSC, PAL and SECAM composite and S-video into
+component YCbCr.
+
+Required Properties :
+- compatible: Must be ti,tvp514x-decoder
+- hsync-active: HSYNC Polarity configuration for current interface.
+- vsync-active: VSYNC Polarity configuration for current interface.
+- data-active: Clock polarity of the current interface.
+
+Example:
+
+i2c0@1c22000 {
+   ...
+   ...
+
+   tvp514x@5c {
+   compatible = ti,tvp514x-decoder;
+   reg = 0x5c;
+
+   port {
+   tvp514x_1: endpoint {
+   /* Active high (Defaults to 0) */
+   hsync-active = 1;
+   /* Active high (Defaults to 0) */
+   hsync-active = 1;
+   /* Active low (Defaults to 0) */
+   data-active = 0;
+   };
+   };
+   };
+   ...
+};
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index a4f0a70..24ce759 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -12,6 +12,7 @@
  * Hardik Shah hardik.s...@ti.com
  * Manjunath Hadli m...@ti.com
  * Karicheri Muralidharan m-kariche...@ti.com
+ * Prabhakar Lad prabhakar@ti.com
  *
  * This package is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -33,7 +34,9 @@
 #include linux/delay.h
 #include linux/videodev2.h
 #include linux/module.h
+#include linux/of_device.h
 
+#include media/v4l2-of.h
 #include media/v4l2-async.h
 #include media/v4l2-device.h
 #include media/v4l2-common.h
@@ -930,6 +933,58 @@ static struct tvp514x_decoder tvp514x_dev = {
 
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id tvp514x_of_match[] = {
+   {.compatible = ti,tvp514x-decoder, },
+   {},
+};
+MODULE_DEVICE_TABLE(of, tvp514x_of_match);
+
+static struct tvp514x_platform_data
+   *tvp514x_get_pdata(struct i2c_client *client)
+{
+   if (!client-dev.platform_data  client-dev.of_node) {
+   struct tvp514x_platform_data *pdata;
+   struct v4l2_of_endpoint bus_cfg;
+   struct device_node *endpoint;
+
+   pdata = devm_kzalloc(client-dev,
+   sizeof(struct tvp514x_platform_data),
+   GFP_KERNEL);
+   client-dev.platform_data = pdata;
+   if (!pdata)
+   return NULL;
+
+   endpoint = of_get_child_by_name(client-dev.of_node, port);
+   if (endpoint)
+   endpoint = of_get_child_by_name(endpoint, endpoint);
+
+   if (!endpoint) {
+   v4l2_info(client, Using default data!!\n);
+   } else {
+   v4l2_of_parse_parallel_bus(endpoint, bus_cfg);
+
+   if (bus_cfg.mbus_flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
+   pdata-hs_polarity = 1;
+   if (bus_cfg.mbus_flags  

Re: [RFC PATCH] em28xx: fix bytesperline calculation in TRY_FMT

2013-01-29 Thread Devin Heitmueller
On Tue, Jan 29, 2013 at 4:49 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 This was part of my original em28xx patch series. That particular patch
 combined two things: this fix and the change where TRY_FMT would no
 longer return -EINVAL for unsupported pixelformats. The latter change was
 rejected (correctly), but we all forgot about the second part of the patch
 which fixed a real bug. I'm reposting just that fix.

 Regards,

 Hans

 The bytesperline calculation was incorrect: it used the old width instead
 of the provided width, and it miscalculated the bytesperline value for the
 depth == 12 case.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/usb/em28xx/em28xx-video.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
 b/drivers/media/usb/em28xx/em28xx-video.c
 index 2eabf2a..070506d 100644
 --- a/drivers/media/usb/em28xx/em28xx-video.c
 +++ b/drivers/media/usb/em28xx/em28xx-video.c
 @@ -906,7 +906,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
 *priv,
 f-fmt.pix.width = width;
 f-fmt.pix.height = height;
 f-fmt.pix.pixelformat = fmt-fourcc;
 -   f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
 +   f-fmt.pix.bytesperline = width * ((fmt-depth + 7)  3);
 f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
 f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 if (dev-progressive)

Reviewed-by: Devin Heitmueller dheitmuel...@kernellabs.com

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


Re: Bug report - em28xx

2013-01-29 Thread Hans Verkuil
On Tue January 29 2013 15:18:12 Olivier Subilia wrote:
 Hi,
 
 First of all, I've no experience with this mailing list. I'm not sure 
 I'm sending my report to the right place. If not, please don't hesitate 
 to tell it to me (possibly with the right place address).
 
 I'm desperately trying to compile v4l drivers for a PCTV quatrostick 
 nano. Following this page
 
 http://www.linuxtv.org/wiki/index.php/PCTVSystems_QuatroStick-nano_520e
 
 it uses the em28xx driver.
 
 my configuration: `uname -r` = 3.2.0-35-generic-pae
 
 So I tried to compile it with
 
 $ git clone git://linuxtv.org/media_build.git
 $ cd media_built
 $ ./build log.log (file attached)
 
 STDERR:
 
 Cloning into 'media_build'...
 remote: Counting objects: 1813, done.
 remote: Compressing objects: 100% (591/591), done.
 remote: Total 1813 (delta 1223), reused 1751 (delta 1183)
 Receiving objects: 100% (1813/1813), 423.66 KiB, done.
 Resolving deltas: 100% (1223/1223), done.
 multimedia@serveur:~$ cd media_build/
 multimedia@serveur:~/media_build$ ./build log.log
  From git://linuxtv.org/media_build
   * branchmaster - FETCH_HEAD
 --2013-01-29 14:52:49-- 
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 93 [application/x-bzip2]
 Saving to: `linux-media.tar.bz2.md5.tmp'
 
 100%[=]
  
 93  --.-K/s   in 0s
 
 2013-01-29 14:52:49 (7.72 MB/s) - `linux-media.tar.bz2.md5.tmp' saved 
 [93/93]
 
 cat: linux-media.tar.bz2.md5: No such file or directory
 --2013-01-29 14:52:49-- 
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 4502249 (4.3M) [application/x-bzip2]
 Saving to: `linux-media.tar.bz2'
 
 100%[=]
  
 4'502'249   5.47M/s   in 0.8s
 
 2013-01-29 14:52:50 (5.47 MB/s) - `linux-media.tar.bz2' saved 
 [4502249/4502249]
 
 --2013-01-29 14:52:51-- 
 http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
 Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
 Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80... 
 connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 649441 (634K) [application/x-bzip2]
 Saving to: `dvb-firmwares.tar.bz2'
 
 100%[=]
  
 649'441 1.41M/s   in 0.4s
 
 2013-01-29 14:52:51 (1.41 MB/s) - `dvb-firmwares.tar.bz2' saved 
 [649441/649441]
 
 
 ln: accessing `../../linux/firmware/dabusb//*': No such file or directory
 /home/multimedia/media_build/v4l/anysee.c: In function 
 'anysee_frontend_attach':
 /home/multimedia/media_build/v4l/anysee.c:893:2: warning: 'ret' may be 
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c: In function 'm920x_probe':
 /home/multimedia/media_build/v4l/m920x.c:91:6: warning: 'ret' may be 
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c:70:6: note: 'ret' was declared here
 /home/multimedia/media_build/v4l/mxl111sf.c:58:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 /home/multimedia/media_build/v4l/ngene-cards.c:813:2: warning: 
 initialization discards 'const' qualifier from pointer target type 
 [enabled by default]
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 WARNING: snd_tea575x_set_freq 
 [/home/multimedia/media_build/v4l/radio-shark.ko] undefined!
 WARNING: modpost: Found 1 section mismatch(es).
 To see full details build your kernel with:
 'make CONFIG_DEBUG_SECTION_MISMATCH=y'
 
 
 No other compilation error. 524 modules founds. But if I check em28xx 
 family modules:
 
 $ ls v4l/em28xx*.ko
 ls: cannot access v4l/em28xx*.ko: No such file or directory
 
 In other words: no module is compiled with this.
 All (most ?) other modules are compiled in v4l/*.ko
 
 What am I doing wrong ?

Nothing :-)

I can reproduce this myself. It works fine for all kernels except 3.2 and 3.3.
One workaround is to run 'make 

Re: Bug report - em28xx

2013-01-29 Thread Olivier Subilia

Thanks for help.

I must confess there are so many entries in menuconfig I can't find 
where enabling em28xx is hidden (20 minutes searching in vain :-( . 
Could you please help me ?


Le 29/01/2013 15:59, Hans Verkuil a écrit :

On Tue January 29 2013 15:18:12 Olivier Subilia wrote:

Hi,

First of all, I've no experience with this mailing list. I'm not sure
I'm sending my report to the right place. If not, please don't hesitate
to tell it to me (possibly with the right place address).

I'm desperately trying to compile v4l drivers for a PCTV quatrostick
nano. Following this page

http://www.linuxtv.org/wiki/index.php/PCTVSystems_QuatroStick-nano_520e

it uses the em28xx driver.

my configuration: `uname -r` = 3.2.0-35-generic-pae

So I tried to compile it with

$ git clone git://linuxtv.org/media_build.git
$ cd media_built
$ ./build log.log (file attached)

STDERR:

Cloning into 'media_build'...
remote: Counting objects: 1813, done.
remote: Compressing objects: 100% (591/591), done.
remote: Total 1813 (delta 1223), reused 1751 (delta 1183)
Receiving objects: 100% (1813/1813), 423.66 KiB, done.
Resolving deltas: 100% (1223/1223), done.
multimedia@serveur:~$ cd media_build/
multimedia@serveur:~/media_build$ ./build log.log
  From git://linuxtv.org/media_build
   * branchmaster - FETCH_HEAD
--2013-01-29 14:52:49--
http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 93 [application/x-bzip2]
Saving to: `linux-media.tar.bz2.md5.tmp'

100%[=]
93  --.-K/s   in 0s

2013-01-29 14:52:49 (7.72 MB/s) - `linux-media.tar.bz2.md5.tmp' saved
[93/93]

cat: linux-media.tar.bz2.md5: No such file or directory
--2013-01-29 14:52:49--
http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4502249 (4.3M) [application/x-bzip2]
Saving to: `linux-media.tar.bz2'

100%[=]
4'502'249   5.47M/s   in 0.8s

2013-01-29 14:52:50 (5.47 MB/s) - `linux-media.tar.bz2' saved
[4502249/4502249]

--2013-01-29 14:52:51--
http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80...
connected.
HTTP request sent, awaiting response... 200 OK
Length: 649441 (634K) [application/x-bzip2]
Saving to: `dvb-firmwares.tar.bz2'

100%[=]
649'441 1.41M/s   in 0.4s

2013-01-29 14:52:51 (1.41 MB/s) - `dvb-firmwares.tar.bz2' saved
[649441/649441]


ln: accessing `../../linux/firmware/dabusb//*': No such file or directory
/home/multimedia/media_build/v4l/anysee.c: In function
'anysee_frontend_attach':
/home/multimedia/media_build/v4l/anysee.c:893:2: warning: 'ret' may be
used uninitialized in this function [-Wuninitialized]
/home/multimedia/media_build/v4l/m920x.c: In function 'm920x_probe':
/home/multimedia/media_build/v4l/m920x.c:91:6: warning: 'ret' may be
used uninitialized in this function [-Wuninitialized]
/home/multimedia/media_build/v4l/m920x.c:70:6: note: 'ret' was declared here
/home/multimedia/media_build/v4l/mxl111sf.c:58:0: warning: err
redefined [enabled by default]
include/linux/usb.h:1655:0: note: this is the location of the previous
definition
/home/multimedia/media_build/v4l/ngene-cards.c:813:2: warning:
initialization discards 'const' qualifier from pointer target type
[enabled by default]
/home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err
redefined [enabled by default]
include/linux/usb.h:1655:0: note: this is the location of the previous
definition
/home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err
redefined [enabled by default]
include/linux/usb.h:1655:0: note: this is the location of the previous
definition
WARNING: snd_tea575x_set_freq
[/home/multimedia/media_build/v4l/radio-shark.ko] undefined!
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'


No other compilation error. 524 modules founds. But if I check em28xx
family modules:

$ ls v4l/em28xx*.ko
ls: cannot access v4l/em28xx*.ko: No such file or directory

In other words: no module is compiled with this.
All (most ?) other modules are compiled in v4l/*.ko

What am I doing wrong ?

Nothing :-)

I can reproduce this myself. It works 

[PULL] video_visstrim ov7670_for_v3.9.

2013-01-29 Thread Javier Martin
Hi Mauro,
this is the pull request I sent to you two months ago.

I've applied the patches on your 'for_v3.9' branch and
everything is still working fine.

Furthermore, I've added the SoB line. I hope everything
is OK this time. If not please let me know.


The following changes since commit 8672c8509e1155a3bc712060bd948ba98a1f283a:

  [media] coda: Fix build due to iram.h rename. (2013-01-29 11:06:53 +0100)

are available in the git repository at:

  https://github.com/jmartinc/video_visstrim.git ov7670_for_v3.9

for you to fetch changes up to 2dc110e020327ad5bbf4cfb2e6717b4d2914d096:

  ov7670: remove legacy ctrl callbacks. (2013-01-29 12:21:40 +0100)


Javier Martin (9):
  media: ov7670: add support for ov7675.
  media: ov7670: make try_fmt() consistent with 'min_height' and 
'min_width'.
  media: ov7670: calculate framerate properly for ov7675.
  media: ov7670: add possibility to bypass pll for ov7675.
  media: ov7670: Add possibility to disable pixclk during hblank.
  ov7670: use the control framework.
  mcam-core: implement the control framework.
  via-camera: implement the control framework.
  ov7670: remove legacy ctrl callbacks.

 drivers/media/i2c/ov7670.c  |  587 +--
 drivers/media/platform/marvell-ccic/mcam-core.c |   54 +--
 drivers/media/platform/marvell-ccic/mcam-core.h |2 +
 drivers/media/platform/via-camera.c |   60 +--
 include/media/ov7670.h  |2 +
 5 files changed, 369 insertions(+), 336 deletions(-)
--
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: Bug report - em28xx

2013-01-29 Thread Olivier Subilia

...

Found !

(I had to activate other entries to make em28xx appear).

Now the compile process is ok.

I have to wait this evening at home to check if the module is OK.

Thank you very much for helping


--
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: Bug report - em28xx

2013-01-29 Thread Gianluca Gennari
Il 29/01/2013 15:59, Hans Verkuil ha scritto:
 On Tue January 29 2013 15:18:12 Olivier Subilia wrote:
 Hi,

 First of all, I've no experience with this mailing list. I'm not sure 
 I'm sending my report to the right place. If not, please don't hesitate 
 to tell it to me (possibly with the right place address).

 I'm desperately trying to compile v4l drivers for a PCTV quatrostick 
 nano. Following this page

 http://www.linuxtv.org/wiki/index.php/PCTVSystems_QuatroStick-nano_520e

 it uses the em28xx driver.

 my configuration: `uname -r` = 3.2.0-35-generic-pae

 So I tried to compile it with

 $ git clone git://linuxtv.org/media_build.git
 $ cd media_built
 $ ./build log.log (file attached)

 STDERR:

 Cloning into 'media_build'...
 remote: Counting objects: 1813, done.
 remote: Compressing objects: 100% (591/591), done.
 remote: Total 1813 (delta 1223), reused 1751 (delta 1183)
 Receiving objects: 100% (1813/1813), 423.66 KiB, done.
 Resolving deltas: 100% (1223/1223), done.
 multimedia@serveur:~$ cd media_build/
 multimedia@serveur:~/media_build$ ./build log.log
  From git://linuxtv.org/media_build
   * branchmaster - FETCH_HEAD
 --2013-01-29 14:52:49-- 
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 93 [application/x-bzip2]
 Saving to: `linux-media.tar.bz2.md5.tmp'

 100%[=]
  
 93  --.-K/s   in 0s

 2013-01-29 14:52:49 (7.72 MB/s) - `linux-media.tar.bz2.md5.tmp' saved 
 [93/93]

 cat: linux-media.tar.bz2.md5: No such file or directory
 --2013-01-29 14:52:49-- 
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 4502249 (4.3M) [application/x-bzip2]
 Saving to: `linux-media.tar.bz2'

 100%[=]
  
 4'502'249   5.47M/s   in 0.8s

 2013-01-29 14:52:50 (5.47 MB/s) - `linux-media.tar.bz2' saved 
 [4502249/4502249]

 --2013-01-29 14:52:51-- 
 http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
 Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
 Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80... 
 connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 649441 (634K) [application/x-bzip2]
 Saving to: `dvb-firmwares.tar.bz2'

 100%[=]
  
 649'441 1.41M/s   in 0.4s

 2013-01-29 14:52:51 (1.41 MB/s) - `dvb-firmwares.tar.bz2' saved 
 [649441/649441]


 ln: accessing `../../linux/firmware/dabusb//*': No such file or directory
 /home/multimedia/media_build/v4l/anysee.c: In function 
 'anysee_frontend_attach':
 /home/multimedia/media_build/v4l/anysee.c:893:2: warning: 'ret' may be 
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c: In function 'm920x_probe':
 /home/multimedia/media_build/v4l/m920x.c:91:6: warning: 'ret' may be 
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c:70:6: note: 'ret' was declared here
 /home/multimedia/media_build/v4l/mxl111sf.c:58:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 /home/multimedia/media_build/v4l/ngene-cards.c:813:2: warning: 
 initialization discards 'const' qualifier from pointer target type 
 [enabled by default]
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous 
 definition
 WARNING: snd_tea575x_set_freq 
 [/home/multimedia/media_build/v4l/radio-shark.ko] undefined!
 WARNING: modpost: Found 1 section mismatch(es).
 To see full details build your kernel with:
 'make CONFIG_DEBUG_SECTION_MISMATCH=y'


 No other compilation error. 524 modules founds. But if I check em28xx 
 family modules:

 $ ls v4l/em28xx*.ko
 ls: cannot access v4l/em28xx*.ko: No such file or directory

 In other words: no module is compiled with this.
 All (most ?) other modules are compiled in v4l/*.ko

 What am I doing wrong ?
 
 Nothing :-)
 
 I can reproduce this myself. It works fine for all kernels except 3.2 and 3.3.
 One 

Re: Bug report - em28xx

2013-01-29 Thread Gianluca Gennari
Il 29/01/2013 16:30, Olivier Subilia ha scritto:
 Thanks for help.
 
 I must confess there are so many entries in menuconfig I can't find
 where enabling em28xx is hidden (20 minutes searching in vain :-( .
 Could you please help me ?
 

You can use 'make xconfig' and the Find command (ctrl-F) ;-)

Regards,
Gianluca

 Le 29/01/2013 15:59, Hans Verkuil a �crit :
 On Tue January 29 2013 15:18:12 Olivier Subilia wrote:
 Hi,

 First of all, I've no experience with this mailing list. I'm not sure
 I'm sending my report to the right place. If not, please don't hesitate
 to tell it to me (possibly with the right place address).

 I'm desperately trying to compile v4l drivers for a PCTV quatrostick
 nano. Following this page

 http://www.linuxtv.org/wiki/index.php/PCTVSystems_QuatroStick-nano_520e

 it uses the em28xx driver.

 my configuration: `uname -r` = 3.2.0-35-generic-pae

 So I tried to compile it with

 $ git clone git://linuxtv.org/media_build.git
 $ cd media_built
 $ ./build log.log (file attached)

 STDERR:

 Cloning into 'media_build'...
 remote: Counting objects: 1813, done.
 remote: Compressing objects: 100% (591/591), done.
 remote: Total 1813 (delta 1223), reused 1751 (delta 1183)
 Receiving objects: 100% (1813/1813), 423.66 KiB, done.
 Resolving deltas: 100% (1223/1223), done.
 multimedia@serveur:~$ cd media_build/
 multimedia@serveur:~/media_build$ ./build log.log
   From git://linuxtv.org/media_build
* branchmaster - FETCH_HEAD
 --2013-01-29 14:52:49--
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 93 [application/x-bzip2]
 Saving to: `linux-media.tar.bz2.md5.tmp'

 100%[=]

 93  --.-K/s   in 0s

 2013-01-29 14:52:49 (7.72 MB/s) - `linux-media.tar.bz2.md5.tmp' saved
 [93/93]

 cat: linux-media.tar.bz2.md5: No such file or directory
 --2013-01-29 14:52:49--
 http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
 Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
 Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 4502249 (4.3M) [application/x-bzip2]
 Saving to: `linux-media.tar.bz2'

 100%[=]

 4'502'249   5.47M/s   in 0.8s

 2013-01-29 14:52:50 (5.47 MB/s) - `linux-media.tar.bz2' saved
 [4502249/4502249]

 --2013-01-29 14:52:51--
 http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
 Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
 Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80...
 connected.
 HTTP request sent, awaiting response... 200 OK
 Length: 649441 (634K) [application/x-bzip2]
 Saving to: `dvb-firmwares.tar.bz2'

 100%[=]

 649'441 1.41M/s   in 0.4s

 2013-01-29 14:52:51 (1.41 MB/s) - `dvb-firmwares.tar.bz2' saved
 [649441/649441]


 ln: accessing `../../linux/firmware/dabusb//*': No such file or
 directory
 /home/multimedia/media_build/v4l/anysee.c: In function
 'anysee_frontend_attach':
 /home/multimedia/media_build/v4l/anysee.c:893:2: warning: 'ret' may be
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c: In function 'm920x_probe':
 /home/multimedia/media_build/v4l/m920x.c:91:6: warning: 'ret' may be
 used uninitialized in this function [-Wuninitialized]
 /home/multimedia/media_build/v4l/m920x.c:70:6: note: 'ret' was
 declared here
 /home/multimedia/media_build/v4l/mxl111sf.c:58:0: warning: err
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous
 definition
 /home/multimedia/media_build/v4l/ngene-cards.c:813:2: warning:
 initialization discards 'const' qualifier from pointer target type
 [enabled by default]
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous
 definition
 /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err
 redefined [enabled by default]
 include/linux/usb.h:1655:0: note: this is the location of the previous
 definition
 WARNING: snd_tea575x_set_freq
 [/home/multimedia/media_build/v4l/radio-shark.ko] undefined!
 WARNING: modpost: Found 1 section mismatch(es).
 To see full details build your kernel with:
 'make CONFIG_DEBUG_SECTION_MISMATCH=y'


 No other compilation error. 524 modules founds. But if I check em28xx
 family modules:

 $ ls v4l/em28xx*.ko
 ls: 

Re: Bug report - em28xx

2013-01-29 Thread Olivier Subilia

Thanks to Hans and grazie mille a Gianluca for their hints.
--
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


[RFCv1 PATCH 02/20] cx231xx: add required VIDIOC_DBG_G_CHIP_IDENT support.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This fixes a v4l2_compliance failure.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   13 +
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 7324624..44bc687 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1456,6 +1456,18 @@ static int vidioc_s_frequency(struct file *file, void 
*priv,
return rc;
 }
 
+static int vidioc_g_chip_ident(struct file *file, void *fh, struct 
v4l2_dbg_chip_ident *chip)
+{
+   chip-ident = V4L2_IDENT_NONE;
+   chip-revision = 0;
+   if (chip-match.type == V4L2_CHIP_MATCH_HOST) {
+   if (v4l2_chip_match_host(chip-match))
+   chip-ident = V4L2_IDENT_CX23100;
+   return 0;
+   }
+   return -EINVAL;
+}
+
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 
 /*
@@ -2513,6 +2525,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_s_tuner= vidioc_s_tuner,
.vidioc_g_frequency= vidioc_g_frequency,
.vidioc_s_frequency= vidioc_s_frequency,
+   .vidioc_g_chip_ident   = vidioc_g_chip_ident,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register,
-- 
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


[RFCv1 PATCH 03/20] cx231xx: clean up radio support.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Radio should not use video or audio inputs.
In addition, fix a bug in radio_g_tuner where s_tuner was called in the tuner
subdev instead of g_tuner.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   79 +++--
 1 file changed, 18 insertions(+), 61 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 44bc687..666152f 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1873,20 +1873,24 @@ static int vidioc_querycap(struct file *file, void 
*priv,
strlcpy(cap-card, cx231xx_boards[dev-model].name, sizeof(cap-card));
usb_make_path(dev-udev, cap-bus_info, sizeof(cap-bus_info));
 
-   cap-device_caps =
-   V4L2_CAP_AUDIO  |
-   V4L2_CAP_READWRITE  |
-   V4L2_CAP_STREAMING;
-
-   if (vdev-vfl_type == VFL_TYPE_VBI)
-   cap-device_caps |= V4L2_CAP_VBI_CAPTURE;
-   else
-   cap-device_caps |= V4L2_CAP_VIDEO_CAPTURE;
+   if (vdev-vfl_type == VFL_TYPE_RADIO)
+   cap-device_caps = V4L2_CAP_RADIO;
+   else {
+   cap-device_caps = V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
+   V4L2_CAP_STREAMING;
+   if (vdev-vfl_type == VFL_TYPE_VBI)
+   cap-device_caps |= V4L2_CAP_VBI_CAPTURE;
+   else
+   cap-device_caps |= V4L2_CAP_VIDEO_CAPTURE;
+   }
if (dev-tuner_type != TUNER_ABSENT)
cap-device_caps |= V4L2_CAP_TUNER;
cap-capabilities = cap-device_caps |
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE |
-   V4L2_CAP_DEVICE_CAPS;
+   V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
+   V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS;
+   if (dev-radio_dev)
+   cap-capabilities |= V4L2_CAP_RADIO;
 
return 0;
 }
@@ -2053,53 +2057,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, 
struct v4l2_buffer *b)
 /* RADIO ESPECIFIC IOCTLS  */
 /* --- */
 
-static int radio_querycap(struct file *file, void *priv,
- struct v4l2_capability *cap)
-{
-   struct cx231xx *dev = ((struct cx231xx_fh *)priv)-dev;
-
-   strlcpy(cap-driver, cx231xx, sizeof(cap-driver));
-   strlcpy(cap-card, cx231xx_boards[dev-model].name, sizeof(cap-card));
-   usb_make_path(dev-udev, cap-bus_info, sizeof(cap-bus_info));
-
-   cap-capabilities = V4L2_CAP_TUNER;
-   return 0;
-}
-
 static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
 {
struct cx231xx *dev = ((struct cx231xx_fh *)priv)-dev;
 
-   if (unlikely(t-index  0))
+   if (t-index)
return -EINVAL;
 
strcpy(t-name, Radio);
-   t-type = V4L2_TUNER_RADIO;
-
-   call_all(dev, tuner, s_tuner, t);
-
-   return 0;
-}
 
-static int radio_enum_input(struct file *file, void *priv, struct v4l2_input 
*i)
-{
-   if (i-index != 0)
-   return -EINVAL;
-   strcpy(i-name, Radio);
-   i-type = V4L2_INPUT_TYPE_TUNER;
-
-   return 0;
-}
-
-static int radio_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
-{
-   if (unlikely(a-index))
-   return -EINVAL;
+   call_all(dev, tuner, g_tuner, t);
 
-   strcpy(a-name, Radio);
return 0;
 }
-
 static int radio_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
 {
struct cx231xx *dev = ((struct cx231xx_fh *)priv)-dev;
@@ -2112,16 +2082,6 @@ static int radio_s_tuner(struct file *file, void *priv, 
struct v4l2_tuner *t)
return 0;
 }
 
-static int radio_s_audio(struct file *file, void *fh, const struct v4l2_audio 
*a)
-{
-   return 0;
-}
-
-static int radio_s_input(struct file *file, void *fh, unsigned int i)
-{
-   return 0;
-}
-
 static int radio_queryctrl(struct file *file, void *priv,
   struct v4l2_queryctrl *c)
 {
@@ -2550,18 +2510,15 @@ static const struct v4l2_file_operations radio_fops = {
 };
 
 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
-   .vidioc_querycap= radio_querycap,
+   .vidioc_querycap= vidioc_querycap,
.vidioc_g_tuner = radio_g_tuner,
-   .vidioc_enum_input  = radio_enum_input,
-   .vidioc_g_audio = radio_g_audio,
.vidioc_s_tuner = radio_s_tuner,
-   .vidioc_s_audio = radio_s_audio,
-   .vidioc_s_input = radio_s_input,
.vidioc_queryctrl   = radio_queryctrl,
.vidioc_g_ctrl  = vidioc_g_ctrl,
.vidioc_s_ctrl  = vidioc_s_ctrl,
.vidioc_g_frequency = vidioc_g_frequency,
.vidioc_s_frequency = vidioc_s_frequency,
+   .vidioc_g_chip_ident = vidioc_g_chip_ident,
 #ifdef 

[RFCv1 PATCH 10/20] cx231xx: add struct v4l2_fh to get prio and event support.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Required to resolve v4l2-compliance failures.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   31 -
 drivers/media/usb/cx231xx/cx231xx.h   |2 ++
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index d3595c4..e9adeb6 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -35,6 +35,7 @@
 
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
+#include media/v4l2-event.h
 #include media/v4l2-chip-ident.h
 #include media/msp3400.h
 #include media/tuner.h
@@ -1869,6 +1870,7 @@ static int cx231xx_v4l2_open(struct file *filp)
fh-radio = radio;
fh-type = fh_type;
filp-private_data = fh;
+   v4l2_fh_init(fh-fh, vdev);
 
if (fh-type == V4L2_BUF_TYPE_VIDEO_CAPTURE  dev-users == 0) {
dev-width = norm_maxw(dev);
@@ -1924,6 +1926,7 @@ static int cx231xx_v4l2_open(struct file *filp)
fh, dev-lock);
}
mutex_unlock(dev-lock);
+   v4l2_fh_add(fh-fh);
 
return errCode;
 }
@@ -2018,12 +2021,15 @@ static int cx231xx_close(struct file *filp)
else
cx231xx_set_alt_setting(dev, INDEX_HANC, 0);
 
+   v4l2_fh_del(fh-fh);
+   v4l2_fh_exit(fh-fh);
kfree(fh);
dev-users--;
wake_up_interruptible_nr(dev-open, 1);
return 0;
}
 
+   v4l2_fh_del(fh-fh);
dev-users--;
if (!dev-users) {
videobuf_stop(fh-vb_vidq);
@@ -2050,6 +2056,7 @@ static int cx231xx_close(struct file *filp)
/* set alternate 0 */
cx231xx_set_alt_setting(dev, INDEX_VIDEO, 0);
}
+   v4l2_fh_exit(fh-fh);
kfree(fh);
wake_up_interruptible_nr(dev-open, 1);
return 0;
@@ -2106,29 +2113,37 @@ cx231xx_v4l2_read(struct file *filp, char __user *buf, 
size_t count,
  */
 static unsigned int cx231xx_v4l2_poll(struct file *filp, poll_table *wait)
 {
+   unsigned long req_events = poll_requested_events(wait);
struct cx231xx_fh *fh = filp-private_data;
struct cx231xx *dev = fh-dev;
+   unsigned res = 0;
int rc;
 
rc = check_dev(dev);
if (rc  0)
-   return rc;
+   return POLLERR;
 
rc = res_get(fh);
 
if (unlikely(rc  0))
return POLLERR;
 
+   if (v4l2_event_pending(fh-fh))
+   res |= POLLPRI;
+   else
+   poll_wait(filp, fh-fh.wait, wait);
+
+   if (!(req_events  (POLLIN | POLLRDNORM)))
+   return res;
+
if ((V4L2_BUF_TYPE_VIDEO_CAPTURE == fh-type) ||
(V4L2_BUF_TYPE_VBI_CAPTURE == fh-type)) {
-   unsigned int res;
-
mutex_lock(dev-lock);
-   res = videobuf_poll_stream(filp, fh-vb_vidq, wait);
+   res |= videobuf_poll_stream(filp, fh-vb_vidq, wait);
mutex_unlock(dev-lock);
return res;
}
-   return POLLERR;
+   return res | POLLERR;
 }
 
 /*
@@ -2202,6 +2217,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_g_register = vidioc_g_register,
.vidioc_s_register = vidioc_s_register,
 #endif
+   .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
+   .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
 static struct video_device cx231xx_vbi_template;
@@ -2218,6 +2235,7 @@ static const struct v4l2_file_operations radio_fops = {
.owner   = THIS_MODULE,
.open   = cx231xx_v4l2_open,
.release = cx231xx_v4l2_close,
+   .poll = v4l2_ctrl_poll,
.ioctl   = video_ioctl2,
 };
 
@@ -2232,6 +2250,8 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
.vidioc_g_register  = vidioc_g_register,
.vidioc_s_register  = vidioc_s_register,
 #endif
+   .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
+   .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
 
 static struct video_device cx231xx_radio_template = {
@@ -2257,6 +2277,7 @@ static struct video_device *cx231xx_vdev_init(struct 
cx231xx *dev,
vfd-release = video_device_release;
vfd-debug = video_debug;
vfd-lock = dev-lock;
+   set_bit(V4L2_FL_USE_FH_PRIO, vfd-flags);
 
snprintf(vfd-name, sizeof(vfd-name), %s %s, dev-name, type_name);
 
diff --git a/drivers/media/usb/cx231xx/cx231xx.h 
b/drivers/media/usb/cx231xx/cx231xx.h
index 53408ce..4c83ff5 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -34,6 +34,7 @@
 #include media/videobuf-vmalloc.h
 #include 

[RFCv1 PATCH 04/20] cx231xx: remove broken audio input support from the driver.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The audio selection code is broken. Audio and video indices were
mixed up and s_audio would reject changing the audio input to
something else anyway, so what's the point?

All the audio input code has been removed.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   52 +
 1 file changed, 8 insertions(+), 44 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 666152f..f043776 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1231,44 +1231,6 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int i)
return 0;
 }
 
-static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
-{
-   struct cx231xx_fh *fh = priv;
-   struct cx231xx *dev = fh-dev;
-
-   switch (a-index) {
-   case CX231XX_AMUX_VIDEO:
-   strcpy(a-name, Television);
-   break;
-   case CX231XX_AMUX_LINE_IN:
-   strcpy(a-name, Line In);
-   break;
-   default:
-   return -EINVAL;
-   }
-
-   a-index = dev-ctl_ainput;
-   a-capability = V4L2_AUDCAP_STEREO;
-
-   return 0;
-}
-
-static int vidioc_s_audio(struct file *file, void *priv, const struct 
v4l2_audio *a)
-{
-   struct cx231xx_fh *fh = priv;
-   struct cx231xx *dev = fh-dev;
-   int status = 0;
-
-   /* Doesn't allow manual routing */
-   if (a-index != dev-ctl_ainput)
-   return -EINVAL;
-
-   dev-ctl_ainput = INPUT(a-index)-amux;
-   status = cx231xx_set_audio_input(dev, dev-ctl_ainput);
-
-   return status;
-}
-
 static int vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
 {
@@ -1876,8 +1838,7 @@ static int vidioc_querycap(struct file *file, void *priv,
if (vdev-vfl_type == VFL_TYPE_RADIO)
cap-device_caps = V4L2_CAP_RADIO;
else {
-   cap-device_caps = V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
-   V4L2_CAP_STREAMING;
+   cap-device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
if (vdev-vfl_type == VFL_TYPE_VBI)
cap-device_caps |= V4L2_CAP_VBI_CAPTURE;
else
@@ -1885,9 +1846,8 @@ static int vidioc_querycap(struct file *file, void *priv,
}
if (dev-tuner_type != TUNER_ABSENT)
cap-device_caps |= V4L2_CAP_TUNER;
-   cap-capabilities = cap-device_caps |
+   cap-capabilities = cap-device_caps | V4L2_CAP_READWRITE |
V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE |
-   V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS;
if (dev-radio_dev)
cap-capabilities |= V4L2_CAP_RADIO;
@@ -2462,8 +2422,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_g_fmt_vbi_cap  = vidioc_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap= vidioc_try_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap  = vidioc_try_fmt_vbi_cap,
-   .vidioc_g_audio=  vidioc_g_audio,
-   .vidioc_s_audio= vidioc_s_audio,
.vidioc_cropcap= vidioc_cropcap,
.vidioc_g_fmt_sliced_vbi_cap   = vidioc_g_fmt_sliced_vbi_cap,
.vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,
@@ -2552,6 +2510,12 @@ static struct video_device *cx231xx_vdev_init(struct 
cx231xx *dev,
snprintf(vfd-name, sizeof(vfd-name), %s %s, dev-name, type_name);
 
video_set_drvdata(vfd, dev);
+   if (dev-tuner_type == TUNER_ABSENT) {
+   v4l2_disable_ioctl(vfd, VIDIOC_G_FREQUENCY);
+   v4l2_disable_ioctl(vfd, VIDIOC_S_FREQUENCY);
+   v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER);
+   v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER);
+   }
return vfd;
 }
 
-- 
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


[RFCv1 PATCH 00/20] cx231xx: v4l2-compliance fixes

2013-01-29 Thread Hans Verkuil
Hi all,

This patch series cleans up the cx231xx driver based on v4l2-compliance
reports.

I have tested this on various cx231xx devices. However, I have no hardware
that supports the radio tuner, so that's untested.

Also note that vbi and the MPEG encoder support does not seem to work. It
didn't work before these patches are applied, and it doesn't work afterwards.

I'm not sure if I should try to spend time on the MPEG encoder, since to
my knowledge there are no actual consumer products that support it. I have
a dev board from Conexant (Thanks!) that allowed me to test it, but I haven't
seen anything commercially available.

One option is to eventually merge the 417 conversion, and remove it from the
driver with a final patch so that the work I've done is at least available
in git should someone be interested in getting it to work.

I will take a closer look at the vbi support, though.. It would be nice to get
that working.

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


[RFCv1 PATCH 08/20] cx231xx: fix vbi compliance issues.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Various v4l2-compliance fixes: remove unused sliced VBI functions, zero the
reserved fields of struct v4l2_vbi_format and implement the missing 
s_fmt_vbi_cap.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   45 ++---
 1 file changed, 2 insertions(+), 43 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index ee9c9a5..18789c1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1866,47 +1866,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, 
void *priv,
return 0;
 }
 
-/* Sliced VBI ioctls */
-static int vidioc_g_fmt_sliced_vbi_cap(struct file *file, void *priv,
-  struct v4l2_format *f)
-{
-   struct cx231xx_fh *fh = priv;
-   struct cx231xx *dev = fh-dev;
-   int rc;
-
-   rc = check_dev(dev);
-   if (rc  0)
-   return rc;
-
-   f-fmt.sliced.service_set = 0;
-
-   call_all(dev, vbi, g_sliced_fmt, f-fmt.sliced);
-
-   if (f-fmt.sliced.service_set == 0)
-   rc = -EINVAL;
-
-   return rc;
-}
-
-static int vidioc_try_set_sliced_vbi_cap(struct file *file, void *priv,
-struct v4l2_format *f)
-{
-   struct cx231xx_fh *fh = priv;
-   struct cx231xx *dev = fh-dev;
-   int rc;
-
-   rc = check_dev(dev);
-   if (rc  0)
-   return rc;
-
-   call_all(dev, vbi, g_sliced_fmt, f-fmt.sliced);
-
-   if (f-fmt.sliced.service_set == 0)
-   return -EINVAL;
-
-   return 0;
-}
-
 /* RAW VBI ioctls */
 
 static int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
@@ -1926,6 +1885,7 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void 
*priv,
f-fmt.vbi.start[1] = (dev-norm  V4L2_STD_625_50) ?
PAL_VBI_START_LINE + 312 : NTSC_VBI_START_LINE + 263;
f-fmt.vbi.count[1] = f-fmt.vbi.count[0];
+   memset(f-fmt.vbi.reserved, 0, sizeof(f-fmt.vbi.reserved));
 
return 0;
 
@@ -1949,6 +1909,7 @@ static int vidioc_try_fmt_vbi_cap(struct file *file, void 
*priv,
f-fmt.vbi.start[1] = (dev-norm  V4L2_STD_625_50) ?
PAL_VBI_START_LINE + 312 : NTSC_VBI_START_LINE + 263;
f-fmt.vbi.count[1] = f-fmt.vbi.count[0];
+   memset(f-fmt.vbi.reserved, 0, sizeof(f-fmt.vbi.reserved));
 
return 0;
 
@@ -2430,8 +2391,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_try_fmt_vbi_cap= vidioc_try_fmt_vbi_cap,
.vidioc_s_fmt_vbi_cap  = vidioc_s_fmt_vbi_cap,
.vidioc_cropcap= vidioc_cropcap,
-   .vidioc_g_fmt_sliced_vbi_cap   = vidioc_g_fmt_sliced_vbi_cap,
-   .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,
.vidioc_reqbufs= vidioc_reqbufs,
.vidioc_querybuf   = vidioc_querybuf,
.vidioc_qbuf   = vidioc_qbuf,
-- 
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


[RFCv1 PATCH 06/20] cx231xx: fix a bunch of TRY/S_FMT bugs.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Fixed a number of incorrect size and bytesperline calculations, remove an
invalid busy check in try_fmt_vid_cap (try_fmt can never return EBUSY) and
zero the priv field.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index b7dcfc1..05bafdaf 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -781,7 +781,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int 
*count, unsigned int *size)
struct cx231xx_fh *fh = vq-priv_data;
struct cx231xx *dev = fh-dev;
 
-   *size = (fh-dev-width * fh-dev-height * dev-format-depth + 7)3;
+   *size = fh-dev-width * fh-dev-height * ((dev-format-depth + 7)  
3);
if (0 == *count)
*count = CX231XX_DEF_BUF;
 
@@ -835,8 +835,8 @@ buffer_prepare(struct videobuf_queue *vq, struct 
videobuf_buffer *vb,
int rc = 0, urb_init = 0;
 
/* The only currently supported format is 16 bits/pixel */
-   buf-vb.size = (fh-dev-width * fh-dev-height * dev-format-depth
-   + 7)  3;
+   buf-vb.size = fh-dev-width * fh-dev-height *
+   ((dev-format-depth + 7)  3);
if (0 != buf-vb.baddr  buf-vb.bsize  buf-vb.size)
return -EINVAL;
 
@@ -1000,11 +1000,12 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*priv,
f-fmt.pix.width = dev-width;
f-fmt.pix.height = dev-height;
f-fmt.pix.pixelformat = dev-format-fourcc;
-   f-fmt.pix.bytesperline = (dev-width * dev-format-depth + 7)  3;
+   f-fmt.pix.bytesperline = dev-width * ((dev-format-depth + 7)  3);
f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * dev-height;
f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 
f-fmt.pix.field = V4L2_FIELD_INTERLACED;
+   f-fmt.pix.priv = 0;
 
return 0;
 }
@@ -1045,10 +1046,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
void *priv,
f-fmt.pix.width = width;
f-fmt.pix.height = height;
f-fmt.pix.pixelformat = fmt-fourcc;
-   f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
+   f-fmt.pix.bytesperline = dev-width * ((fmt-depth + 7)  3);
f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
f-fmt.pix.field = V4L2_FIELD_INTERLACED;
+   f-fmt.pix.priv = 0;
 
return 0;
 }
-- 
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


[RFCv1 PATCH 09/20] cx231xx: convert to the control framework.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This is needed to resolve the v4l2-compliance complaints about the control
ioctls.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-audio.c |4 -
 drivers/media/usb/cx231xx/cx231xx-cards.c |2 -
 drivers/media/usb/cx231xx/cx231xx-video.c |  244 +++--
 drivers/media/usb/cx231xx/cx231xx.h   |   13 +-
 4 files changed, 27 insertions(+), 236 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-audio.c 
b/drivers/media/usb/cx231xx/cx231xx-audio.c
index b4c99c7..b40360b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-audio.c
+++ b/drivers/media/usb/cx231xx/cx231xx-audio.c
@@ -449,9 +449,6 @@ static int snd_cx231xx_capture_open(struct 
snd_pcm_substream *substream)
return -ENODEV;
}
 
-   /* Sets volume, mute, etc */
-   dev-mute = 0;
-
/* set alternate setting for audio interface */
/* 1 - 48000 samples per sec */
mutex_lock(dev-lock);
@@ -503,7 +500,6 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream 
*substream)
return ret;
}
 
-   dev-mute = 1;
dev-adev.users--;
mutex_unlock(dev-lock);
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c 
b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 8d52956..d6acb1e 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -846,8 +846,6 @@ void cx231xx_card_setup(struct cx231xx *dev)
 int cx231xx_config(struct cx231xx *dev)
 {
/* TBD need to add cx231xx specific code */
-   dev-mute = 1;  /* maybe not the right place... */
-   dev-volume = 0x1f;
 
return 0;
 }
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 18789c1..d3595c4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -100,125 +100,6 @@ static struct cx231xx_fmt format[] = {
 },
 };
 
-/* supported controls */
-/* Common to all boards */
-
-/* --- */
-
-static const struct v4l2_queryctrl no_ctl = {
-   .name = 42,
-   .flags = V4L2_CTRL_FLAG_DISABLED,
-};
-
-static struct cx231xx_ctrl cx231xx_ctls[] = {
-   /* --- video --- */
-   {
-   .v = {
-   .id = V4L2_CID_BRIGHTNESS,
-   .name = Brightness,
-   .minimum = 0x00,
-   .maximum = 0xff,
-   .step = 1,
-   .default_value = 0x7f,
-   .type = V4L2_CTRL_TYPE_INTEGER,
-   },
-   .off = 128,
-   .reg = LUMA_CTRL,
-   .mask = 0x00ff,
-   .shift = 0,
-   }, {
-   .v = {
-   .id = V4L2_CID_CONTRAST,
-   .name = Contrast,
-   .minimum = 0,
-   .maximum = 0xff,
-   .step = 1,
-   .default_value = 0x3f,
-   .type = V4L2_CTRL_TYPE_INTEGER,
-   },
-   .off = 0,
-   .reg = LUMA_CTRL,
-   .mask = 0xff00,
-   .shift = 8,
-   }, {
-   .v = {
-   .id = V4L2_CID_HUE,
-   .name = Hue,
-   .minimum = 0,
-   .maximum = 0xff,
-   .step = 1,
-   .default_value = 0x7f,
-   .type = V4L2_CTRL_TYPE_INTEGER,
-   },
-   .off = 128,
-   .reg = CHROMA_CTRL,
-   .mask = 0xff,
-   .shift = 16,
-   }, {
-   /* strictly, this only describes only U saturation.
-   * V saturation is handled specially through code.
-   */
-   .v = {
-   .id = V4L2_CID_SATURATION,
-   .name = Saturation,
-   .minimum = 0,
-   .maximum = 0xff,
-   .step = 1,
-   .default_value = 0x7f,
-   .type = V4L2_CTRL_TYPE_INTEGER,
-   },
-   .off = 0,
-   .reg = CHROMA_CTRL,
-   .mask = 0x00ff,
-   .shift = 0,
-   }, {
-   /* --- audio --- */
-   .v = {
-   .id = V4L2_CID_AUDIO_MUTE,
-   .name = Mute,
-   .minimum = 0,
-   .maximum = 1,
-   .default_value = 1,
-   .type = V4L2_CTRL_TYPE_BOOLEAN,
-   },
-   .reg = PATH1_CTL1,
-   .mask = (0x1f  24),
-   .shift = 24,
-   }, {
-   .v = {
-   .id = V4L2_CID_AUDIO_VOLUME,
-   

[RFCv1 PATCH 11/20] cx231xx: remove current_norm usage.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The use of this field is deprecated since it will not work when multiple
device nodes reference the same video input (the video and vbi nodes in
this case). The norm field should be a device-global value.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c   |1 -
 drivers/media/usb/cx231xx/cx231xx-video.c |3 +--
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 28688db..a4091dd 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -2115,7 +2115,6 @@ static struct video_device cx231xx_mpeg_template = {
.ioctl_ops = mpeg_ioctl_ops,
.minor = -1,
.tvnorms   = CX231xx_NORMS,
-   .current_norm  = V4L2_STD_NTSC_M,
 };
 
 void cx231xx_417_unregister(struct cx231xx *dev)
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index e9adeb6..da54b9b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -2228,7 +2228,6 @@ static const struct video_device cx231xx_video_template = 
{
.release  = video_device_release,
.ioctl_ops= video_ioctl_ops,
.tvnorms  = V4L2_STD_ALL,
-   .current_norm = V4L2_STD_PAL,
 };
 
 static const struct v4l2_file_operations radio_fops = {
@@ -2299,7 +2298,7 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
 dev-name, CX231XX_VERSION);
 
/* set default norm */
-   /*dev-norm = cx231xx_video_template.current_norm; */
+   dev-norm = V4L2_STD_PAL;
dev-width = norm_maxw(dev);
dev-height = norm_maxh(dev);
dev-interlaced = 0;
-- 
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


[RFCv1 PATCH 13/20] cx231xx: get rid of a bunch of unused cx231xx_fh fields.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |6 +-
 drivers/media/usb/cx231xx/cx231xx.h   |   18 +-
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 1f0e00a..51c686c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1619,9 +1619,6 @@ static int vidioc_streamoff(struct file *file, void *priv,
if (rc  0)
return rc;
 
-   if ((fh-type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 
-   (fh-type != V4L2_BUF_TYPE_VBI_CAPTURE))
-   return -EINVAL;
if (type != fh-type)
return -EINVAL;
 
@@ -1867,7 +1864,6 @@ static int cx231xx_v4l2_open(struct file *filp)
return -ERESTARTSYS;
}
fh-dev = dev;
-   fh-radio = radio;
fh-type = fh_type;
filp-private_data = fh;
v4l2_fh_init(fh-fh, vdev);
@@ -1898,7 +1894,7 @@ static int cx231xx_v4l2_open(struct file *filp)
dev-video_input = dev-video_input  2 ? 2 : dev-video_input;
 
}
-   if (fh-radio) {
+   if (radio) {
cx231xx_videodbg(video_open: setting radio device\n);
 
/* cx231xx_start_radio(dev); */
diff --git a/drivers/media/usb/cx231xx/cx231xx.h 
b/drivers/media/usb/cx231xx/cx231xx.h
index 4c83ff5..c17889d 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -433,25 +433,9 @@ struct cx231xx_fh {
struct v4l2_fh fh;
struct cx231xx *dev;
unsigned int stream_on:1;   /* Locks streams */
-   int radio;
-
-   struct videobuf_queue vb_vidq;
-
enum v4l2_buf_type type;
 
-
-
-/*following is copyed from cx23885.h*/
-   u32resources;
-
-   /* video overlay */
-   struct v4l2_window win;
-   struct v4l2_clip   *clips;
-   unsigned int   nclips;
-
-   /* video capture */
-   struct cx23417_fmt *fmt;
-   unsigned int   width, height;
+   struct videobuf_queue vb_vidq;
 
/* vbi capture */
struct videobuf_queue  vidq;
-- 
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


[RFCv1 PATCH 12/20] cx231xx: replace ioctl by unlocked_ioctl.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

There was already a core lock, so why wasn't ioctl already replaced by
unlock_ioctl?

This patch switches to unlocked_ioctl.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c   |   15 ++-
 drivers/media/usb/cx231xx/cx231xx-video.c |2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index a4091dd..15dd334 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1633,12 +1633,8 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int i)
 
dprintk(3, enter vidioc_s_input() i=%d\n, i);
 
-   mutex_lock(dev-lock);
-
video_mux(dev, i);
 
-   mutex_unlock(dev-lock);
-
if (i = 4)
return -EINVAL;
dev-input = i;
@@ -1932,7 +1928,8 @@ static int mpeg_open(struct file *file)
if (dev == NULL)
return -ENODEV;
 
-   mutex_lock(dev-lock);
+   if (mutex_lock_interruptible(dev-lock))
+   return -ERESTARTSYS;
 
/* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh), GFP_KERNEL);
@@ -1948,14 +1945,14 @@ static int mpeg_open(struct file *file)
videobuf_queue_vmalloc_init(fh-vidq, cx231xx_qops,
NULL, dev-video_mode.slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_INTERLACED,
-   sizeof(struct cx231xx_buffer), fh, NULL);
+   sizeof(struct cx231xx_buffer), fh, dev-lock);
 /*
videobuf_queue_sg_init(fh-vidq, cx231xx_qops,
dev-udev-dev, dev-ts1.slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED,
sizeof(struct cx231xx_buffer),
-   fh, NULL);
+   fh, dev-lock);
 */
 
 
@@ -2069,7 +2066,7 @@ static struct v4l2_file_operations mpeg_fops = {
.read  = mpeg_read,
.poll  = mpeg_poll,
.mmap  = mpeg_mmap,
-   .ioctl = video_ioctl2,
+   .unlocked_ioctl = video_ioctl2,
 };
 
 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
@@ -2144,11 +2141,11 @@ static struct video_device *cx231xx_video_dev_alloc(
if (NULL == vfd)
return NULL;
*vfd = *template;
-   vfd-minor = -1;
snprintf(vfd-name, sizeof(vfd-name), %s %s (%s), dev-name,
type, cx231xx_boards[dev-model].name);
 
vfd-v4l2_dev = dev-v4l2_dev;
+   vfd-lock = dev-lock;
vfd-release = video_device_release;
 
return vfd;
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index da54b9b..1f0e00a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -2235,7 +2235,7 @@ static const struct v4l2_file_operations radio_fops = {
.open   = cx231xx_v4l2_open,
.release = cx231xx_v4l2_close,
.poll = v4l2_ctrl_poll,
-   .ioctl   = video_ioctl2,
+   .unlocked_ioctl = video_ioctl2,
 };
 
 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
-- 
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


[RFCv1 PATCH 14/20] cx231xx: improve std handling.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Set the initial standard of subdevices instead of leaving it undefined.
Also update the width and height when a new standard is chosen and
return -EBUSY when attempting to change the standard while videobuf is
busy.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 51c686c..2a440cd 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -992,34 +992,34 @@ static int vidioc_s_std(struct file *file, void *priv, 
v4l2_std_id *norm)
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh-dev;
struct v4l2_mbus_framefmt mbus_fmt;
-   struct v4l2_format f;
int rc;
 
rc = check_dev(dev);
if (rc  0)
return rc;
 
-   cx231xx_info(vidioc_s_std : 0x%x\n, (unsigned int)*norm);
+   if (dev-norm == *norm)
+   return 0;
+
+   if (videobuf_queue_is_busy(fh-vb_vidq))
+   return -EBUSY;
 
dev-norm = *norm;
 
/* Adjusts width/height, if needed */
-   f.fmt.pix.width = dev-width;
-   f.fmt.pix.height = dev-height;
-   vidioc_try_fmt_vid_cap(file, priv, f);
+   dev-width = 720;
+   dev-height = (dev-norm  V4L2_STD_625_50) ? 576 : 480;
 
call_all(dev, core, s_std, dev-norm);
 
/* We need to reset basic properties in the decoder related to
   resolution (since a standard change effects things like the number
   of lines in VACT, etc) */
-   v4l2_fill_mbus_format(mbus_fmt, f.fmt.pix, V4L2_MBUS_FMT_FIXED);
+   memset(mbus_fmt, 0, sizeof(mbus_fmt));
+   mbus_fmt.code = V4L2_MBUS_FMT_FIXED;
+   mbus_fmt.width = dev-width;
+   mbus_fmt.height = dev-height;
call_all(dev, video, s_mbus_fmt, mbus_fmt);
-   v4l2_fill_pix_format(f.fmt.pix, mbus_fmt);
-
-   /* set new image size */
-   dev-width = f.fmt.pix.width;
-   dev-height = f.fmt.pix.height;
 
/* do mode control overrides */
cx231xx_do_mode_ctrl_overrides(dev);
@@ -2305,6 +2305,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev)
/* Set the initial input */
video_mux(dev, dev-video_input);
 
+   call_all(dev, core, s_std, dev-norm);
+
v4l2_ctrl_handler_init(dev-ctrl_handler, 10);
v4l2_ctrl_handler_init(dev-radio_ctrl_handler, 5);
 
-- 
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


[RFCv1 PATCH 05/20] cx231xx: fix tuner compliance issues.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The g_tuner call wasn't passed on to the subdevices, g_frequency didn't
check for invalid tuners and a low-level function that was expected to
return 0 or a negative error returned a positive number instead, causing
s_frequency to return bogus errors.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-avcore.c |2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c  |4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c 
b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 7222079..4706ed3 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -2133,7 +2133,7 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev)
 
status = vid_blk_write_word(dev, DIF_AGC_IF_REF, dwval);
 
-   return status;
+   return status == sizeof(dwval) ? 0 : -EIO;
 }
 
 /**
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index f043776..b7dcfc1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1322,6 +1322,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, 
struct v4l2_tuner *t)
t-capability = V4L2_TUNER_CAP_NORM;
t-rangehigh = 0xUL;
t-signal = 0x; /* LOCKED */
+   call_all(dev, tuner, g_tuner, t);
 
return 0;
 }
@@ -1350,6 +1351,9 @@ static int vidioc_g_frequency(struct file *file, void 
*priv,
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh-dev;
 
+   if (f-tuner)
+   return -EINVAL;
+
f-type = fh-radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
f-frequency = dev-ctl_freq;
 
-- 
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


[RFCv1 PATCH 15/20] cx231xx-417: remove empty functions.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c |   68 +--
 1 file changed, 1 insertion(+), 67 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 15dd334..ac15a55 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1551,33 +1551,6 @@ static int vidioc_s_std(struct file *file, void *priv, 
v4l2_std_id *id)
dprintk(3, exit vidioc_s_std() i=0x%x\n, i);
return 0;
 }
-static int vidioc_g_audio(struct file *file, void *fh,
-   struct v4l2_audio *a)
-{
-   struct v4l2_audio *vin = a;
-
-   int ret = -EINVAL;
-   if (vin-index  0)
-   return ret;
-   strncpy(vin-name, VideoGrabber Audio, 14);
-   vin-capability = V4L2_AUDCAP_STEREO;
-return 0;
-}
-static int vidioc_enumaudio(struct file *file, void *fh,
-   struct v4l2_audio *a)
-{
-   struct v4l2_audio *vin = a;
-
-   int ret = -EINVAL;
-
-   if (vin-index  0)
-   return ret;
-   strncpy(vin-name, VideoGrabber Audio, 14);
-   vin-capability = V4L2_AUDCAP_STEREO;
-
-
-return 0;
-}
 static const char *iname[] = {
[CX231XX_VMUX_COMPOSITE1] = Composite1,
[CX231XX_VMUX_SVIDEO] = S-Video,
@@ -1642,32 +1615,6 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int i)
return 0;
 }
 
-static int vidioc_g_tuner(struct file *file, void *priv,
-   struct v4l2_tuner *t)
-{
-   return 0;
-}
-
-static int vidioc_s_tuner(struct file *file, void *priv,
-   struct v4l2_tuner *t)
-{
-   return 0;
-}
-
-static int vidioc_g_frequency(struct file *file, void *priv,
-   struct v4l2_frequency *f)
-{
-   return 0;
-}
-
-static int vidioc_s_frequency(struct file *file, void *priv,
-   struct v4l2_frequency *f)
-{
-
-
-   return 0;
-}
-
 static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
 {
@@ -1748,13 +1695,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
void *priv,
return 0;
 }
 
-static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
-   struct v4l2_format *f)
-{
-
-   return 0;
-}
-
 static int vidioc_reqbufs(struct file *file, void *priv,
struct v4l2_requestbuffers *p)
 {
@@ -2073,20 +2013,14 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_s_std= vidioc_s_std,
.vidioc_g_std= vidioc_g_std,
.vidioc_enum_input   = vidioc_enum_input,
-   .vidioc_enumaudio= vidioc_enumaudio,
-   .vidioc_g_audio  = vidioc_g_audio,
.vidioc_g_input  = vidioc_g_input,
.vidioc_s_input  = vidioc_s_input,
-   .vidioc_g_tuner  = vidioc_g_tuner,
-   .vidioc_s_tuner  = vidioc_s_tuner,
-   .vidioc_g_frequency  = vidioc_g_frequency,
-   .vidioc_s_frequency  = vidioc_s_frequency,
.vidioc_s_ctrl   = vidioc_s_ctrl,
.vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_g_fmt_vid_cap= vidioc_g_fmt_vid_cap,
.vidioc_try_fmt_vid_cap  = vidioc_try_fmt_vid_cap,
-   .vidioc_s_fmt_vid_cap= vidioc_s_fmt_vid_cap,
+   .vidioc_s_fmt_vid_cap= vidioc_try_fmt_vid_cap,
.vidioc_reqbufs  = vidioc_reqbufs,
.vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf,
-- 
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


[RFCv1 PATCH 17/20] cx231xx-417: fix g/try_fmt compliance problems

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Colorspace, field and priv were not set, and sizeimage was calculated
using the wrong values (dev-ts1.ts_packet_size and dev-ts1.ts_packet_count
can be 0 at module load).

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c |   34 +--
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index be8f7481..cbdc141 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1223,6 +1223,7 @@ static int bb_buf_setup(struct videobuf_queue *q,
 
return 0;
 }
+
 static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf)
 {
struct cx231xx_fh *fh = vq-priv_data;
@@ -1645,17 +1646,18 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*priv,
 {
struct cx231xx_fh  *fh  = file-private_data;
struct cx231xx *dev = fh-dev;
+
dprintk(3, enter vidioc_g_fmt_vid_cap()\n);
-   f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
+   f-fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f-fmt.pix.bytesperline = 0;
-   f-fmt.pix.sizeimage=
-   dev-ts1.ts_packet_size * dev-ts1.ts_packet_count;
-   f-fmt.pix.colorspace   = 0;
-   f-fmt.pix.width= dev-ts1.width;
-   f-fmt.pix.height   = dev-ts1.height;
-   f-fmt.pix.field= fh-vidq.field;
-   dprintk(1, VIDIOC_G_FMT: w: %d, h: %d, f: %d\n,
-   dev-ts1.width, dev-ts1.height, fh-vidq.field);
+   f-fmt.pix.sizeimage = mpeglines * mpeglinesize;
+   f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+   f-fmt.pix.width = dev-ts1.width;
+   f-fmt.pix.height = dev-ts1.height;
+   f-fmt.pix.field = V4L2_FIELD_INTERLACED;
+   f-fmt.pix.priv = 0;
+   dprintk(1, VIDIOC_G_FMT: w: %d, h: %d\n,
+   dev-ts1.width, dev-ts1.height);
dprintk(3, exit vidioc_g_fmt_vid_cap()\n);
return 0;
 }
@@ -1665,14 +1667,16 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
void *priv,
 {
struct cx231xx_fh  *fh  = file-private_data;
struct cx231xx *dev = fh-dev;
+
dprintk(3, enter vidioc_try_fmt_vid_cap()\n);
-   f-fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
+   f-fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
f-fmt.pix.bytesperline = 0;
-   f-fmt.pix.sizeimage=
-   dev-ts1.ts_packet_size * dev-ts1.ts_packet_count;
-   f-fmt.pix.colorspace   = 0;
-   dprintk(1, VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n,
-   dev-ts1.width, dev-ts1.height, fh-vidq.field);
+   f-fmt.pix.sizeimage = mpeglines * mpeglinesize;
+   f-fmt.pix.field = V4L2_FIELD_INTERLACED;
+   f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
+   f-fmt.pix.priv = 0;
+   dprintk(1, VIDIOC_TRY_FMT: w: %d, h: %d\n,
+   dev-ts1.width, dev-ts1.height);
dprintk(3, exit vidioc_try_fmt_vid_cap()\n);
return 0;
 }
-- 
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


[RFCv1 PATCH 01/20] cx231xx: add device_caps support to QUERYCAP.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This fixes a v4l2_compliance failure.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 93dfc18..7324624 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1853,6 +1853,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
 static int vidioc_querycap(struct file *file, void *priv,
   struct v4l2_capability *cap)
 {
+   struct video_device *vdev = video_devdata(file);
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh-dev;
 
@@ -1860,17 +1861,20 @@ static int vidioc_querycap(struct file *file, void 
*priv,
strlcpy(cap-card, cx231xx_boards[dev-model].name, sizeof(cap-card));
usb_make_path(dev-udev, cap-bus_info, sizeof(cap-bus_info));
 
-   cap-capabilities = V4L2_CAP_VBI_CAPTURE |
-#if 0
-   V4L2_CAP_SLICED_VBI_CAPTURE |
-#endif
-   V4L2_CAP_VIDEO_CAPTURE  |
+   cap-device_caps =
V4L2_CAP_AUDIO  |
V4L2_CAP_READWRITE  |
V4L2_CAP_STREAMING;
 
+   if (vdev-vfl_type == VFL_TYPE_VBI)
+   cap-device_caps |= V4L2_CAP_VBI_CAPTURE;
+   else
+   cap-device_caps |= V4L2_CAP_VIDEO_CAPTURE;
if (dev-tuner_type != TUNER_ABSENT)
-   cap-capabilities |= V4L2_CAP_TUNER;
+   cap-device_caps |= V4L2_CAP_TUNER;
+   cap-capabilities = cap-device_caps |
+   V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE |
+   V4L2_CAP_DEVICE_CAPS;
 
return 0;
 }
-- 
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


[RFCv1 PATCH 07/20] cx231xx: fix frequency clamping.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Let the tuner clamp the frequency and store that clamped value.

This fixes a v4l2_compliance failure.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |   33 +++--
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 05bafdaf..ee9c9a5 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1356,11 +1356,8 @@ static int vidioc_g_frequency(struct file *file, void 
*priv,
if (f-tuner)
return -EINVAL;
 
-   f-type = fh-radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
f-frequency = dev-ctl_freq;
 
-   call_all(dev, tuner, g_frequency, f);
-
return 0;
 }
 
@@ -1383,16 +1380,12 @@ static int vidioc_s_frequency(struct file *file, void 
*priv,
if (0 != f-tuner)
return -EINVAL;
 
-   if (unlikely(0 == fh-radio  f-type != V4L2_TUNER_ANALOG_TV))
-   return -EINVAL;
-   if (unlikely(1 == fh-radio  f-type != V4L2_TUNER_RADIO))
-   return -EINVAL;
-
/* set pre channel change settings in DIF first */
rc = cx231xx_tuner_pre_channel_change(dev);
 
-   dev-ctl_freq = f-frequency;
call_all(dev, tuner, s_frequency, f);
+   call_all(dev, tuner, g_frequency, f);
+   dev-ctl_freq = f-frequency;
 
/* set post channel change settings in DIF first */
rc = cx231xx_tuner_post_channel_change(dev);
@@ -1921,6 +1914,7 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void 
*priv,
 {
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh-dev;
+
f-fmt.vbi.sampling_rate = 675 * 4;
f-fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
f-fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
@@ -1943,12 +1937,6 @@ static int vidioc_try_fmt_vbi_cap(struct file *file, 
void *priv,
struct cx231xx_fh *fh = priv;
struct cx231xx *dev = fh-dev;
 
-   if (dev-vbi_stream_on  !fh-stream_on) {
-   cx231xx_errdev(%s device in use by another fh\n, __func__);
-   return -EBUSY;
-   }
-
-   f-type = V4L2_BUF_TYPE_VBI_CAPTURE;
f-fmt.vbi.sampling_rate = 675 * 4;
f-fmt.vbi.samples_per_line = VBI_LINE_LENGTH;
f-fmt.vbi.sample_format = V4L2_PIX_FMT_GREY;
@@ -1966,6 +1954,19 @@ static int vidioc_try_fmt_vbi_cap(struct file *file, 
void *priv,
 
 }
 
+static int vidioc_s_fmt_vbi_cap(struct file *file, void *priv,
+ struct v4l2_format *f)
+{
+   struct cx231xx_fh *fh = priv;
+   struct cx231xx *dev = fh-dev;
+
+   if (dev-vbi_stream_on  !fh-stream_on) {
+   cx231xx_errdev(%s device in use by another fh\n, __func__);
+   return -EBUSY;
+   }
+   return vidioc_try_fmt_vbi_cap(file, priv, f);
+}
+
 static int vidioc_reqbufs(struct file *file, void *priv,
  struct v4l2_requestbuffers *rb)
 {
@@ -2427,7 +2428,7 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_s_fmt_vid_cap  = vidioc_s_fmt_vid_cap,
.vidioc_g_fmt_vbi_cap  = vidioc_g_fmt_vbi_cap,
.vidioc_try_fmt_vbi_cap= vidioc_try_fmt_vbi_cap,
-   .vidioc_s_fmt_vbi_cap  = vidioc_try_fmt_vbi_cap,
+   .vidioc_s_fmt_vbi_cap  = vidioc_s_fmt_vbi_cap,
.vidioc_cropcap= vidioc_cropcap,
.vidioc_g_fmt_sliced_vbi_cap   = vidioc_g_fmt_sliced_vbi_cap,
.vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap,
-- 
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


[RFCv1 PATCH 20/20] cx231xx-417: convert to the control framework.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c |  213 ---
 drivers/media/usb/cx231xx/cx231xx.h |2 +-
 2 files changed, 86 insertions(+), 129 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 567d7ab..49c842a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -34,6 +34,7 @@
 #include linux/vmalloc.h
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
+#include media/v4l2-event.h
 #include media/cx2341x.h
 #include media/tuner.h
 #include linux/usb.h
@@ -744,7 +745,7 @@ static int cx231xx_mbox_func(void *priv, u32 command, int 
in, int out,
if (value != 0x12345678) {
dprintk(3, Firmware and/or mailbox pointer not initialized or 
corrupted, signature = 0x%x, cmd = %s\n,
value, cmd_to_str(command));
-   return -1;
+   return -EIO;
}
 
/* This read looks at 32 bits, but flag is only 8 bits.
@@ -754,7 +755,7 @@ static int cx231xx_mbox_func(void *priv, u32 command, int 
in, int out,
if (flag) {
dprintk(3, ERROR: Mailbox appears to be in use (%x), cmd = 
%s\n,
flag, cmd_to_str(command));
-   return -1;
+   return -EBUSY;
}
 
flag |= 1; /* tell 'em we're working on it */
@@ -783,7 +784,7 @@ static int cx231xx_mbox_func(void *priv, u32 command, int 
in, int out,
break;
if (time_after(jiffies, timeout)) {
dprintk(3, ERROR: API Mailbox timeout\n);
-   return -1;
+   return -EIO;
}
udelay(10);
}
@@ -800,7 +801,7 @@ static int cx231xx_mbox_func(void *priv, u32 command, int 
in, int out,
flag = 0;
mc417_memory_write(dev, dev-cx23417_mailbox, flag);
 
-   return retval;
+   return 0;
 }
 
 /* We don't need to call the API often, so using just one
@@ -829,6 +830,7 @@ static int cx231xx_api_cmd(struct cx231xx *dev, u32 command,
return err;
 }
 
+
 static int cx231xx_find_mailbox(struct cx231xx *dev)
 {
u32 signature[4] = {
@@ -1092,10 +1094,10 @@ static void cx231xx_codec_settings(struct cx231xx *dev)
cx231xx_api_cmd(dev, CX2341X_ENC_SET_FRAME_SIZE, 2, 0,
dev-ts1.height, dev-ts1.width);
 
-   dev-mpeg_params.width = dev-ts1.width;
-   dev-mpeg_params.height = dev-ts1.height;
+   dev-mpeg_ctrl_handler.width = dev-ts1.width;
+   dev-mpeg_ctrl_handler.height = dev-ts1.height;
 
-   cx2341x_update(dev, cx231xx_mbox_func, NULL, dev-mpeg_params);
+   cx2341x_handler_setup(dev-mpeg_ctrl_handler);
 
cx231xx_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 3, 1);
cx231xx_api_cmd(dev, CX2341X_ENC_MISC, 2, 0, 4, 1);
@@ -1481,36 +1483,6 @@ static struct videobuf_queue_ops cx231xx_qops = {
 
 /* -- */
 
-static const u32 *ctrl_classes[] = {
-   cx2341x_mpeg_ctrls,
-   NULL
-};
-
-static int cx231xx_queryctrl(struct cx231xx *dev,
-   struct v4l2_queryctrl *qctrl)
-{
-   qctrl-id = v4l2_ctrl_next(ctrl_classes, qctrl-id);
-   if (qctrl-id == 0)
-   return -EINVAL;
-
-   /* MPEG V4L2 controls */
-   if (cx2341x_ctrl_query(dev-mpeg_params, qctrl))
-   qctrl-flags |= V4L2_CTRL_FLAG_DISABLED;
-
-   return 0;
-}
-
-static int cx231xx_querymenu(struct cx231xx *dev,
-   struct v4l2_querymenu *qmenu)
-{
-   struct v4l2_queryctrl qctrl;
-
-   qctrl.id = qmenu-id;
-   cx231xx_queryctrl(dev, qctrl);
-   return v4l2_ctrl_query_menu(qmenu, qctrl,
-   cx2341x_ctrl_get_menu(dev-mpeg_params, qmenu-id));
-}
-
 static int vidioc_g_std(struct file *file, void *fh0, v4l2_std_id *norm)
 {
struct cx231xx_fh  *fh  = file-private_data;
@@ -1537,12 +1509,12 @@ static int vidioc_s_std(struct file *file, void *priv, 
v4l2_std_id *id)
dprintk(3, encodernorm set to NTSC\n);
dev-norm = V4L2_STD_NTSC;
dev-ts1.height = 480;
-   dev-mpeg_params.is_50hz = 0;
+   cx2341x_handler_set_50hz(dev-mpeg_ctrl_handler, false);
} else {
dprintk(3, encodernorm set to PAL\n);
dev-norm = V4L2_STD_PAL_B;
dev-ts1.height = 576;
-   dev-mpeg_params.is_50hz = 1;
+   cx2341x_handler_set_50hz(dev-mpeg_ctrl_handler, true);
}
call_all(dev, core, s_std, dev-norm);
/* do mode control overrides */
@@ -1680,92 +1652,13 @@ static int vidioc_streamoff(struct file *file, void 
*priv, enum v4l2_buf_type i)
return videobuf_streamoff(fh-vidq);
 }
 
-static int vidioc_g_ext_ctrls(struct file 

[RFCv1 PATCH 16/20] cx231xx-417: use one querycap for all device nodes.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c   |   20 +---
 drivers/media/usb/cx231xx/cx231xx-video.c |6 +++---
 drivers/media/usb/cx231xx/cx231xx.h   |2 ++
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index ac15a55..be8f7481 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1626,24 +1626,6 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
dprintk(3, exit vidioc_s_ctrl()\n);
return 0;
 }
-static struct v4l2_capability pvr_capability = {
-   .driver = cx231xx,
-   .card   = VideoGrabber,
-   .bus_info   = usb,
-   .version= 1,
-   .capabilities   = (V4L2_CAP_VIDEO_CAPTURE |
-  V4L2_CAP_TUNER | V4L2_CAP_AUDIO | V4L2_CAP_RADIO |
-V4L2_CAP_STREAMING | V4L2_CAP_READWRITE),
-};
-static int vidioc_querycap(struct file *file, void  *priv,
-   struct v4l2_capability *cap)
-{
-
-
-
-   memcpy(cap, pvr_capability, sizeof(struct v4l2_capability));
-   return 0;
-}
 
 static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
struct v4l2_fmtdesc *f)
@@ -2016,7 +1998,7 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_g_input  = vidioc_g_input,
.vidioc_s_input  = vidioc_s_input,
.vidioc_s_ctrl   = vidioc_s_ctrl,
-   .vidioc_querycap = vidioc_querycap,
+   .vidioc_querycap = cx231xx_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
.vidioc_g_fmt_vid_cap= vidioc_g_fmt_vid_cap,
.vidioc_try_fmt_vid_cap  = vidioc_try_fmt_vid_cap,
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 2a440cd..d097009 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1630,7 +1630,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
return 0;
 }
 
-static int vidioc_querycap(struct file *file, void *priv,
+int cx231xx_querycap(struct file *file, void *priv,
   struct v4l2_capability *cap)
 {
struct video_device *vdev = video_devdata(file);
@@ -2184,7 +2184,7 @@ static const struct v4l2_file_operations cx231xx_v4l_fops 
= {
 };
 
 static const struct v4l2_ioctl_ops video_ioctl_ops = {
-   .vidioc_querycap   = vidioc_querycap,
+   .vidioc_querycap   = cx231xx_querycap,
.vidioc_enum_fmt_vid_cap   = vidioc_enum_fmt_vid_cap,
.vidioc_g_fmt_vid_cap  = vidioc_g_fmt_vid_cap,
.vidioc_try_fmt_vid_cap= vidioc_try_fmt_vid_cap,
@@ -2235,7 +2235,7 @@ static const struct v4l2_file_operations radio_fops = {
 };
 
 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
-   .vidioc_querycap= vidioc_querycap,
+   .vidioc_querycap= cx231xx_querycap,
.vidioc_g_tuner = radio_g_tuner,
.vidioc_s_tuner = radio_s_tuner,
.vidioc_g_frequency = vidioc_g_frequency,
diff --git a/drivers/media/usb/cx231xx/cx231xx.h 
b/drivers/media/usb/cx231xx/cx231xx.h
index c17889d..efc0d1c 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -934,6 +934,8 @@ int cx231xx_register_extension(struct cx231xx_ops *dev);
 void cx231xx_unregister_extension(struct cx231xx_ops *dev);
 void cx231xx_init_extension(struct cx231xx *dev);
 void cx231xx_close_extension(struct cx231xx *dev);
+int cx231xx_querycap(struct file *file, void *priv,
+  struct v4l2_capability *cap);
 
 /* Provided by cx231xx-cards.c */
 extern void cx231xx_pre_card_setup(struct cx231xx *dev);
-- 
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


[RFCv1 PATCH 18/20] cx231xx-417: checkpatch cleanups.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c |  732 +++
 1 file changed, 360 insertions(+), 372 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index cbdc141..2c05c8f 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -38,7 +38,6 @@
 #include linux/usb.h
 
 #include cx231xx.h
-/*#include cx23885-ioctl.h*/
 
 #define CX231xx_FIRM_IMAGE_SIZE 376836
 #define CX231xx_FIRM_IMAGE_NAME v4l-cx23885-enc.fw
@@ -75,9 +74,11 @@
 static unsigned int mpegbufs = 8;
 module_param(mpegbufs, int, 0644);
 MODULE_PARM_DESC(mpegbufs, number of mpeg buffers, range 2-32);
+
 static unsigned int mpeglines = 128;
 module_param(mpeglines, int, 0644);
 MODULE_PARM_DESC(mpeglines, number of lines in an MPEG buffer, range 2-32);
+
 static unsigned int mpeglinesize = 512;
 module_param(mpeglinesize, int, 0644);
 MODULE_PARM_DESC(mpeglinesize,
@@ -86,10 +87,10 @@ MODULE_PARM_DESC(mpeglinesize,
 static unsigned int v4l_debug = 1;
 module_param(v4l_debug, int, 0644);
 MODULE_PARM_DESC(v4l_debug, enable V4L debug messages);
-struct cx231xx_dmaqueue *dma_qq;
+
 #define dprintk(level, fmt, arg...)\
do { if (v4l_debug = level) \
-   printk(KERN_INFO %s:  fmt, \
+   pr_info(%s:  fmt, \
(dev) ? dev-name : cx231xx[?], ## arg); \
} while (0)
 
@@ -131,11 +132,13 @@ static struct cx231xx_tvnorm cx231xx_tvnorms[] = {
 };
 
 /* -- */
+
 enum cx231xx_capture_type {
CX231xx_MPEG_CAPTURE,
CX231xx_RAW_CAPTURE,
CX231xx_RAW_PASSTHRU_CAPTURE
 };
+
 enum cx231xx_capture_bits {
CX231xx_RAW_BITS_NONE = 0x00,
CX231xx_RAW_BITS_YUV_CAPTURE  = 0x01,
@@ -144,33 +147,40 @@ enum cx231xx_capture_bits {
CX231xx_RAW_BITS_PASSTHRU_CAPTURE = 0x08,
CX231xx_RAW_BITS_TO_HOST_CAPTURE  = 0x10
 };
+
 enum cx231xx_capture_end {
CX231xx_END_AT_GOP, /* stop at the end of gop, generate irq */
CX231xx_END_NOW, /* stop immediately, no irq */
 };
+
 enum cx231xx_framerate {
CX231xx_FRAMERATE_NTSC_30, /* NTSC: 30fps */
CX231xx_FRAMERATE_PAL_25   /* PAL: 25fps */
 };
+
 enum cx231xx_stream_port {
CX231xx_OUTPUT_PORT_MEMORY,
CX231xx_OUTPUT_PORT_STREAMING,
CX231xx_OUTPUT_PORT_SERIAL
 };
+
 enum cx231xx_data_xfer_status {
CX231xx_MORE_BUFFERS_FOLLOW,
CX231xx_LAST_BUFFER,
 };
+
 enum cx231xx_picture_mask {
CX231xx_PICTURE_MASK_NONE,
CX231xx_PICTURE_MASK_I_FRAMES,
CX231xx_PICTURE_MASK_I_P_FRAMES = 0x3,
CX231xx_PICTURE_MASK_ALL_FRAMES = 0x7,
 };
+
 enum cx231xx_vbi_mode_bits {
CX231xx_VBI_BITS_SLICED,
CX231xx_VBI_BITS_RAW,
 };
+
 enum cx231xx_vbi_insertion_bits {
CX231xx_VBI_BITS_INSERT_IN_XTENSION_USR_DATA,
CX231xx_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1  1,
@@ -178,56 +188,69 @@ enum cx231xx_vbi_insertion_bits {
CX231xx_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4  1,
CX231xx_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5  1,
 };
+
 enum cx231xx_dma_unit {
CX231xx_DMA_BYTES,
CX231xx_DMA_FRAMES,
 };
+
 enum cx231xx_dma_transfer_status_bits {
CX231xx_DMA_TRANSFER_BITS_DONE = 0x01,
CX231xx_DMA_TRANSFER_BITS_ERROR = 0x04,
CX231xx_DMA_TRANSFER_BITS_LL_ERROR = 0x10,
 };
+
 enum cx231xx_pause {
CX231xx_PAUSE_ENCODING,
CX231xx_RESUME_ENCODING,
 };
+
 enum cx231xx_copyright {
CX231xx_COPYRIGHT_OFF,
CX231xx_COPYRIGHT_ON,
 };
+
 enum cx231xx_notification_type {
CX231xx_NOTIFICATION_REFRESH,
 };
+
 enum cx231xx_notification_status {
CX231xx_NOTIFICATION_OFF,
CX231xx_NOTIFICATION_ON,
 };
+
 enum cx231xx_notification_mailbox {
CX231xx_NOTIFICATION_NO_MAILBOX = -1,
 };
+
 enum cx231xx_field1_lines {
CX231xx_FIELD1_SAA7114 = 0x00EF, /* 239 */
CX231xx_FIELD1_SAA7115 = 0x00F0, /* 240 */
CX231xx_FIELD1_MICRONAS = 0x0105, /* 261 */
 };
+
 enum cx231xx_field2_lines {
CX231xx_FIELD2_SAA7114 = 0x00EF, /* 239 */
CX231xx_FIELD2_SAA7115 = 0x00F0, /* 240 */
CX231xx_FIELD2_MICRONAS = 0x0106, /* 262 */
 };
+
 enum cx231xx_custom_data_type {
CX231xx_CUSTOM_EXTENSION_USR_DATA,
CX231xx_CUSTOM_PRIVATE_PACKET,
 };
+
 enum cx231xx_mute {
CX231xx_UNMUTE,
CX231xx_MUTE,
 };
+
 enum cx231xx_mute_video_mask {
CX231xx_MUTE_VIDEO_V_MASK = 0xFF00,
CX231xx_MUTE_VIDEO_U_MASK = 0x00FF,
CX231xx_MUTE_VIDEO_Y_MASK = 0xFF00,
 };
+
 enum cx231xx_mute_video_shift {
CX231xx_MUTE_VIDEO_V_SHIFT = 8,
CX231xx_MUTE_VIDEO_U_SHIFT = 16,
@@ -296,41 +319,43 @@ enum cx231xx_mute_video_shift {
 
 
 #define CX23417_GPIO_MASK 0xFC0003FF
-static int 

[RFCv1 PATCH 19/20] cx231xx-417: share ioctls with cx231xx-video.

2013-01-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Share tuner, frequency, debug and input ioctls with cx231xx-video.
These are all shared resources, so no need to implement them again.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c   |  113 +++--
 drivers/media/usb/cx231xx/cx231xx-video.c |   52 ++---
 drivers/media/usb/cx231xx/cx231xx.h   |   15 
 3 files changed, 67 insertions(+), 113 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 2c05c8f..567d7ab 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -35,6 +35,7 @@
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
 #include media/cx2341x.h
+#include media/tuner.h
 #include linux/usb.h
 
 #include cx231xx.h
@@ -1551,68 +1552,6 @@ static int vidioc_s_std(struct file *file, void *priv, 
v4l2_std_id *id)
return 0;
 }
 
-static const char * const iname[] = {
-   [CX231XX_VMUX_COMPOSITE1] = Composite1,
-   [CX231XX_VMUX_SVIDEO] = S-Video,
-   [CX231XX_VMUX_TELEVISION] = Television,
-   [CX231XX_VMUX_CABLE]  = Cable TV,
-   [CX231XX_VMUX_DVB]= DVB,
-   [CX231XX_VMUX_DEBUG]  = for debug only,
-};
-
-static int vidioc_enum_input(struct file *file, void *priv,
-   struct v4l2_input *i)
-{
-   struct cx231xx_fh  *fh  = file-private_data;
-   struct cx231xx *dev = fh-dev;
-   struct cx231xx_input *input;
-   int n;
-   dprintk(3, enter vidioc_enum_input()i-index=%d\n, i-index);
-
-   if (i-index = 4)
-   return -EINVAL;
-
-   input = cx231xx_boards[dev-model].input[i-index];
-
-   if (input-type == 0)
-   return -EINVAL;
-
-   /* FIXME
-* strcpy(i-name, input-name); */
-
-   n = i-index;
-   strcpy(i-name, iname[INPUT(n)-type]);
-
-   if (input-type == CX231XX_VMUX_TELEVISION ||
-   input-type == CX231XX_VMUX_CABLE)
-   i-type = V4L2_INPUT_TYPE_TUNER;
-   else
-   i-type  = V4L2_INPUT_TYPE_CAMERA;
-   return 0;
-}
-
-static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
-{
-   *i = 0;
-   return  0;
-}
-
-static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
-{
-   struct cx231xx_fh  *fh  = file-private_data;
-   struct cx231xx *dev = fh-dev;
-
-   dprintk(3, enter vidioc_s_input() i=%d\n, i);
-
-   video_mux(dev, i);
-
-   if (i = 4)
-   return -EINVAL;
-   dev-input = i;
-   dprintk(3, exit vidioc_s_input()\n);
-   return 0;
-}
-
 static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl)
 {
@@ -1831,22 +1770,12 @@ static int vidioc_queryctrl(struct file *file, void 
*priv,
 
 static int mpeg_open(struct file *file)
 {
-   int minor = video_devdata(file)-minor;
-   struct cx231xx *h, *dev = NULL;
-   /*struct list_head *list;*/
+   struct video_device *vdev = video_devdata(file);
+   struct cx231xx *dev = video_drvdata(file);
struct cx231xx_fh *fh;
-   /*u32 value = 0;*/
 
dprintk(2, %s()\n, __func__);
 
-   list_for_each_entry(h, cx231xx_devlist, devlist) {
-   if (h-v4l_device-minor == minor)
-   dev = h;
-   }
-
-   if (dev == NULL)
-   return -ENODEV;
-
if (mutex_lock_interruptible(dev-lock))
return -ERESTARTSYS;
 
@@ -1858,7 +1787,8 @@ static int mpeg_open(struct file *file)
}
 
file-private_data = fh;
-   fh-dev  = dev;
+   v4l2_fh_init(fh-fh, vdev);
+   fh-dev = dev;
 
 
videobuf_queue_vmalloc_init(fh-vidq, cx231xx_qops,
@@ -1880,6 +1810,7 @@ static int mpeg_open(struct file *file)
cx231xx_initialize_codec(dev);
 
mutex_unlock(dev-lock);
+   v4l2_fh_add(fh-fh);
cx231xx_start_TS1(dev);
 
return 0;
@@ -1892,11 +1823,6 @@ static int mpeg_release(struct file *file)
 
dprintk(3, mpeg_release()! dev=0x%p\n, dev);
 
-   if (!dev) {
-   dprintk(3, abort!!!\n);
-   return 0;
-   }
-
mutex_lock(dev-lock);
 
cx231xx_stop_TS1(dev);
@@ -1930,7 +1856,8 @@ static int mpeg_release(struct file *file)
videobuf_read_stop(fh-vidq);
 
videobuf_mmap_free(fh-vidq);
-   file-private_data = NULL;
+   v4l2_fh_del(fh-fh);
+   v4l2_fh_exit(fh-fh);
kfree(fh);
mutex_unlock(dev-lock);
return 0;
@@ -1986,9 +1913,13 @@ static struct v4l2_file_operations mpeg_fops = {
 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_s_std= vidioc_s_std,
.vidioc_g_std= vidioc_g_std,
-   .vidioc_enum_input   = vidioc_enum_input,
-   .vidioc_g_input  = vidioc_g_input,
-   

Re: [RFCv1 PATCH 00/20] cx231xx: v4l2-compliance fixes

2013-01-29 Thread Devin Heitmueller
On Tue, Jan 29, 2013 at 11:32 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 I will take a closer look at the vbi support, though.. It would be nice to get
 that working.

FYI:  I had the VBI support working when I submitted the driver
upstream (at least for NTSC CC).  If it doesn't work, then somebody
broke it.

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


Re: [RFCv1 PATCH 00/20] cx231xx: v4l2-compliance fixes

2013-01-29 Thread Hans Verkuil
On Tue January 29 2013 17:41:29 Devin Heitmueller wrote:
 On Tue, Jan 29, 2013 at 11:32 AM, Hans Verkuil hverk...@xs4all.nl wrote:
  I will take a closer look at the vbi support, though.. It would be nice to 
  get
  that working.
 
 FYI:  I had the VBI support working when I submitted the driver
 upstream (at least for NTSC CC).  If it doesn't work, then somebody
 broke it.

Good to know. I'll definitely look into this more closely.

Regards,

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


Re: [REVIEW PATCH 11/12] em28xx: make ioctl VIDIOC_DBG_G_CHIP_IDENT available for radio devices

2013-01-29 Thread Frank Schäfer
Am 28.01.2013 11:00, schrieb Hans Verkuil:
 On Fri January 25 2013 18:27:01 Frank Schäfer wrote:
 Signed-off-by: Frank Schäfer fschaefer@googlemail.com
 ---
  drivers/media/usb/em28xx/em28xx-video.c |1 +
  1 Datei geändert, 1 Zeile hinzugefügt(+)

 diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
 b/drivers/media/usb/em28xx/em28xx-video.c
 index dd05cfb..e97b095 100644
 --- a/drivers/media/usb/em28xx/em28xx-video.c
 +++ b/drivers/media/usb/em28xx/em28xx-video.c
 @@ -1695,6 +1695,7 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = {
  #ifdef CONFIG_VIDEO_ADV_DEBUG
  .vidioc_g_register= vidioc_g_register,
  .vidioc_s_register= vidioc_s_register,
 +.vidioc_g_chip_ident  = vidioc_g_chip_ident,
  #endif
  };
  

 g_chip_ident can be moved out of ADV_DEBUG, both for video and radio devices.

Yes it can but I wasn't sure if we really should change it.
Anyway, with your vote for changing it, I will be glad to send a patch
(it's an additional change and I don't need to send a V2 of the series
then, which also makes life easier for Mauro).

Regards,
Frank

 Regards,

   Hans

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


Re: [RFC PATCH] em28xx: fix bytesperline calculation in TRY_FMT

2013-01-29 Thread Frank Schäfer
Am 29.01.2013 10:49, schrieb Hans Verkuil:
 This was part of my original em28xx patch series. That particular patch
 combined two things: this fix and the change where TRY_FMT would no
 longer return -EINVAL for unsupported pixelformats. The latter change was
 rejected (correctly), but we all forgot about the second part of the patch
 which fixed a real bug. I'm reposting just that fix.

 Regards,

   Hans

 The bytesperline calculation was incorrect: it used the old width instead
 of the provided width, and it miscalculated the bytesperline value for the
 depth == 12 case.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/usb/em28xx/em28xx-video.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
 b/drivers/media/usb/em28xx/em28xx-video.c
 index 2eabf2a..070506d 100644
 --- a/drivers/media/usb/em28xx/em28xx-video.c
 +++ b/drivers/media/usb/em28xx/em28xx-video.c
 @@ -906,7 +906,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
 *priv,
   f-fmt.pix.width = width;
   f-fmt.pix.height = height;
   f-fmt.pix.pixelformat = fmt-fourcc;
 - f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
 + f-fmt.pix.bytesperline = width * ((fmt-depth + 7)  3);
   f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
   f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
   if (dev-progressive)

Hmm... how are 12 bit pixels stored ? Are padding bits used so that 2
bytes per pixel are needed ?
I wonder if V4L2_PIX_FMT_YUV411P has ever been tested (libv4lconvert
doesn't support it)...

While we are at it, we should check and fix the other size calculations,
too.
For example, in em28xx-video.c we have in

vidioc_g_fmt_vid_cap():
f-fmt.pix.bytesperline = (dev-width * dev-format-depth + 7)  3;

queue_setup():
size = (dev-width * dev-height * dev-format-depth + 7)  3;

buffer_prepare():
size = (dev-width * dev-height * dev-format-depth + 7)  3;

em28xx_copy_video():
int bytesperline = dev-width  1;

and there are probably more places...


Regards,
Frank


--
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: [RFC PATCH] em28xx: fix bytesperline calculation in TRY_FMT

2013-01-29 Thread Hans Verkuil
On Tue January 29 2013 18:51:46 Frank Schäfer wrote:
 Am 29.01.2013 10:49, schrieb Hans Verkuil:
  This was part of my original em28xx patch series. That particular patch
  combined two things: this fix and the change where TRY_FMT would no
  longer return -EINVAL for unsupported pixelformats. The latter change was
  rejected (correctly), but we all forgot about the second part of the patch
  which fixed a real bug. I'm reposting just that fix.
 
  Regards,
 
  Hans
 
  The bytesperline calculation was incorrect: it used the old width instead
  of the provided width, and it miscalculated the bytesperline value for the
  depth == 12 case.
 
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  ---
   drivers/media/usb/em28xx/em28xx-video.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
  b/drivers/media/usb/em28xx/em28xx-video.c
  index 2eabf2a..070506d 100644
  --- a/drivers/media/usb/em28xx/em28xx-video.c
  +++ b/drivers/media/usb/em28xx/em28xx-video.c
  @@ -906,7 +906,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
  void *priv,
  f-fmt.pix.width = width;
  f-fmt.pix.height = height;
  f-fmt.pix.pixelformat = fmt-fourcc;
  -   f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
  +   f-fmt.pix.bytesperline = width * ((fmt-depth + 7)  3);
  f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
  f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
  if (dev-progressive)
 
 Hmm... how are 12 bit pixels stored ? Are padding bits used so that 2
 bytes per pixel are needed ?

It's a planar format where the luma plane is twice as big as the two chroma
planes combined. So that gives an effective 'depth' of 12 bits per pixel.
The bytesperline value should be that of the largest plane.

I now realize that that is still wrong in the calculation above. It should
be this instead:

f-fmt.pix.bytesperline = width * (fmt-depth  3);
f-fmt.pix.sizeimage = (width * height * fmt-depth)  3;

 I wonder if V4L2_PIX_FMT_YUV411P has ever been tested (libv4lconvert
 doesn't support it)...
 
 While we are at it, we should check and fix the other size calculations,
 too.
 For example, in em28xx-video.c we have in
 
 vidioc_g_fmt_vid_cap():
 f-fmt.pix.bytesperline = (dev-width * dev-format-depth + 7)  3;
 
 queue_setup():
 size = (dev-width * dev-height * dev-format-depth + 7)  3;
 
 buffer_prepare():
 size = (dev-width * dev-height * dev-format-depth + 7)  3;
 
 em28xx_copy_video():
 int bytesperline = dev-width  1;

Hmm, I'll have to prepare a RFCv2.

Regards,

Hans

 
 and there are probably more places...
 
 
 Regards,
 Frank
 
 
--
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: Problem with 187f:0202(Siano Mobile Silicon Nice) not automatically load smsdvb

2013-01-29 Thread 林博仁
Hi, I'm going to unsubscribe this mailing list (cause of flooding my mailbox ;))
Please send a mail to me if there's any progress.
Sorry for any annoyance :(

Sincerely,
Henry Lin pika1...@gmail.com

2013/1/2 林博仁 pika1...@gmail.com:
 Hi,
 I tried to make a DVB-T reciever which uses ID 187f:0202(Siano Mobile
 Silicon Nice) work on my linux machine(Ubuntu 12.10 x86 32bit 3.5.x
 kernel) and eventually found that only manually load 'smsdvb' module
 make the dvb device create (it won't create if just plug-in the
 hardware)

 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5819.458196] usb 2-1.2: new
 high-speed USB device number 21 using ehci_hcd
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5819.544329] usb 2-1.2: New USB
 device found, idVendor=187f, idProduct=0202
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5819.544335] usb 2-1.2: New USB
 device strings: Mfr=1, Product=2, SerialNumber=0
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5819.544340] usb 2-1.2: Product:
 MDTV Receiver
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5819.544343] usb 2-1.2:
 Manufacturer: MDTV Receiver
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5820.177202]
 smscore_set_device_mode: firmware download success:
 dvb_nova_12mhz_b0.inp
 Dec 31 10:01:29 SSD-Vubuntu kernel: [ 5820.180521] usbcore: registered
 new interface driver smsusb

 ** % sudo modprobe smsdvb **

 Dec 31 10:03:12 SSD-Vubuntu kernel: [ 5923.043199] DVB: registering
 new adapter (Siano Nice Digital Receiver)
 Dec 31 10:03:12 SSD-Vubuntu kernel: [ 5923.043502] usb 2-1.2: DVB:
 registering adapter 0 frontend 0 (Siano Mobile Digital MDTV
 Receiver)...

 Here is another card having the similar issue
 http://www.linuxtv.org/wiki/index.php/Smart_Plus

 I tried to contact smsusb module's author (u...@siano-ms.com) but the
 address is broken now...

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


Re: [RFC PATCH] em28xx: fix bytesperline calculation in TRY_FMT

2013-01-29 Thread Mauro Carvalho Chehab
Em Tue, 29 Jan 2013 19:21:50 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 On Tue January 29 2013 18:51:46 Frank Schäfer wrote:
  Am 29.01.2013 10:49, schrieb Hans Verkuil:
   This was part of my original em28xx patch series. That particular patch
   combined two things: this fix and the change where TRY_FMT would no
   longer return -EINVAL for unsupported pixelformats. The latter change was
   rejected (correctly), but we all forgot about the second part of the patch
   which fixed a real bug. I'm reposting just that fix.
  
   Regards,
  
 Hans
  
   The bytesperline calculation was incorrect: it used the old width instead
   of the provided width, and it miscalculated the bytesperline value for the
   depth == 12 case.
  
   Signed-off-by: Hans Verkuil hans.verk...@cisco.com
   ---
drivers/media/usb/em28xx/em28xx-video.c |2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
  
   diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
   b/drivers/media/usb/em28xx/em28xx-video.c
   index 2eabf2a..070506d 100644
   --- a/drivers/media/usb/em28xx/em28xx-video.c
   +++ b/drivers/media/usb/em28xx/em28xx-video.c
   @@ -906,7 +906,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, 
   void *priv,
 f-fmt.pix.width = width;
 f-fmt.pix.height = height;
 f-fmt.pix.pixelformat = fmt-fourcc;
   - f-fmt.pix.bytesperline = (dev-width * fmt-depth + 7)  3;
   + f-fmt.pix.bytesperline = width * ((fmt-depth + 7)  3);
 f-fmt.pix.sizeimage = f-fmt.pix.bytesperline * height;
 f-fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 if (dev-progressive)
  
  Hmm... how are 12 bit pixels stored ? Are padding bits used so that 2
  bytes per pixel are needed ?
 
 It's a planar format where the luma plane is twice as big as the two chroma
 planes combined. So that gives an effective 'depth' of 12 bits per pixel.
 The bytesperline value should be that of the largest plane.
 
 I now realize that that is still wrong in the calculation above. It should
 be this instead:
 
   f-fmt.pix.bytesperline = width * (fmt-depth  3);
   f-fmt.pix.sizeimage = (width * height * fmt-depth)  3;

The original code adds a + 7 to be sure that it will truncate upper
before dividing by 8.

 
  I wonder if V4L2_PIX_FMT_YUV411P has ever been tested (libv4lconvert
  doesn't support it)...
  
  While we are at it, we should check and fix the other size calculations,
  too.
  For example, in em28xx-video.c we have in
  
  vidioc_g_fmt_vid_cap():
  f-fmt.pix.bytesperline = (dev-width * dev-format-depth + 7)  3;
  
  queue_setup():
  size = (dev-width * dev-height * dev-format-depth + 7)  3;
  
  buffer_prepare():
  size = (dev-width * dev-height * dev-format-depth + 7)  3;
  
  em28xx_copy_video():
  int bytesperline = dev-width  1;
 
 Hmm, I'll have to prepare a RFCv2.
 
 Regards,
 
   Hans
 
  
  and there are probably more places...
  
  
  Regards,
  Frank
  
  
 --
 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


-- 

Cheers,
Mauro
--
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: Bug report - em28xx

2013-01-29 Thread Mauro Carvalho Chehab
Em Tue, 29 Jan 2013 16:40:18 +0100
Gianluca Gennari gennar...@gmail.com escreveu:

 Il 29/01/2013 15:59, Hans Verkuil ha scritto:
  On Tue January 29 2013 15:18:12 Olivier Subilia wrote:
  Hi,
 
  First of all, I've no experience with this mailing list. I'm not sure 
  I'm sending my report to the right place. If not, please don't hesitate 
  to tell it to me (possibly with the right place address).
 
  I'm desperately trying to compile v4l drivers for a PCTV quatrostick 
  nano. Following this page
 
  http://www.linuxtv.org/wiki/index.php/PCTVSystems_QuatroStick-nano_520e
 
  it uses the em28xx driver.
 
  my configuration: `uname -r` = 3.2.0-35-generic-pae
 
  So I tried to compile it with
 
  $ git clone git://linuxtv.org/media_build.git
  $ cd media_built
  $ ./build log.log (file attached)
 
  STDERR:
 
  Cloning into 'media_build'...
  remote: Counting objects: 1813, done.
  remote: Compressing objects: 100% (591/591), done.
  remote: Total 1813 (delta 1223), reused 1751 (delta 1183)
  Receiving objects: 100% (1813/1813), 423.66 KiB, done.
  Resolving deltas: 100% (1223/1223), done.
  multimedia@serveur:~$ cd media_build/
  multimedia@serveur:~/media_build$ ./build log.log
   From git://linuxtv.org/media_build
* branchmaster - FETCH_HEAD
  --2013-01-29 14:52:49-- 
  http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2.md5
  Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
  Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 93 [application/x-bzip2]
  Saving to: `linux-media.tar.bz2.md5.tmp'
 
  100%[=]
   
  93  --.-K/s   in 0s
 
  2013-01-29 14:52:49 (7.72 MB/s) - `linux-media.tar.bz2.md5.tmp' saved 
  [93/93]
 
  cat: linux-media.tar.bz2.md5: No such file or directory
  --2013-01-29 14:52:49-- 
  http://linuxtv.org/downloads/drivers/linux-media-LATEST.tar.bz2
  Resolving linuxtv.org (linuxtv.org)... 130.149.80.248
  Connecting to linuxtv.org (linuxtv.org)|130.149.80.248|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 4502249 (4.3M) [application/x-bzip2]
  Saving to: `linux-media.tar.bz2'
 
  100%[=]
   
  4'502'249   5.47M/s   in 0.8s
 
  2013-01-29 14:52:50 (5.47 MB/s) - `linux-media.tar.bz2' saved 
  [4502249/4502249]
 
  --2013-01-29 14:52:51-- 
  http://www.linuxtv.org/downloads/firmware//dvb-firmwares.tar.bz2
  Resolving www.linuxtv.org (www.linuxtv.org)... 130.149.80.248
  Connecting to www.linuxtv.org (www.linuxtv.org)|130.149.80.248|:80... 
  connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 649441 (634K) [application/x-bzip2]
  Saving to: `dvb-firmwares.tar.bz2'
 
  100%[=]
   
  649'441 1.41M/s   in 0.4s
 
  2013-01-29 14:52:51 (1.41 MB/s) - `dvb-firmwares.tar.bz2' saved 
  [649441/649441]
 
 
  ln: accessing `../../linux/firmware/dabusb//*': No such file or directory
  /home/multimedia/media_build/v4l/anysee.c: In function 
  'anysee_frontend_attach':
  /home/multimedia/media_build/v4l/anysee.c:893:2: warning: 'ret' may be 
  used uninitialized in this function [-Wuninitialized]
  /home/multimedia/media_build/v4l/m920x.c: In function 'm920x_probe':
  /home/multimedia/media_build/v4l/m920x.c:91:6: warning: 'ret' may be 
  used uninitialized in this function [-Wuninitialized]
  /home/multimedia/media_build/v4l/m920x.c:70:6: note: 'ret' was declared 
  here
  /home/multimedia/media_build/v4l/mxl111sf.c:58:0: warning: err 
  redefined [enabled by default]
  include/linux/usb.h:1655:0: note: this is the location of the previous 
  definition
  /home/multimedia/media_build/v4l/ngene-cards.c:813:2: warning: 
  initialization discards 'const' qualifier from pointer target type 
  [enabled by default]
  /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
  redefined [enabled by default]
  include/linux/usb.h:1655:0: note: this is the location of the previous 
  definition
  /home/multimedia/media_build/v4l/mxl111sf-tuner.c:34:0: warning: err 
  redefined [enabled by default]
  include/linux/usb.h:1655:0: note: this is the location of the previous 
  definition
  WARNING: snd_tea575x_set_freq 
  [/home/multimedia/media_build/v4l/radio-shark.ko] undefined!
  WARNING: modpost: Found 1 section mismatch(es).
  To see full details build your kernel with:
  'make CONFIG_DEBUG_SECTION_MISMATCH=y'
 
 
  No other compilation error. 524 modules founds. But if I check em28xx 
  family modules:
 
  $ ls v4l/em28xx*.ko
  ls: cannot access v4l/em28xx*.ko: No such file or directory
 
  In other words: no module is 

cron job: media_tree daily build: WARNINGS

2013-01-29 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:   Tue Jan 29 19:00:20 CET 2013
git branch: for_v3.9
git hash:   a32f7d1ad3744914273c6907204c2ab3b5d496a0
gcc version:i686-linux-gcc (GCC) 4.7.2
host hardware:  x86_64
host os:3.4.07-marune

linux-git-arm-davinci: WARNINGS
linux-git-arm-exynos: WARNINGS
linux-git-arm-omap: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-rc4-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-rc4-x86_64: OK
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: On MIPI-CSI2 YUV420 formats and V4L2 Media Bus formats

2013-01-29 Thread Laurent Pinchart
Hi Antonio,

On Monday 28 January 2013 13:22:10 Antonio Ospite wrote:
 Hi,
 
 looking at the MIPI Alliance Specification for Camera Serial Interface
 2 (I'll call it MIPI-CSI2 from now on, the document I am referring to
 is mentioned at [1] and available at [2]), I see there is an YUV420 8
 bit format (MIPI Data Type 0x18) specified with interleaved components
 in the form of:
 
   ... (odd lines)
   UYVYUYVY... (even lines)
 
 With even lines twice the size of odd lines.
 Such format is also supported by some sensors, for instance ov5640, and
 by MIPI-CSI2 receivers like OMAP4 ISS.
 
 The doubt I have is: how should I represent those formats as media bus
 formats?

We likely need new media bus formats to describe those.

 I've seen that some drivers (sensors and SoC, for instance[3]) tend to
 identify the MIPI-CSI2 format above (0x18) with media bus formats like
 V4L2_MBUS_FMT_UYVY8_1_5X8 (actually the code above uses
 V4L2_MBUS_FMT_YUYV8_1_5X8 is this OK?), but from the v4l2 documentation
 [4] I understand that this format is supposed to have data in this
 configuration:
 
   ...
   ...
   ...
   ...
   ...
   ...

Not exactly, the UYVY8_1_5X8 is transmits Y, U and V samples as UYYVYY...

 That is with interleaved lines, but NOT interleaved components. Should
 new media bus formats be added for .../UYVYUYVY...?

Yes, I think so.

 Another doubt I have is: how is the .../UYVYUYVY... data supposed
 to be processed in userspace? Is the MIPI Receiver (i.e, the SoC)
 expected to be able to convert it to a more usable format like YUV420P
 or NV12/NV21? Or are there applications capable of handling this data
 directly, or efficiently convert them to planar or semi-planar YUV420
 formats?

The bridge (receiver and DMA engine) driver will expose V4L2 pixel formats 
corresponding to the bridge capabilities. If the bridge can store the above 
stream in memory in NV12 it will expose that to applications. If the bridge 
stores data in memory as described above, it will just expose that format (it 
seems to correspond to the V4L2 M420 pixel format), and applications will need 
to handle that explicitly.

 In particular I am curios if the OMAP4 ISS can do the conversion to NV12, I
 understand that the formats with interleaved _lines_ can be produced by the
 resizer and handled by the OMAP ISP DMA-Engine by setting buffers offsets to
 Y and UV in order to send NV12 data to userspace, but I couldn't find info
 about how to handle the YUV420 MIPI-CSI2 formats (interleaved components)
 without the resizer in the Developer Manual [5]; having NV12 data directly
 from the hardware without using the OMAP4 ISS/ISP Resizer can be valuable in
 some use cases (e.g. dual camera setups).

No idea about that, sorry.

 [1] http://www.mipi.org/specifications/camera-interface#CSI2
 [2] http://ishare.sina.cn/dintro.php?id=20498632
 [3]
 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=driver
 s/media/platform/soc_camera/sh_mobile_csi2.c;h=a17aba9a0104c41cbc4e5e5d27701
 0ecac577600;hb=HEAD#l108 [4]
 http://kernel.org/doc/htmldocs/media/subdev.html#v4l2-mbus-pixelcode-yuv8
 [5] http://www.ti.com/lit/ug/swpu235w/swpu235w.pdf

-- 
Regards,

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


Re: [PATCH 2/7] mutex: add support for reservation style locks

2013-01-29 Thread Rob Clark
On Tue, Jan 15, 2013 at 6:33 AM, Maarten Lankhorst
m.b.lankho...@gmail.com wrote:


Hi Maarten,

This is a nice looking extension to avoid re-implementing a mutex in
TTM/reservation code..  ofc, probably someone more familiar with mutex
code should probably review, but probably a bit of explanation about
what and why would be helpful.

 mutex_reserve_lock, and mutex_reserve_lock_interruptible:
   Lock a buffer with a reservation_id set. reservation_id must not be set to 
 0,
   since this is a special value that means no reservation_id.

   Normally if reservation_id is not set, or is older than the reservation_id 
 that's
   currently set on the mutex, the behavior will be to wait normally.

   However, if  the reservation_id is newer than the current reservation_id, 
 -EAGAIN
   will be returned, and this function must unreserve all other mutexes and 
 then redo
   a blocking lock with normal mutex calls to prevent a deadlock, then call
   mutex_locked_set_reservation on successful locking to set the 
 reservation_id inside
   the lock.

It might be a bit more clear to write up how this works from the
perspective of the user of ticket_mutex, separately from the internal
implementation first, and then how it works internally?  Ie, the
mutex_set_reservation_fastpath() call is internal to the
implementation of ticket_mutex, but -EAGAIN is something the caller of
ticket_mutex shall deal with.  This might give a clearer picture of
how TTM / reservation uses this to prevent deadlock, so those less
familiar with TTM could better understand.

Well, here is an attempt to start a write-up, which should perhaps
eventually be folded into Documentation/ticket-mutex-design.txt.  But
hopefully a better explanation of the problem and the solution will
encourage some review of the ticket_mutex changes.

==
Basic problem statement:
- --- -
GPU's do operations that commonly involve many buffers.  Those buffers
can be shared across contexts/processes, exist in different memory
domains (for example VRAM vs system memory), and so on.  And with
PRIME / dmabuf, they can even be shared across devices.  So there are
a handful of situations where the driver needs to wait for buffers to
become ready.  If you think about this in terms of waiting on a buffer
mutex for it to become available, this presents a problem because
there is no way to guarantee that buffers appear in a execbuf/batch in
the same order in all contexts.  That is directly under control of
userspace, and a result of the sequence of GL calls that an
application makes.  Which results in the potential for deadlock.  The
problem gets more complex when you consider that the kernel may need
to migrate the buffer(s) into VRAM before the GPU operates on the
buffer(s), which main in turn require evicting some other buffers (and
you don't want to evict other buffers which are already queued up to
the GPU), but for a simplified understanding of the problem you can
ignore this.

The algorithm that TTM came up with for dealing with this problem is
quite simple.  For each group of buffers (execbuf) that need to be
locked, the caller would be assigned a unique reservation_id, from a
global counter.  In case of deadlock in the process of locking all the
buffers associated with a execbuf, the one with the lowest
reservation_id wins, and the one with the higher reservation_id
unlocks all of the buffers that it has already locked, and then tries
again.

Originally TTM implemented this algorithm on top of an event-queue and
atomic-ops, but Maarten Lankhorst realized that by merging this with
the mutex code we could take advantage of the existing mutex fast-path
code and result in a simpler solution, and so ticket_mutex was born.
(Well, there where also some additional complexities with the original
implementation when you start adding in cross-device buffer sharing
for PRIME.. Maarten could probably better explain.)

How it is used:
--- -- -- -

A very simplified version:

  int submit_execbuf(execbuf)
  {
  /* acquiring locks, before queuing up to GPU: */
  seqno = assign_global_seqno();
  retry:
  for (buf in execbuf-buffers) {
  ret = mutex_reserve_lock(buf-lock, seqno);
  switch (ret) {
  case 0:
  /* we got the lock */
  break;
  case -EAGAIN:
  /* someone with a lower seqno, so unreserve and try again: */
  for (buf2 in reverse order starting before buf in
execbuf-buffers)
  mutex_unreserve_unlock(buf2-lock);
  goto retry;
  default:
  goto err;
  }
  }

  /* now everything is good to go, submit job to GPU: */
  ...
  }

  int finish_execbuf(execbuf)
  {
  /* when GPU is finished: */
  for (buf in execbuf-buffers)
  mutex_unreserve_unlock(buf-lock);
  }
==

anyways, for the rest of the patch, I'm still going through the
mutex/ticket_mutex 

[PATCH v2 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-29 Thread Vikas Sajjan
This patch adds display-timing node parsing to drm fimd, this depends on
the display helper patchset at
http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

It also adds pinctrl support for drm fimd.

patch is based on branch exynos-drm-next at
http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

Is tested on Exynos5250 and Exynos4412 by applying dependent patches available
at http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

Vikas Sajjan (1):
  video: drm: exynos: Adds display-timing node parsing using video
helper function

 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   38 +++---
 1 file changed, 35 insertions(+), 3 deletions(-)

-- 
1.7.9.5

--
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 v2 1/1] video: drm: exynos: Adds display-timing node parsing using video helper function

2013-01-29 Thread Vikas Sajjan
This patch adds display-timing node parsing using video helper function

Signed-off-by: Leela Krishna Amudala l.kris...@samsung.com
Signed-off-by: Vikas Sajjan vikas.saj...@linaro.org
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |   38 +++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c 
b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index bf0d9ba..94729ed 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -19,6 +19,7 @@
 #include linux/clk.h
 #include linux/of_device.h
 #include linux/pm_runtime.h
+#include linux/pinctrl/consumer.h
 
 #include video/samsung_fimd.h
 #include drm/exynos_drm.h
@@ -905,15 +906,46 @@ static int __devinit fimd_probe(struct platform_device 
*pdev)
struct exynos_drm_subdrv *subdrv;
struct exynos_drm_fimd_pdata *pdata;
struct exynos_drm_panel_info *panel;
+   struct fb_videomode *fbmode;
+   struct device *disp_dev = pdev-dev;
+   struct pinctrl *pctrl;
struct resource *res;
int win;
int ret = -EINVAL;
 
DRM_DEBUG_KMS(%s\n, __FILE__);
 
-   pdata = pdev-dev.platform_data;
-   if (!pdata) {
-   dev_err(dev, no platform data specified\n);
+   if (pdev-dev.of_node) {
+   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   DRM_ERROR(memory allocation for pdata failed\n);
+   return -ENOMEM;
+   }
+
+   fbmode = devm_kzalloc(dev, sizeof(*fbmode), GFP_KERNEL);
+   if (!fbmode) {
+   DRM_ERROR(memory allocation for fbmode failed\n);
+   return -ENOMEM;
+   }
+
+   ret = of_get_fb_videomode(disp_dev-of_node, fbmode, -1);
+   if (ret) {
+   DRM_ERROR(failed to get fb_videomode\n);
+   return -EINVAL;
+   }
+   pdata-panel.timing = (struct fb_videomode) *fbmode;
+
+   } else {
+   pdata = pdev-dev.platform_data;
+   if (!pdata) {
+   DRM_ERROR(no platform data specified\n);
+   return -EINVAL;
+   }
+   }
+
+   pctrl = devm_pinctrl_get_select_default(dev);
+   if (IS_ERR(pctrl)) {
+   DRM_ERROR(no pinctrl data provided.\n);
return -EINVAL;
}
 
-- 
1.7.9.5

--
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 0/1] Adds display-timing node parsing to exynos drm fimd

2013-01-29 Thread Sachin Kamat
Hi Vikas,

Changelog mentioning differences between v1 and v2 is generally
preferred as it will help the reviewers.

On 30 January 2013 12:00, Vikas Sajjan vikas.saj...@linaro.org wrote:
 This patch adds display-timing node parsing to drm fimd, this depends on
 the display helper patchset at
 http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

 It also adds pinctrl support for drm fimd.

 patch is based on branch exynos-drm-next at
 http://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git

 Is tested on Exynos5250 and Exynos4412 by applying dependent patches available
 at http://lists.freedesktop.org/archives/dri-devel/2013-January/033998.html

 Vikas Sajjan (1):
   video: drm: exynos: Adds display-timing node parsing using video
 helper function

  drivers/gpu/drm/exynos/exynos_drm_fimd.c |   38 
 +++---
  1 file changed, 35 insertions(+), 3 deletions(-)

 --
 1.7.9.5

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



-- 
With warm regards,
Sachin
--
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] [media] tm6000: check an allocation for failure

2013-01-29 Thread Dan Carpenter
This allocation had no error checking.  It didn't need to be under
the mutex so I moved it out form there. That makes the error handling
easier and is a potential speed up.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/media/usb/tm6000/tm6000-core.c 
b/drivers/media/usb/tm6000/tm6000-core.c
index 22cc011..7c32353 100644
--- a/drivers/media/usb/tm6000/tm6000-core.c
+++ b/drivers/media/usb/tm6000/tm6000-core.c
@@ -40,10 +40,13 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 
req_type, u8 req,
u8   *data = NULL;
int delay = 5000;
 
-   mutex_lock(dev-usb_lock);
-
-   if (len)
+   if (len) {
data = kzalloc(len, GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+   }
+
+   mutex_lock(dev-usb_lock);
 
if (req_type  USB_DIR_IN)
pipe = usb_rcvctrlpipe(dev-udev, 0);
--
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