Re: Microsoft VX-1000 Microphone Drivers Crash in x86_64

2010-07-07 Thread Kyle Baker
On Wed, Jul 7, 2010 at 1:44 AM, Jean-Francois Moine moin...@free.fr wrote:

 Hi Kyle,

 The problem is known. I have no fix yet, but it seems that you use a
 USB 1.1. or that you have some other device on the same bus. May you
 try to connect your webcam to an other USB port?

 Best regards.

I tested different ports, but the results are the same.

From the log files it appears to be connecting via USB2.

Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.202520] usb 2-1: new
full speed USB device using ohci_hcd and address 6
Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.426975] gspca:
probing 045e:00f7
Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.438792] sonixj:
Sonix chip id: 11
Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.444844] input:
sonixj as /devices/pci:00/:00:02.0/usb2/2-1/input/input7
Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.444916] gspca: video0 created
Jul  7 01:48:54 kyleabaker-desktop kernel: [ 6186.444918] gspca: found
int in endpoint: 0x83, buffer_len=1, interval=100

The only usb devices connected are my keyboard, mouse and vx-1000 webcam.

I can get the microphone back if I reset the modules:
sudo rmmod gspca_sonixj
sudo modprobe gspca_sonixj

If the microphone works when used alone (with the sound recorder
application) and video works in Cheese, why would they not work
together at the same time?

I'm looking through the sonixj.c code to see if I can find where its
breaking, but I'm not very experienced in C.

I've been trying to get this worked out for a year, so if there is
anything I can do to help fix this bug let me know. This is a fairly
common webcam, so it would be great to see this resolved soon.

What is the current priority of this bug?
-- 
Thanks,
Kyle Baker
--
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: Microsoft VX-1000 Microphone Drivers Crash in x86_64

2010-07-07 Thread Jean-Francois Moine
On Wed, 7 Jul 2010 02:57:54 -0400
Kyle Baker kyleaba...@gmail.com wrote:

 If the microphone works when used alone (with the sound recorder
 application) and video works in Cheese, why would they not work
 together at the same time?
 
 I'm looking through the sonixj.c code to see if I can find where its
 breaking, but I'm not very experienced in C.
 
 I've been trying to get this worked out for a year, so if there is
 anything I can do to help fix this bug let me know. This is a fairly
 common webcam, so it would be great to see this resolved soon.
 
 What is the current priority of this bug?

The video and audio don't work at the same time because the video is
opened before the audio and it takes all the USB bandwidth.

The problem is in the main gspca.c, not in sonixj.c. It may fixed using
a lower alternate setting. To check it, you may add the following lines:

if (dev-config-desc.bNumInterfaces != 1)
gspca_dev-nbalt -= 1;
after
gspca_dev-nbalt = intf-num_altsetting;
in the function gspca_dev_probe() of gspca.c.

If it still does not work, change -= 1 to -= 2 or -= 3 (there are
8 alternate settings in your webcam).

For a correct fix, the exact video bandwidth shall be calculated and I
could not find yet time enough to do the job and people to test it...

Best regards.

-- 
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef |   http://moinejf.free.fr/
--
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: Status of the patches under review at LMML (60 patches)

2010-07-07 Thread Sven Barth

Hi!

Am 06.07.2010 15:06, schrieb Mauro Carvalho Chehab:
== Waiting for Mike Iselyis...@isely.net  review ==

 Apr,25 2010: Problem with cx25840 and Terratec Grabster AV400 
   http://patchwork.kernel.org/patch/94960


Is Mike really the maintainer of the cx25840 module and not only of the 
pvrusb2 one? If he's not the maintainer you should contact the real one, 
cause I don't think that Mike can help much regarding patches for the 
cx25840 in that case.


Also I might need to adjust the patch cause of the recent changes that 
happened there the last few months. (I don't know when I'll find time 
for this...)


Regards,
Sven
--
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 1/6] v4l: subdev: Don't require core operations

2010-07-07 Thread Laurent Pinchart
There's no reason to require subdevices to implement the core
operations. Remove the check for non-NULL core operations when
initializing the subdev.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 02c6f4d..6088316 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -437,8 +437,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
const struct v4l2_subdev_ops *ops)
 {
INIT_LIST_HEAD(sd-list);
-   /* ops-core MUST be set */
-   BUG_ON(!ops || !ops-core);
+   BUG_ON(!ops);
sd-ops = ops;
sd-v4l2_dev = NULL;
sd-flags = 0;
-- 
1.7.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


[RFC/PATCH 0/6] V4L2 subdev userspace API

2010-07-07 Thread Laurent Pinchart
Hi everybody,

Here are 6 patches that add a userspace API to the V4L2 subdevices. The API has
been developed to support the media controller and the OMAP3 ISP driver.

A few people have shown interest in the subdev userspace API already. As the
patches are not dependent on the media controller itself I'm submitting them
independently for review.

The API covers controls, events and generic ioctls. The controls and events
support reuse V4L2 ioctls, as explained in
Documentation/video4linux/v4l2-framework.txt. The subdev (and later media
controller) userspace API should probably be converted to DocBook format
eventually. The subdev API can be included in the V4L2 API document, but the
media controller should be kept separate. Comments on this will be appreciated.

While waiting for review I'll prepare the media controller core patches and
send them to the list.

Laurent Pinchart (5):
  v4l: subdev: Don't require core operations
  v4l: subdev: Add device node support
  v4l: subdev: Uninline the v4l2_subdev_init function
  v4l: subdev: Control ioctls support
  v4l: subdev: Generic ioctl support

Sakari Ailus (1):
  v4l: subdev: Events support

 Documentation/video4linux/v4l2-framework.txt |   47 +++
 drivers/media/video/Makefile |2 +-
 drivers/media/video/v4l2-common.c|3 +
 drivers/media/video/v4l2-dev.c   |5 +
 drivers/media/video/v4l2-device.c|   27 -
 drivers/media/video/v4l2-subdev.c|  172 ++
 include/media/v4l2-dev.h |3 +-
 include/media/v4l2-subdev.h  |   33 +++--
 8 files changed, 276 insertions(+), 16 deletions(-)
 create mode 100644 drivers/media/video/v4l2-subdev.c

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


[RFC/PATCH 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Laurent Pinchart
Create a device node named subdevX for every registered subdev.

As the device node is registered before the subdev core::s_config
function is called, return -EGAIN on open until initialization
completes.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
---
 drivers/media/video/Makefile  |2 +-
 drivers/media/video/v4l2-common.c |3 ++
 drivers/media/video/v4l2-dev.c|5 +++
 drivers/media/video/v4l2-device.c |   27 +++-
 drivers/media/video/v4l2-subdev.c |   65 +
 include/media/v4l2-dev.h  |3 +-
 include/media/v4l2-subdev.h   |   10 ++
 7 files changed, 112 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/video/v4l2-subdev.c

diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index cc93859..c9c07e5 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -11,7 +11,7 @@ stkwebcam-objs:=  stk-webcam.o stk-sensor.o
 omap2cam-objs  :=  omap24xxcam.o omap24xxcam-dma.o
 
 videodev-objs  :=  v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \
-   v4l2-event.o
+   v4l2-event.o v4l2-subdev.o
 
 # V4L2 core modules
 
diff --git a/drivers/media/video/v4l2-common.c 
b/drivers/media/video/v4l2-common.c
index 4e53b0b..3032aa3 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -871,6 +871,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
v4l2_device *v4l2_dev,
 
/* Register with the v4l2_device which increases the module's
   use count as well. */
+   sd-initialized = 0;
if (v4l2_device_register_subdev(v4l2_dev, sd))
sd = NULL;
/* Decrease the module use count to match the first try_module_get. */
@@ -885,6 +886,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
v4l2_device *v4l2_dev,
if (err  err != -ENOIOCTLCMD) {
v4l2_device_unregister_subdev(sd);
sd = NULL;
+   } else {
+   sd-initialized = 1;
}
}
 
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 0ca7ec9..5a9e9df 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -401,6 +401,8 @@ static int get_index(struct video_device *vdev)
  * %VFL_TYPE_VBI - Vertical blank data (undecoded)
  *
  * %VFL_TYPE_RADIO - A radio card
+ *
+ * %VFL_TYPE_SUBDEV - A subdevice
  */
 static int __video_register_device(struct video_device *vdev, int type, int nr,
int warn_if_nr_in_use)
@@ -439,6 +441,9 @@ static int __video_register_device(struct video_device 
*vdev, int type, int nr,
case VFL_TYPE_RADIO:
name_base = radio;
break;
+   case VFL_TYPE_SUBDEV:
+   name_base = subdev;
+   break;
default:
printk(KERN_ERR %s called with unknown type: %d\n,
   __func__, type);
diff --git a/drivers/media/video/v4l2-device.c 
b/drivers/media/video/v4l2-device.c
index 5a7dc4a..685fa82 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
 int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
struct v4l2_subdev *sd)
 {
+   struct video_device *vdev;
+   int ret;
+
/* Check for valid input */
if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
return -EINVAL;
+
/* Warn if we apparently re-register a subdev */
WARN_ON(sd-v4l2_dev != NULL);
+
if (!try_module_get(sd-owner))
return -ENODEV;
+
sd-v4l2_dev = v4l2_dev;
spin_lock(v4l2_dev-lock);
list_add_tail(sd-list, v4l2_dev-subdevs);
spin_unlock(v4l2_dev-lock);
-   return 0;
+
+   /* Register the device node. */
+   vdev = sd-devnode;
+   snprintf(vdev-name, sizeof(vdev-name), subdev);
+   vdev-parent = v4l2_dev-dev;
+   vdev-fops = v4l2_subdev_fops;
+   vdev-release = video_device_release_empty;
+   ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
+   if (ret  0) {
+   spin_lock(v4l2_dev-lock);
+   list_del(sd-list);
+   spin_unlock(v4l2_dev-lock);
+   sd-v4l2_dev = NULL;
+   module_put(sd-owner);
+   }
+
+   return ret;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
 
@@ -135,10 +157,13 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd)
/* return if it isn't registered */
if (sd == NULL || sd-v4l2_dev == NULL)
return;
+
spin_lock(sd-v4l2_dev-lock);
list_del(sd-list);
spin_unlock(sd-v4l2_dev-lock);
sd-v4l2_dev = 

[RFC/PATCH 3/6] v4l: subdev: Uninline the v4l2_subdev_init function

2010-07-07 Thread Laurent Pinchart
The function isn't small or performance sensitive enough to be inlined.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/v4l2-subdev.c |   14 ++
 include/media/v4l2-subdev.h   |   15 ++-
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index a048161..a3672f0 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -63,3 +63,17 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
.unlocked_ioctl = subdev_ioctl,
.release = subdev_close,
 };
+
+void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
+{
+   INIT_LIST_HEAD(sd-list);
+   BUG_ON(!ops);
+   sd-ops = ops;
+   sd-v4l2_dev = NULL;
+   sd-flags = 0;
+   sd-name[0] = '\0';
+   sd-grp_id = 0;
+   sd-priv = NULL;
+   sd-initialized = 0;
+}
+EXPORT_SYMBOL(v4l2_subdev_init);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 00010bd..7b6edcd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -442,19 +442,8 @@ static inline void *v4l2_get_subdevdata(const struct 
v4l2_subdev *sd)
return sd-priv;
 }
 
-static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
-   const struct v4l2_subdev_ops *ops)
-{
-   INIT_LIST_HEAD(sd-list);
-   BUG_ON(!ops);
-   sd-ops = ops;
-   sd-v4l2_dev = NULL;
-   sd-flags = 0;
-   sd-name[0] = '\0';
-   sd-grp_id = 0;
-   sd-priv = NULL;
-   sd-initialized = 0;
-}
+void v4l2_subdev_init(struct v4l2_subdev *sd,
+ const struct v4l2_subdev_ops *ops);
 
 /* Call an ops of a v4l2_subdev, doing the right checks against
NULL pointers.
-- 
1.7.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


[RFC/PATCH 6/6] v4l: subdev: Generic ioctl support

2010-07-07 Thread Laurent Pinchart
Instead of returning an error when receiving an ioctl call with an
unsupported command, forward the call to the subdev core::ioctl handler.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |5 +
 drivers/media/video/v4l2-subdev.c|2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 2f5162c..3a1d6b3 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -355,6 +355,11 @@ VIDIOC_UNSUBSCRIBE_EVENT
To properly support events, the poll() file operation is also
implemented.
 
+Private ioctls
+
+   All ioctls not in the above list are passed directly to the sub-device
+   driver through the core::ioctl operation.
+
 
 I2C sub-device drivers
 --
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 7191a4b..c32b2c4 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -120,7 +120,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
return v4l2_subdev_call(sd, core, unsubscribe_event, fh, arg);
 
default:
-   return -ENOIOCTLCMD;
+   return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
}
 
return 0;
-- 
1.7.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


[RFC/PATCH 4/6] v4l: subdev: Control ioctls support

2010-07-07 Thread Laurent Pinchart
Pass the control-related ioctls to the subdev driver through the core
operations.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |   24 
 drivers/media/video/v4l2-subdev.c|   24 
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index e831aac..f315858 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -314,6 +314,30 @@ controlled through GPIO pins. This distinction is only 
relevant when setting
 up the device, but once the subdev is registered it is completely transparent.
 
 
+V4L2 sub-device userspace API
+-
+
+Beside exposing a kernel API through the v4l2_subdev_ops structure, V4L2
+sub-devices can also be controlled directly by userspace applications.
+
+When a sub-device is registered, a device node named subdevX is created in 
/dev.
+The device node handles a subset of the V4L2 API.
+
+VIDIOC_QUERYCTRL
+VIDIOC_QUERYMENU
+VIDIOC_G_CTRL
+VIDIOC_S_CTRL
+VIDIOC_G_EXT_CTRLS
+VIDIOC_S_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS
+
+   The controls ioctls are identical to the ones defined in V4L2. They
+   behave identically, with the only exception that they deal only with
+   controls implemented in the sub-device. Depending on the driver, those
+   controls can be also be accessed through one (or several) V4L2 device
+   nodes.
+
+
 I2C sub-device drivers
 --
 
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index a3672f0..141098b 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -43,7 +43,31 @@ static int subdev_close(struct file *file)
 
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 {
+   struct video_device *vdev = video_devdata(file);
+   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+
switch (cmd) {
+   case VIDIOC_QUERYCTRL:
+   return v4l2_subdev_call(sd, core, queryctrl, arg);
+
+   case VIDIOC_QUERYMENU:
+   return v4l2_subdev_call(sd, core, querymenu, arg);
+
+   case VIDIOC_G_CTRL:
+   return v4l2_subdev_call(sd, core, g_ctrl, arg);
+
+   case VIDIOC_S_CTRL:
+   return v4l2_subdev_call(sd, core, s_ctrl, arg);
+
+   case VIDIOC_G_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, g_ext_ctrls, arg);
+
+   case VIDIOC_S_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, s_ext_ctrls, arg);
+
+   case VIDIOC_TRY_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
+
default:
return -ENOIOCTLCMD;
}
-- 
1.7.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


[RFC/PATCH 5/6] v4l: subdev: Events support

2010-07-07 Thread Laurent Pinchart
From: Sakari Ailus sakari.ai...@maxwell.research.nokia.com

Provide v4l2_subdevs with v4l2_event support. Subdev drivers only need very
little to support events.

Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
Signed-off-by: David Cohen david.co...@nokia.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |   18 +++
 drivers/media/video/v4l2-subdev.c|   71 +-
 include/media/v4l2-subdev.h  |9 +++
 3 files changed, 97 insertions(+), 1 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index f315858..2f5162c 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -337,6 +337,24 @@ VIDIOC_TRY_EXT_CTRLS
controls can be also be accessed through one (or several) V4L2 device
nodes.
 
+VIDIOC_DQEVENT
+VIDIOC_SUBSCRIBE_EVENT
+VIDIOC_UNSUBSCRIBE_EVENT
+
+   The events ioctls are identical to the ones defined in V4L2. They
+   behave identically, with the only exception that they deal only with
+   events generated by the sub-device. Depending on the driver, those
+   events can also be reported by one (or several) V4L2 device nodes.
+
+   Sub-device drivers that want to use events need to set the
+   V4L2_SUBDEV_USES_EVENTS v4l2_subdev::flags and initialize
+   v4l2_subdev::nevents to events queue depth before registering the
+   sub-device. After registration events can be queued as usual on the
+   v4l2_subdev::devnode device node.
+
+   To properly support events, the poll() file operation is also
+   implemented.
+
 
 I2C sub-device drivers
 --
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 141098b..7191a4b 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -18,26 +18,64 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include linux/types.h
 #include linux/ioctl.h
+#include linux/slab.h
+#include linux/types.h
 #include linux/videodev2.h
 
 #include media/v4l2-device.h
 #include media/v4l2-ioctl.h
+#include media/v4l2-fh.h
+#include media/v4l2-event.h
 
 static int subdev_open(struct file *file)
 {
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_fh *vfh;
+   int ret;
 
if (!sd-initialized)
return -EAGAIN;
 
+   vfh = kzalloc(sizeof(*vfh), GFP_KERNEL);
+   if (vfh == NULL)
+   return -ENOMEM;
+
+   ret = v4l2_fh_init(vfh, vdev);
+   if (ret)
+   goto err;
+
+   if (sd-flags  V4L2_SUBDEV_USES_EVENTS) {
+   ret = v4l2_event_init(vfh);
+   if (ret)
+   goto err;
+
+   ret = v4l2_event_alloc(vfh, sd-nevents);
+   if (ret)
+   goto err;
+   }
+
+   v4l2_fh_add(vfh);
+   file-private_data = vfh;
+
return 0;
+
+err:
+   v4l2_fh_exit(vfh);
+   kfree(vfh);
+
+   return ret;
 }
 
 static int subdev_close(struct file *file)
 {
+   struct v4l2_fh *vfh = file-private_data;
+
+   v4l2_fh_del(vfh);
+   v4l2_fh_exit(vfh);
+   kfree(vfh);
+
return 0;
 }
 
@@ -45,6 +83,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
 {
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_fh *fh = file-private_data;
 
switch (cmd) {
case VIDIOC_QUERYCTRL:
@@ -68,6 +107,18 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
case VIDIOC_TRY_EXT_CTRLS:
return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
 
+   case VIDIOC_DQEVENT:
+   if (!(sd-flags  V4L2_SUBDEV_USES_EVENTS))
+   return -ENOIOCTLCMD;
+
+   return v4l2_event_dequeue(fh, arg, file-f_flags  O_NONBLOCK);
+
+   case VIDIOC_SUBSCRIBE_EVENT:
+   return v4l2_subdev_call(sd, core, subscribe_event, fh, arg);
+
+   case VIDIOC_UNSUBSCRIBE_EVENT:
+   return v4l2_subdev_call(sd, core, unsubscribe_event, fh, arg);
+
default:
return -ENOIOCTLCMD;
}
@@ -81,11 +132,29 @@ static long subdev_ioctl(struct file *file, unsigned int 
cmd,
return video_usercopy(file, cmd, arg, subdev_do_ioctl);
 }
 
+static unsigned int subdev_poll(struct file *file, poll_table *wait)
+{
+   struct video_device *vdev = video_devdata(file);
+   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_fh *fh = file-private_data;
+
+   if (!(sd-flags  V4L2_SUBDEV_USES_EVENTS))
+   return POLLERR;
+
+   

Re: [RFC/PATCH 1/6] v4l: subdev: Don't require core operations

2010-07-07 Thread Hans Verkuil

 There's no reason to require subdevices to implement the core
 operations. Remove the check for non-NULL core operations when
 initializing the subdev.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

Reviewed-by: Hans Verkuil hverk...@xs4all.nl

Yeah, that test was a bit overkill.

Regards,

 Hans

 ---
  include/media/v4l2-subdev.h |3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)

 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index 02c6f4d..6088316 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -437,8 +437,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev
 *sd,
   const struct v4l2_subdev_ops *ops)
  {
   INIT_LIST_HEAD(sd-list);
 - /* ops-core MUST be set */
 - BUG_ON(!ops || !ops-core);
 + BUG_ON(!ops);
   sd-ops = ops;
   sd-v4l2_dev = NULL;
   sd-flags = 0;
 --
 1.7.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



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Hans Verkuil

 Create a device node named subdevX for every registered subdev.

 As the device node is registered before the subdev core::s_config
 function is called, return -EGAIN on open until initialization
 completes.

The only reason we have s_config is for old i2c drivers that need to be
supported in pre-2.6.26 kernels in the mercurial repository.

I'm thinking that we should get rid of that legacy support in the git
tree. It hurts my eyes every time I see that code.

Not a blocker for this patch series, but if others agree that we should
get rid of the legacy support then I can work on that.


 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
 ---
  drivers/media/video/Makefile  |2 +-
  drivers/media/video/v4l2-common.c |3 ++
  drivers/media/video/v4l2-dev.c|5 +++
  drivers/media/video/v4l2-device.c |   27 +++-
  drivers/media/video/v4l2-subdev.c |   65
 +
  include/media/v4l2-dev.h  |3 +-
  include/media/v4l2-subdev.h   |   10 ++
  7 files changed, 112 insertions(+), 3 deletions(-)
  create mode 100644 drivers/media/video/v4l2-subdev.c

 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index cc93859..c9c07e5 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -11,7 +11,7 @@ stkwebcam-objs  :=  stk-webcam.o stk-sensor.o
  omap2cam-objs:=  omap24xxcam.o omap24xxcam-dma.o

  videodev-objs:=  v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o 
 \
 - v4l2-event.o
 + v4l2-event.o v4l2-subdev.o

  # V4L2 core modules

 diff --git a/drivers/media/video/v4l2-common.c
 b/drivers/media/video/v4l2-common.c
 index 4e53b0b..3032aa3 100644
 --- a/drivers/media/video/v4l2-common.c
 +++ b/drivers/media/video/v4l2-common.c
 @@ -871,6 +871,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct
 v4l2_device *v4l2_dev,

   /* Register with the v4l2_device which increases the module's
  use count as well. */
 + sd-initialized = 0;
   if (v4l2_device_register_subdev(v4l2_dev, sd))
   sd = NULL;
   /* Decrease the module use count to match the first try_module_get. */
 @@ -885,6 +886,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct
 v4l2_device *v4l2_dev,
   if (err  err != -ENOIOCTLCMD) {
   v4l2_device_unregister_subdev(sd);
   sd = NULL;
 + } else {
 + sd-initialized = 1;
   }
   }

 diff --git a/drivers/media/video/v4l2-dev.c
 b/drivers/media/video/v4l2-dev.c
 index 0ca7ec9..5a9e9df 100644
 --- a/drivers/media/video/v4l2-dev.c
 +++ b/drivers/media/video/v4l2-dev.c
 @@ -401,6 +401,8 @@ static int get_index(struct video_device *vdev)
   *   %VFL_TYPE_VBI - Vertical blank data (undecoded)
   *
   *   %VFL_TYPE_RADIO - A radio card
 + *
 + *   %VFL_TYPE_SUBDEV - A subdevice
   */
  static int __video_register_device(struct video_device *vdev, int type,
 int nr,
   int warn_if_nr_in_use)
 @@ -439,6 +441,9 @@ static int __video_register_device(struct video_device
 *vdev, int type, int nr,
   case VFL_TYPE_RADIO:
   name_base = radio;
   break;
 + case VFL_TYPE_SUBDEV:
 + name_base = subdev;
 + break;
   default:
   printk(KERN_ERR %s called with unknown type: %d\n,
  __func__, type);
 diff --git a/drivers/media/video/v4l2-device.c
 b/drivers/media/video/v4l2-device.c
 index 5a7dc4a..685fa82 100644
 --- a/drivers/media/video/v4l2-device.c
 +++ b/drivers/media/video/v4l2-device.c
 @@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
  int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
   struct v4l2_subdev *sd)
  {
 + struct video_device *vdev;
 + int ret;
 +
   /* Check for valid input */
   if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
   return -EINVAL;
 +
   /* Warn if we apparently re-register a subdev */
   WARN_ON(sd-v4l2_dev != NULL);
 +
   if (!try_module_get(sd-owner))
   return -ENODEV;
 +
   sd-v4l2_dev = v4l2_dev;
   spin_lock(v4l2_dev-lock);
   list_add_tail(sd-list, v4l2_dev-subdevs);
   spin_unlock(v4l2_dev-lock);
 - return 0;
 +
 + /* Register the device node. */
 + vdev = sd-devnode;
 + snprintf(vdev-name, sizeof(vdev-name), subdev);

Hmm, perhaps we should be more creative here. For example:

snprintf(vdev-name, sizeof(vdev-name), subdev %s, sd-name);

 + vdev-parent = v4l2_dev-dev;
 + vdev-fops = v4l2_subdev_fops;
 + vdev-release = video_device_release_empty;
 + ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
 + if (ret  0) {
 + spin_lock(v4l2_dev-lock);
 + list_del(sd-list);
 +

Re: [RFC/PATCH 3/6] v4l: subdev: Uninline the v4l2_subdev_init function

2010-07-07 Thread Hans Verkuil

 The function isn't small or performance sensitive enough to be inlined.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

Reviewed-by: Hans Verkuil hverk...@xs4all.nl

Looks good!

   Hans

 ---
  drivers/media/video/v4l2-subdev.c |   14 ++
  include/media/v4l2-subdev.h   |   15 ++-
  2 files changed, 16 insertions(+), 13 deletions(-)

 diff --git a/drivers/media/video/v4l2-subdev.c
 b/drivers/media/video/v4l2-subdev.c
 index a048161..a3672f0 100644
 --- a/drivers/media/video/v4l2-subdev.c
 +++ b/drivers/media/video/v4l2-subdev.c
 @@ -63,3 +63,17 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
   .unlocked_ioctl = subdev_ioctl,
   .release = subdev_close,
  };
 +
 +void v4l2_subdev_init(struct v4l2_subdev *sd, const struct
 v4l2_subdev_ops *ops)
 +{
 + INIT_LIST_HEAD(sd-list);
 + BUG_ON(!ops);
 + sd-ops = ops;
 + sd-v4l2_dev = NULL;
 + sd-flags = 0;
 + sd-name[0] = '\0';
 + sd-grp_id = 0;
 + sd-priv = NULL;
 + sd-initialized = 0;
 +}
 +EXPORT_SYMBOL(v4l2_subdev_init);
 diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
 index 00010bd..7b6edcd 100644
 --- a/include/media/v4l2-subdev.h
 +++ b/include/media/v4l2-subdev.h
 @@ -442,19 +442,8 @@ static inline void *v4l2_get_subdevdata(const struct
 v4l2_subdev *sd)
   return sd-priv;
  }

 -static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
 - const struct v4l2_subdev_ops *ops)
 -{
 - INIT_LIST_HEAD(sd-list);
 - BUG_ON(!ops);
 - sd-ops = ops;
 - sd-v4l2_dev = NULL;
 - sd-flags = 0;
 - sd-name[0] = '\0';
 - sd-grp_id = 0;
 - sd-priv = NULL;
 - sd-initialized = 0;
 -}
 +void v4l2_subdev_init(struct v4l2_subdev *sd,
 +   const struct v4l2_subdev_ops *ops);

  /* Call an ops of a v4l2_subdev, doing the right checks against
 NULL pointers.
 --
 1.7.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



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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 4/6] v4l: subdev: Control ioctls support

2010-07-07 Thread Hans Verkuil

 Pass the control-related ioctls to the subdev driver through the core
 operations.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  Documentation/video4linux/v4l2-framework.txt |   24
 
  drivers/media/video/v4l2-subdev.c|   24
 
  2 files changed, 48 insertions(+), 0 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-framework.txt
 b/Documentation/video4linux/v4l2-framework.txt
 index e831aac..f315858 100644
 --- a/Documentation/video4linux/v4l2-framework.txt
 +++ b/Documentation/video4linux/v4l2-framework.txt
 @@ -314,6 +314,30 @@ controlled through GPIO pins. This distinction is
 only relevant when setting
  up the device, but once the subdev is registered it is completely
 transparent.


 +V4L2 sub-device userspace API
 +-
 +
 +Beside exposing a kernel API through the v4l2_subdev_ops structure, V4L2
 +sub-devices can also be controlled directly by userspace applications.
 +
 +When a sub-device is registered, a device node named subdevX is created
 in /dev.
 +The device node handles a subset of the V4L2 API.
 +
 +VIDIOC_QUERYCTRL
 +VIDIOC_QUERYMENU
 +VIDIOC_G_CTRL
 +VIDIOC_S_CTRL
 +VIDIOC_G_EXT_CTRLS
 +VIDIOC_S_EXT_CTRLS
 +VIDIOC_TRY_EXT_CTRLS
 +
 + The controls ioctls are identical to the ones defined in V4L2. They
 + behave identically, with the only exception that they deal only with
 + controls implemented in the sub-device. Depending on the driver, those
 + controls can be also be accessed through one (or several) V4L2 device
 + nodes.
 +
 +
  I2C sub-device drivers
  --

 diff --git a/drivers/media/video/v4l2-subdev.c
 b/drivers/media/video/v4l2-subdev.c
 index a3672f0..141098b 100644
 --- a/drivers/media/video/v4l2-subdev.c
 +++ b/drivers/media/video/v4l2-subdev.c
 @@ -43,7 +43,31 @@ static int subdev_close(struct file *file)

  static long subdev_do_ioctl(struct file *file, unsigned int cmd, void
 *arg)
  {
 + struct video_device *vdev = video_devdata(file);
 + struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 +
   switch (cmd) {
 + case VIDIOC_QUERYCTRL:
 + return v4l2_subdev_call(sd, core, queryctrl, arg);
 +
 + case VIDIOC_QUERYMENU:
 + return v4l2_subdev_call(sd, core, querymenu, arg);
 +
 + case VIDIOC_G_CTRL:
 + return v4l2_subdev_call(sd, core, g_ctrl, arg);
 +
 + case VIDIOC_S_CTRL:
 + return v4l2_subdev_call(sd, core, s_ctrl, arg);
 +
 + case VIDIOC_G_EXT_CTRLS:
 + return v4l2_subdev_call(sd, core, g_ext_ctrls, arg);
 +
 + case VIDIOC_S_EXT_CTRLS:
 + return v4l2_subdev_call(sd, core, s_ext_ctrls, arg);
 +
 + case VIDIOC_TRY_EXT_CTRLS:
 + return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
 +
   default:
   return -ENOIOCTLCMD;
   }
 --
 1.7.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


This should simplify substantially once the control framework is in place.

IMHO the control framework should go in first, then this code, updated for
the control framework.

Reviewed-by: Hans Verkuil hverk...@xs4all.nl

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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 4/6] v4l: subdev: Control ioctls support

2010-07-07 Thread Laurent Pinchart
Hi Hans,

Thanks for the quick review.

On Wednesday 07 July 2010 14:33:52 Hans Verkuil wrote:
  Pass the control-related ioctls to the subdev driver through the core
  operations.
  
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

[snip]

 This should simplify substantially once the control framework is in place.

Definitely.

 IMHO the control framework should go in first, then this code, updated for
 the control framework.

I'm fine with either way.

-- 
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: [RFC/PATCH 5/6] v4l: subdev: Events support

2010-07-07 Thread Hans Verkuil

 From: Sakari Ailus sakari.ai...@maxwell.research.nokia.com

 Provide v4l2_subdevs with v4l2_event support. Subdev drivers only need
 very
 little to support events.

 Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
 Signed-off-by: David Cohen david.co...@nokia.com
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  Documentation/video4linux/v4l2-framework.txt |   18 +++
  drivers/media/video/v4l2-subdev.c|   71
 +-
  include/media/v4l2-subdev.h  |9 +++
  3 files changed, 97 insertions(+), 1 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-framework.txt
 b/Documentation/video4linux/v4l2-framework.txt
 index f315858..2f5162c 100644
 --- a/Documentation/video4linux/v4l2-framework.txt
 +++ b/Documentation/video4linux/v4l2-framework.txt
 @@ -337,6 +337,24 @@ VIDIOC_TRY_EXT_CTRLS
   controls can be also be accessed through one (or several) V4L2 device
   nodes.

 +VIDIOC_DQEVENT
 +VIDIOC_SUBSCRIBE_EVENT
 +VIDIOC_UNSUBSCRIBE_EVENT
 +
 + The events ioctls are identical to the ones defined in V4L2. They
 + behave identically, with the only exception that they deal only with
 + events generated by the sub-device. Depending on the driver, those
 + events can also be reported by one (or several) V4L2 device nodes.
 +
 + Sub-device drivers that want to use events need to set the
 + V4L2_SUBDEV_USES_EVENTS v4l2_subdev::flags and initialize
 + v4l2_subdev::nevents to events queue depth before registering the
 + sub-device. After registration events can be queued as usual on the
 + v4l2_subdev::devnode device node.
 +
 + To properly support events, the poll() file operation is also
 + implemented.
 +

  I2C sub-device drivers
  --
 diff --git a/drivers/media/video/v4l2-subdev.c
 b/drivers/media/video/v4l2-subdev.c
 index 141098b..7191a4b 100644
 --- a/drivers/media/video/v4l2-subdev.c
 +++ b/drivers/media/video/v4l2-subdev.c
 @@ -18,26 +18,64 @@
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 USA
   */

 -#include linux/types.h
  #include linux/ioctl.h
 +#include linux/slab.h
 +#include linux/types.h
  #include linux/videodev2.h

  #include media/v4l2-device.h
  #include media/v4l2-ioctl.h
 +#include media/v4l2-fh.h
 +#include media/v4l2-event.h

  static int subdev_open(struct file *file)
  {
   struct video_device *vdev = video_devdata(file);
   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 + struct v4l2_fh *vfh;
 + int ret;

   if (!sd-initialized)
   return -EAGAIN;

 + vfh = kzalloc(sizeof(*vfh), GFP_KERNEL);
 + if (vfh == NULL)
 + return -ENOMEM;
 +
 + ret = v4l2_fh_init(vfh, vdev);
 + if (ret)
 + goto err;
 +
 + if (sd-flags  V4L2_SUBDEV_USES_EVENTS) {
 + ret = v4l2_event_init(vfh);
 + if (ret)
 + goto err;
 +
 + ret = v4l2_event_alloc(vfh, sd-nevents);
 + if (ret)
 + goto err;
 + }
 +
 + v4l2_fh_add(vfh);
 + file-private_data = vfh;
 +
   return 0;
 +
 +err:
 + v4l2_fh_exit(vfh);
 + kfree(vfh);
 +
 + return ret;
  }

  static int subdev_close(struct file *file)
  {
 + struct v4l2_fh *vfh = file-private_data;
 +
 + v4l2_fh_del(vfh);
 + v4l2_fh_exit(vfh);
 + kfree(vfh);
 +
   return 0;
  }

 @@ -45,6 +83,7 @@ static long subdev_do_ioctl(struct file *file, unsigned
 int cmd, void *arg)
  {
   struct video_device *vdev = video_devdata(file);
   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 + struct v4l2_fh *fh = file-private_data;

   switch (cmd) {
   case VIDIOC_QUERYCTRL:
 @@ -68,6 +107,18 @@ static long subdev_do_ioctl(struct file *file,
 unsigned int cmd, void *arg)
   case VIDIOC_TRY_EXT_CTRLS:
   return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);

 + case VIDIOC_DQEVENT:
 + if (!(sd-flags  V4L2_SUBDEV_USES_EVENTS))
 + return -ENOIOCTLCMD;
 +
 + return v4l2_event_dequeue(fh, arg, file-f_flags  O_NONBLOCK);
 +
 + case VIDIOC_SUBSCRIBE_EVENT:
 + return v4l2_subdev_call(sd, core, subscribe_event, fh, arg);
 +
 + case VIDIOC_UNSUBSCRIBE_EVENT:
 + return v4l2_subdev_call(sd, core, unsubscribe_event, fh, arg);
 +
   default:
   return -ENOIOCTLCMD;
   }
 @@ -81,11 +132,29 @@ static long subdev_ioctl(struct file *file, unsigned
 int cmd,
   return video_usercopy(file, cmd, arg, subdev_do_ioctl);
  }

 +static unsigned int subdev_poll(struct file *file, poll_table *wait)
 +{
 + struct video_device *vdev = video_devdata(file);
 + struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 + struct v4l2_fh *fh = file-private_data;
 +
 + if (!(sd-flags  V4L2_SUBDEV_USES_EVENTS))
 + return POLLERR;
 +
 + poll_wait(file, 

Re: [RFC/PATCH 6/6] v4l: subdev: Generic ioctl support

2010-07-07 Thread Hans Verkuil

 Instead of returning an error when receiving an ioctl call with an
 unsupported command, forward the call to the subdev core::ioctl handler.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  Documentation/video4linux/v4l2-framework.txt |5 +
  drivers/media/video/v4l2-subdev.c|2 +-
  2 files changed, 6 insertions(+), 1 deletions(-)

 diff --git a/Documentation/video4linux/v4l2-framework.txt
 b/Documentation/video4linux/v4l2-framework.txt
 index 2f5162c..3a1d6b3 100644
 --- a/Documentation/video4linux/v4l2-framework.txt
 +++ b/Documentation/video4linux/v4l2-framework.txt
 @@ -355,6 +355,11 @@ VIDIOC_UNSUBSCRIBE_EVENT
   To properly support events, the poll() file operation is also
   implemented.

 +Private ioctls
 +
 + All ioctls not in the above list are passed directly to the sub-device
 + driver through the core::ioctl operation.
 +

  I2C sub-device drivers
  --
 diff --git a/drivers/media/video/v4l2-subdev.c
 b/drivers/media/video/v4l2-subdev.c
 index 7191a4b..c32b2c4 100644
 --- a/drivers/media/video/v4l2-subdev.c
 +++ b/drivers/media/video/v4l2-subdev.c
 @@ -120,7 +120,7 @@ static long subdev_do_ioctl(struct file *file,
 unsigned int cmd, void *arg)
   return v4l2_subdev_call(sd, core, unsubscribe_event, fh, arg);

   default:
 - return -ENOIOCTLCMD;
 + return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
   }

   return 0;
 --
 1.7.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


Reviewed-by: Hans Verkuil hverk...@xs4all.nl

Nice to see how everything fits together :-)

Regards,

Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Hans Verkuil

 Create a device node named subdevX for every registered subdev.

 As the device node is registered before the subdev core::s_config
 function is called, return -EGAIN on open until initialization
 completes.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
 ---
  drivers/media/video/Makefile  |2 +-
  drivers/media/video/v4l2-common.c |3 ++
  drivers/media/video/v4l2-dev.c|5 +++
  drivers/media/video/v4l2-device.c |   27 +++-
  drivers/media/video/v4l2-subdev.c |   65
 +
  include/media/v4l2-dev.h  |3 +-
  include/media/v4l2-subdev.h   |   10 ++
  7 files changed, 112 insertions(+), 3 deletions(-)

...

 diff --git a/drivers/media/video/v4l2-device.c
 b/drivers/media/video/v4l2-device.c
 index 5a7dc4a..685fa82 100644
 --- a/drivers/media/video/v4l2-device.c
 +++ b/drivers/media/video/v4l2-device.c
 @@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
  int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
   struct v4l2_subdev *sd)
  {
 + struct video_device *vdev;
 + int ret;
 +
   /* Check for valid input */
   if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
   return -EINVAL;
 +
   /* Warn if we apparently re-register a subdev */
   WARN_ON(sd-v4l2_dev != NULL);
 +
   if (!try_module_get(sd-owner))
   return -ENODEV;
 +
   sd-v4l2_dev = v4l2_dev;
   spin_lock(v4l2_dev-lock);
   list_add_tail(sd-list, v4l2_dev-subdevs);
   spin_unlock(v4l2_dev-lock);
 - return 0;
 +
 + /* Register the device node. */
 + vdev = sd-devnode;
 + snprintf(vdev-name, sizeof(vdev-name), subdev);
 + vdev-parent = v4l2_dev-dev;
 + vdev-fops = v4l2_subdev_fops;
 + vdev-release = video_device_release_empty;
 + ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
 + if (ret  0) {
 + spin_lock(v4l2_dev-lock);
 + list_del(sd-list);
 + spin_unlock(v4l2_dev-lock);
 + sd-v4l2_dev = NULL;
 + module_put(sd-owner);
 + }
 +
 + return ret;
  }
  EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);


I'm missing one thing here: in this code the subdev device node is always
registered. But for most subdev drivers there is no need for a device
node. This should really be explicitly turned on by the subdev driver
itself.

Regards,

   Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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: Status of the patches under review (85 patches) and some misc notes about the devel procedures

2010-07-07 Thread Bjørn Mork
Mauro Carvalho Chehab mche...@redhat.com writes:
 Em 01-07-2010 08:46, Bjørn Mork escreveu:
 Any chance of a new status update anytime soon?  

 Updated today, after two or three weeks spent to handle the backlog.

Great!  Thanks.  It's really appreciated, and I do note that it made
quite a few people finally ack/nak the patches they were supposed to
review. 

 I'm particularily
 interested in getting a forced status change on any patch which was
 under review at the time of the last status message.  I believe it's
 reasonable to expect two months review to be more than enough.  If
 the patches are found unacceptable, then it's much better to have them
 rejected with a please fix foo and resubmit than the current total
 silence called review.

 The patches marked as under review means that I'm expecting an action
 from someone else (the patch author or the driver author/maintainer).

Well, I'm of course not in a position to tell you how to do your job, so
please regard this as a humble suggestion only...

But I believe you make your job much harder by defining a number of
unofficial driver maintainers and giving them indefinite slack, while
at the same time *you* are the one having to keep track of all their
outstanding patches.  Either you delegate the maintainance properly,
documenting it in MAINTAINERS and pointing there whenever someone sends
a patch directly to you, or you might as well just do the ack/nak
yourself based on the mailing list feedback.

Putting yourself in the middle, taking the patch queue responsibility,
but not the ack/nak responsibility, is just wasting your time on
accounting and other boring work...

I do believe that having the original author(s) maintain a driver is a
very good idea as long as they are still actively maintaining it.  But
this must be based on actual maintainance, and not some misunderstood
ownership based on previous contributions.  That's what the CREDITS
file is for.

Please look at other subsystems with a large number of old drivers, like
e.g. networking.  It's not like it's possible to have every tiny patch
approved by the original author all the time.  This does not hinder some
newer drivers having very active official maintainers, like the Intel
e1000(e) drivers, nor does it hinder the original authors from
participating on the mailing list giving their comments and ack/nak if
they want.  But if they don't respond on the list, davem will just make
a decision for himself without waiting for it.

 So, if you have patches there still under review, you're helping us 
 if you direct your complains to the one that it is sitting on the top
 of them.

Oh, it's not so much my submissions bothering me (I have received some
very good feedback on this list), but the fact that some drivers do not
get any updates at all, even though patches are submitted to this
mailing list.  Not to mention the problem that patch submissions will
(and do) stop due to the lack of any feedback whatsoever.  Most people
have better things to do than writing to /dev/null, and that's the
feeling this queuing-for-original-author-review system leaves.


Bjørn

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


MEDIA: lirc, improper locking

2010-07-07 Thread Jiri Slaby
Hi,

stanse found a locking error in lirc_dev_fop_read:
if (mutex_lock_interruptible(ir-irctl_lock))
  return -ERESTARTSYS;
...
while (written  length  ret == 0) {
  if (mutex_lock_interruptible(ir-irctl_lock)) {#1
ret = -ERESTARTSYS;
break;
  }
  ...
}

remove_wait_queue(ir-buf-wait_poll, wait);
set_current_state(TASK_RUNNING);
mutex_unlock(ir-irctl_lock);#2

If lock at #1 fails, it beaks out of the loop, with the lock unlocked,
but there is another unlock at #2.

regards,
-- 
js
--
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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Laurent Pinchart
Hi Hans,

Thanks for the quick review.

On Wednesday 07 July 2010 14:30:45 Hans Verkuil wrote:
  Create a device node named subdevX for every registered subdev.
  
  As the device node is registered before the subdev core::s_config
  function is called, return -EGAIN on open until initialization
  completes.
 
 The only reason we have s_config is for old i2c drivers that need to be
 supported in pre-2.6.26 kernels in the mercurial repository.
 
 I'm thinking that we should get rid of that legacy support in the git
 tree. It hurts my eyes every time I see that code.
 
 Not a blocker for this patch series, but if others agree that we should
 get rid of the legacy support then I can work on that.

Some (most ?) I2C sensors need to be accessed during probe. This involves 
powering the sensor up, which is handled by a board code function called 
through a platform data function pointer.

On the OMAP3 ISP the sensor clock can be generated by the ISP. This means that 
board code needs to call an ISP (exported) function to turn the clock on. To 
do so we currently retrieve a pointer to the ISP device through the subdev's 
parent v4l2_device, embedded in the ISP device structure. This requires the 
subdev to be registered, otherwise its parent will be NULL. For that reason 
we're still using the core::s_config operation.

This is obviously not an ideal situation, and I'm open to suggestions on how 
to solve it without core::s_config. One possibility would be to use a global 
ISP device pointer in the board code, as there's only one ISP device in the 
system. It feels a bit hackish though.

[snip]

  diff --git a/drivers/media/video/v4l2-device.c
  b/drivers/media/video/v4l2-device.c
  index 5a7dc4a..685fa82 100644
  --- a/drivers/media/video/v4l2-device.c
  +++ b/drivers/media/video/v4l2-device.c

[snip]

  @@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
  
   int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
   
  struct v4l2_subdev *sd)
   
   {
  
  +   struct video_device *vdev;
  +   int ret;
  +
  /* Check for valid input */
  if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
  return -EINVAL;
  +
  /* Warn if we apparently re-register a subdev */
  WARN_ON(sd-v4l2_dev != NULL);
  +
  if (!try_module_get(sd-owner))
  return -ENODEV;
  +
  sd-v4l2_dev = v4l2_dev;
  spin_lock(v4l2_dev-lock);
  list_add_tail(sd-list, v4l2_dev-subdevs);
  spin_unlock(v4l2_dev-lock);
  
  -   return 0;
  +
  +   /* Register the device node. */
  +   vdev = sd-devnode;
  +   snprintf(vdev-name, sizeof(vdev-name), subdev);
 
 Hmm, perhaps we should be more creative here. For example:
 
 snprintf(vdev-name, sizeof(vdev-name), subdev %s, sd-name);

I'm definitely open to alternative name suggestions. For instance, I'm not 
sure to be happy with /dev/subdevX. /dev/v4l2-subdevX might be better.

As for vdev-name, your suggestion sounds good.

  +   vdev-parent = v4l2_dev-dev;
  +   vdev-fops = v4l2_subdev_fops;
  +   vdev-release = video_device_release_empty;
  +   ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
  +   if (ret  0) {
  +   spin_lock(v4l2_dev-lock);
  +   list_del(sd-list);
  +   spin_unlock(v4l2_dev-lock);
  +   sd-v4l2_dev = NULL;
  +   module_put(sd-owner);
 
 You can just call v4l2_device_unregister_subdev(sd) here. The call
 to video_unregister_device will know that the registration failed and will
 just return.

Good point, thanks.

  +   }
  +
  +   return ret;
  
   }
   EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
  

[snip]

  diff --git a/drivers/media/video/v4l2-subdev.c
  b/drivers/media/video/v4l2-subdev.c
  new file mode 100644
  index 000..a048161
  --- /dev/null
  +++ b/drivers/media/video/v4l2-subdev.c
  @@ -0,0 +1,65 @@
  +/*
  + *  V4L2 subdevice support.
  + *
  + *  Copyright (C) 2009  Laurent Pinchart
 
 2009 - 2010
 
 Might be wrong elsewhere as well.

I'll fix that.

-- 
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: [RFC/PATCH 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Hans Verkuil

 Hi Hans,

 Thanks for the quick review.

 On Wednesday 07 July 2010 14:30:45 Hans Verkuil wrote:
  Create a device node named subdevX for every registered subdev.
 
  As the device node is registered before the subdev core::s_config
  function is called, return -EGAIN on open until initialization
  completes.

 The only reason we have s_config is for old i2c drivers that need to be
 supported in pre-2.6.26 kernels in the mercurial repository.

 I'm thinking that we should get rid of that legacy support in the git
 tree. It hurts my eyes every time I see that code.

 Not a blocker for this patch series, but if others agree that we should
 get rid of the legacy support then I can work on that.

 Some (most ?) I2C sensors need to be accessed during probe. This involves
 powering the sensor up, which is handled by a board code function called
 through a platform data function pointer.

 On the OMAP3 ISP the sensor clock can be generated by the ISP. This means
 that
 board code needs to call an ISP (exported) function to turn the clock on.
 To
 do so we currently retrieve a pointer to the ISP device through the
 subdev's
 parent v4l2_device, embedded in the ISP device structure. This requires
 the
 subdev to be registered, otherwise its parent will be NULL. For that
 reason
 we're still using the core::s_config operation.

 This is obviously not an ideal situation, and I'm open to suggestions on
 how
 to solve it without core::s_config. One possibility would be to use a
 global
 ISP device pointer in the board code, as there's only one ISP device in
 the
 system. It feels a bit hackish though.

Or make the v4l2_device pointer part of the platform data? That way the
subdev driver has access to the v4l2_device pointer in a fairly clean
manner.


 [snip]

  diff --git a/drivers/media/video/v4l2-device.c
  b/drivers/media/video/v4l2-device.c
  index 5a7dc4a..685fa82 100644
  --- a/drivers/media/video/v4l2-device.c
  +++ b/drivers/media/video/v4l2-device.c

 [snip]

  @@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
 
   int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
 
 struct v4l2_subdev *sd)
 
   {
 
  +  struct video_device *vdev;
  +  int ret;
  +
 /* Check for valid input */
 if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
 return -EINVAL;
  +
 /* Warn if we apparently re-register a subdev */
 WARN_ON(sd-v4l2_dev != NULL);
  +
 if (!try_module_get(sd-owner))
 return -ENODEV;
  +
 sd-v4l2_dev = v4l2_dev;
 spin_lock(v4l2_dev-lock);
 list_add_tail(sd-list, v4l2_dev-subdevs);
 spin_unlock(v4l2_dev-lock);
 
  -  return 0;
  +
  +  /* Register the device node. */
  +  vdev = sd-devnode;
  +  snprintf(vdev-name, sizeof(vdev-name), subdev);

 Hmm, perhaps we should be more creative here. For example:

 snprintf(vdev-name, sizeof(vdev-name), subdev %s, sd-name);

 I'm definitely open to alternative name suggestions. For instance, I'm not
 sure to be happy with /dev/subdevX. /dev/v4l2-subdevX might be better.

I think I would go with v4l-subdevX. I agree, that's better than the
overly generic 'subdevX'.


 As for vdev-name, your suggestion sounds good.

  +  vdev-parent = v4l2_dev-dev;
  +  vdev-fops = v4l2_subdev_fops;
  +  vdev-release = video_device_release_empty;
  +  ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
  +  if (ret  0) {
  +  spin_lock(v4l2_dev-lock);
  +  list_del(sd-list);
  +  spin_unlock(v4l2_dev-lock);
  +  sd-v4l2_dev = NULL;
  +  module_put(sd-owner);

 You can just call v4l2_device_unregister_subdev(sd) here. The call
 to video_unregister_device will know that the registration failed and
 will
 just return.

 Good point, thanks.

  +  }
  +
  +  return ret;
 
   }
   EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
 

 [snip]

  diff --git a/drivers/media/video/v4l2-subdev.c
  b/drivers/media/video/v4l2-subdev.c
  new file mode 100644
  index 000..a048161
  --- /dev/null
  +++ b/drivers/media/video/v4l2-subdev.c
  @@ -0,0 +1,65 @@
  +/*
  + *  V4L2 subdevice support.
  + *
  + *  Copyright (C) 2009  Laurent Pinchart

 2009 - 2010

 Might be wrong elsewhere as well.

 I'll fix that.

 --
 Regards,

 Laurent Pinchart


Regards,

Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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: Some issues with imon input driver

2010-07-07 Thread Jarod Wilson
On Wed, Jul 07, 2010 at 05:36:45AM +0300, Anssi Hannula wrote:
 Hi!
 
 I tried to set up my imon remote, but run into the issue of buttons getting 
 easily stuck. And while looking at the code, I noticed some more issues :)

I'm not entirely surprised, I knew there were a few quirks left I'd not
yet fully sorted out. Generally, it works quite well, but I didn't abuse
the receiver quite as thoroughly as you. ;)

Can I talk you into filing a bug to track this? I can probably work up
fixes for a number of these sooner or later, if you don't beat me to them,
but it'd be easy for one or more of the specific problems to slip through
the cracks if not logged somewhere. My From: address here matches my
b.k.o. account, if you want to assign said bug to me.

Ah, and because we're actually handing remote controls via
drivers/media/IR/, you should cc linux-media as well (if not instead of
linux-input) on anything regarding this driver.

Thanks much,

--jarod


 So here they all are (on 2.6.35-rc4):
 
 - There is no fallback timer if a release code is missed (i.e. remote pointed 
 away from receiver or some other anomaly), causing a key stuck on autorepeat. 
 The driver should inject a release code itself if there is no release/repeat 
 code in 500ms after initial press or in 120ms after a repeat code.
 
 - No release code is sent for 0x02XX keys if pressing any other button 
 before release, examples:
 
 example 1:
 hold '5', then press 'Play' once, then release '5'
 The 'Play' codes are relayed properly, but the release code for '5' (the 'all 
 0x02XX keys released' (i.e. empty HID input report) which the hardware 
 does send properly) is wrongly interpreted as a release code for 'Play'.
 The driver should either release '5' when the empty report is received, or, 
 as 
 this is just a remote control, just inject a release code for '5' when 'Play' 
 is pressed.
 
 example 2:
 hold '5', then hold '4', then release '5', then release '4'
 As the 0x02XX range is not completely released until after '4' is 
 released, the zeroed bitfield is not sent until after '4', and the driver 
 doesn't release '5' at this point anymore. The driver should've injected a 
 release code for '5' when '4' was pressed.
 
 - imon_mce_timeout() timer function seems to access ictx-last_keycode 
 without 
 locking
 
 - imon_parse_press_type() tests for ictx-release_code which is in an 
 undefined state if ktype isn't IMON_KEY_IMON
 
 - when the dpad is in keyboard mode and you hold it down to one direction, 
 instead of autorepeat there is a constant stream of release/press events
 
 
 I may get around to fix these (if I find time and an MCE remote for testing), 
 but that won't probably happen soon, thus I'm reporting these here if someone 
 else wants to fix them.

-- 
Jarod Wilson
ja...@redhat.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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Laurent Pinchart
Hi Hans,

On Wednesday 07 July 2010 14:43:08 Hans Verkuil wrote:
  Create a device node named subdevX for every registered subdev.
  
  As the device node is registered before the subdev core::s_config
  function is called, return -EGAIN on open until initialization
  completes.

[snip]

 I'm missing one thing here: in this code the subdev device node is always
 registered. But for most subdev drivers there is no need for a device
 node. This should really be explicitly turned on by the subdev driver
 itself.

I'll fix that with a subdev flag.

-- 
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: [RFC/PATCH 1/6] v4l: subdev: Don't require core operations

2010-07-07 Thread Karicheri, Muralidharan
Laurent,

This is a good fix. For example, soc based sub devices may not
have core ops implemented. 

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
email: m-kariche...@ti.com

-Original Message-
From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
ow...@vger.kernel.org] On Behalf Of Laurent Pinchart
Sent: Wednesday, July 07, 2010 7:53 AM
To: linux-media@vger.kernel.org
Cc: sakari.ai...@maxwell.research.nokia.com
Subject: [RFC/PATCH 1/6] v4l: subdev: Don't require core operations

There's no reason to require subdevices to implement the core
operations. Remove the check for non-NULL core operations when
initializing the subdev.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 02c6f4d..6088316 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -437,8 +437,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev
*sd,
   const struct v4l2_subdev_ops *ops)
 {
   INIT_LIST_HEAD(sd-list);
-  /* ops-core MUST be set */
-  BUG_ON(!ops || !ops-core);
+  BUG_ON(!ops);
   sd-ops = ops;
   sd-v4l2_dev = NULL;
   sd-flags = 0;
--
1.7.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
--
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: MEDIA: lirc, improper locking

2010-07-07 Thread Jarod Wilson
On Wed, Jul 07, 2010 at 02:52:58PM +0200, Jiri Slaby wrote:
 Hi,
 
 stanse found a locking error in lirc_dev_fop_read:
 if (mutex_lock_interruptible(ir-irctl_lock))
   return -ERESTARTSYS;
 ...
 while (written  length  ret == 0) {
   if (mutex_lock_interruptible(ir-irctl_lock)) {#1
 ret = -ERESTARTSYS;
 break;
   }
   ...
 }
 
 remove_wait_queue(ir-buf-wait_poll, wait);
 set_current_state(TASK_RUNNING);
 mutex_unlock(ir-irctl_lock);#2
 
 If lock at #1 fails, it beaks out of the loop, with the lock unlocked,
 but there is another unlock at #2.

Yeah, ok, I see the problem there, should be able to get a patch to fix it
in flight later today.

Thanks much,

-- 
Jarod Wilson
ja...@redhat.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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Karicheri, Muralidharan


v4l2_device *v4l2_dev,
   if (err  err != -ENOIOCTLCMD) {
   v4l2_device_unregister_subdev(sd);
   sd = NULL;
+  } else {
+  sd-initialized = 1;
   }

Wouldn't checkpatch.pl script complain about { } on the else part since
there is only one statement?  
   }



--
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] IR/lirc_dev: fix locking in lirc_dev_fop_read

2010-07-07 Thread Jarod Wilson
On Wed, Jul 07, 2010 at 02:52:58PM +0200, Jiri Slaby wrote:
 Hi,
 
 stanse found a locking error in lirc_dev_fop_read:
 if (mutex_lock_interruptible(ir-irctl_lock))
   return -ERESTARTSYS;
 ...
 while (written  length  ret == 0) {
   if (mutex_lock_interruptible(ir-irctl_lock)) {#1
 ret = -ERESTARTSYS;
 break;
   }
   ...
 }
 
 remove_wait_queue(ir-buf-wait_poll, wait);
 set_current_state(TASK_RUNNING);
 mutex_unlock(ir-irctl_lock);#2
 
 If lock at #1 fails, it beaks out of the loop, with the lock unlocked,
 but there is another unlock at #2.

This should do the trick. Completely untested beyond compiling, but its
not exactly a complicated fix, and in practice, I'm not aware of anyone
ever actually tripping that locking bug, so there's zero functional change
in typical use here.

Signed-off-by: Jarod Wilson ja...@redhat.com
---
 drivers/media/IR/lirc_dev.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c
index 9e141d5..64170fa 100644
--- a/drivers/media/IR/lirc_dev.c
+++ b/drivers/media/IR/lirc_dev.c
@@ -657,7 +657,9 @@ ssize_t lirc_dev_fop_read(struct file *file,
 
if (mutex_lock_interruptible(ir-irctl_lock)) {
ret = -ERESTARTSYS;
-   break;
+   remove_wait_queue(ir-buf-wait_poll, wait);
+   set_current_state(TASK_RUNNING);
+   goto out_unlocked;
}
 
if (!ir-attached) {
@@ -676,6 +678,7 @@ ssize_t lirc_dev_fop_read(struct file *file,
set_current_state(TASK_RUNNING);
mutex_unlock(ir-irctl_lock);
 
+out_unlocked:
dev_dbg(ir-d.dev, LOGHEAD read result = %s (%d)\n,
ir-d.name, ir-d.minor, ret ? -EFAULT : OK, ret);
 

-- 
Jarod Wilson
ja...@redhat.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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Sylwester Nawrocki

Isn't it like there need to be {} for both if and else when
there is more than one line in either block?

Regards,
--
Sylwester Nawrocki

 -Original Message-
 From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
 ow...@vger.kernel.org] On Behalf Of Karicheri, Muralidharan
 Sent: Wednesday, July 07, 2010 4:15 PM
 To: Laurent Pinchart; linux-media@vger.kernel.org
 Cc: sakari.ai...@maxwell.research.nokia.com
 Subject: RE: [RFC/PATCH 2/6] v4l: subdev: Add device node support
 
 
 
 v4l2_device *v4l2_dev,
  if (err  err != -ENOIOCTLCMD) {
  v4l2_device_unregister_subdev(sd);
  sd = NULL;
 +} else {
 +sd-initialized = 1;
  }
 
 Wouldn't checkpatch.pl script complain about { } on the else part since
 there is only one statement?
  }
 
 
 
 --
 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


--
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 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Mauro Carvalho Chehab
Em 07-07-2010 08:53, Laurent Pinchart escreveu:
 Create a device node named subdevX for every registered subdev.
 As the device node is registered before the subdev core::s_config
 function is called, return -EGAIN on open until initialization
 completes.
 
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
 ---
  drivers/media/video/Makefile  |2 +-
  drivers/media/video/v4l2-common.c |3 ++
  drivers/media/video/v4l2-dev.c|5 +++
  drivers/media/video/v4l2-device.c |   27 +++-
  drivers/media/video/v4l2-subdev.c |   65 
 +
  include/media/v4l2-dev.h  |3 +-
  include/media/v4l2-subdev.h   |   10 ++
  7 files changed, 112 insertions(+), 3 deletions(-)
  create mode 100644 drivers/media/video/v4l2-subdev.c
 
 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index cc93859..c9c07e5 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -11,7 +11,7 @@ stkwebcam-objs  :=  stk-webcam.o stk-sensor.o
  omap2cam-objs:=  omap24xxcam.o omap24xxcam-dma.o
  
  videodev-objs:=  v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o 
 \
 - v4l2-event.o
 + v4l2-event.o v4l2-subdev.o
  
  # V4L2 core modules
  
 diff --git a/drivers/media/video/v4l2-common.c 
 b/drivers/media/video/v4l2-common.c
 index 4e53b0b..3032aa3 100644
 --- a/drivers/media/video/v4l2-common.c
 +++ b/drivers/media/video/v4l2-common.c
 @@ -871,6 +871,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
 v4l2_device *v4l2_dev,
  
   /* Register with the v4l2_device which increases the module's
  use count as well. */
 + sd-initialized = 0;
   if (v4l2_device_register_subdev(v4l2_dev, sd))
   sd = NULL;
   /* Decrease the module use count to match the first try_module_get. */
 @@ -885,6 +886,8 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct 
 v4l2_device *v4l2_dev,
   if (err  err != -ENOIOCTLCMD) {
   v4l2_device_unregister_subdev(sd);
   sd = NULL;
 + } else {
 + sd-initialized = 1;
   }
   }
  
 diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
 index 0ca7ec9..5a9e9df 100644
 --- a/drivers/media/video/v4l2-dev.c
 +++ b/drivers/media/video/v4l2-dev.c
 @@ -401,6 +401,8 @@ static int get_index(struct video_device *vdev)
   *   %VFL_TYPE_VBI - Vertical blank data (undecoded)
   *
   *   %VFL_TYPE_RADIO - A radio card
 + *
 + *   %VFL_TYPE_SUBDEV - A subdevice
   */
  static int __video_register_device(struct video_device *vdev, int type, int 
 nr,
   int warn_if_nr_in_use)
 @@ -439,6 +441,9 @@ static int __video_register_device(struct video_device 
 *vdev, int type, int nr,
   case VFL_TYPE_RADIO:
   name_base = radio;
   break;
 + case VFL_TYPE_SUBDEV:
 + name_base = subdev;
 + break;
   default:
   printk(KERN_ERR %s called with unknown type: %d\n,
  __func__, type);
 diff --git a/drivers/media/video/v4l2-device.c 
 b/drivers/media/video/v4l2-device.c
 index 5a7dc4a..685fa82 100644
 --- a/drivers/media/video/v4l2-device.c
 +++ b/drivers/media/video/v4l2-device.c
 @@ -115,18 +115,40 @@ EXPORT_SYMBOL_GPL(v4l2_device_unregister);
  int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
   struct v4l2_subdev *sd)
  {
 + struct video_device *vdev;
 + int ret;
 +
   /* Check for valid input */
   if (v4l2_dev == NULL || sd == NULL || !sd-name[0])
   return -EINVAL;
 +
   /* Warn if we apparently re-register a subdev */
   WARN_ON(sd-v4l2_dev != NULL);
 +
   if (!try_module_get(sd-owner))
   return -ENODEV;
 +
   sd-v4l2_dev = v4l2_dev;
   spin_lock(v4l2_dev-lock);
   list_add_tail(sd-list, v4l2_dev-subdevs);
   spin_unlock(v4l2_dev-lock);
 - return 0;
 +
 + /* Register the device node. */
 + vdev = sd-devnode;
 + snprintf(vdev-name, sizeof(vdev-name), subdev);
 + vdev-parent = v4l2_dev-dev;
 + vdev-fops = v4l2_subdev_fops;
 + vdev-release = video_device_release_empty;
 + ret = video_register_device(vdev, VFL_TYPE_SUBDEV, -1);
 + if (ret  0) {
 + spin_lock(v4l2_dev-lock);
 + list_del(sd-list);
 + spin_unlock(v4l2_dev-lock);
 + sd-v4l2_dev = NULL;
 + module_put(sd-owner);
 + }
 +
 + return ret;
  }
  EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
  
 @@ -135,10 +157,13 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev 
 *sd)
   /* return if it isn't registered */
   if (sd == NULL || sd-v4l2_dev == NULL)
   return;
 +
   spin_lock(sd-v4l2_dev-lock);
   

Re: [RFC/PATCH 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Mauro Carvalho Chehab
Em 07-07-2010 11:14, Karicheri, Muralidharan escreveu:
 
 
 v4l2_device *v4l2_dev,
  if (err  err != -ENOIOCTLCMD) {
  v4l2_device_unregister_subdev(sd);
  sd = NULL;
 +} else {
 +sd-initialized = 1;
  }
 
 Wouldn't checkpatch.pl script complain about { } on the else part since
 there is only one statement?  

IMO, it is because it analyzes the entire if clause. As the first part of the 
if has two
statements, CodingStyle accepts the usage of braces at the second part 
(although this is not a common practice).

  }

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

--
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: Status of the patches under review at LMML (60 patches)

2010-07-07 Thread Mike Isely
On Wed, 7 Jul 2010, Sven Barth wrote:

 Hi!
 
 Am 06.07.2010 15:06, schrieb Mauro Carvalho Chehab:
  == Waiting for Mike Iselyis...@isely.net  review ==
 
  Apr,25 2010: Problem with cx25840 and Terratec Grabster AV400
 http://patchwork.kernel.org/patch/94960
 
 Is Mike really the maintainer of the cx25840 module and not only of the
 pvrusb2 one? If he's not the maintainer you should contact the real one, cause
 I don't think that Mike can help much regarding patches for the cx25840 in
 that case.
 
 Also I might need to adjust the patch cause of the recent changes that
 happened there the last few months. (I don't know when I'll find time for
 this...)
 
 Regards,
 Sven

No I am definitely not the maintainer of that module, and my knowledge 
of its inner workings (though improved a lot lately) is still not very 
good.

All I can do here is verify that it doesn't break the pvrusb2 driver 
(which is what I was planning on doing).

  -Mike


-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
--
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


libv4lconvert Logitech Webcam 9000 Pro

2010-07-07 Thread Uwe Sauter

Hi everybody,

I have a problem concerning libv4lconvert, Logitech Webcam 9000 Pro and 
perhaps OpenCV.


When I try to run OpenCV's examples that access the webcam they crash 
with the following:



libv4lconvert: warning more framesizes then I can handle!
libv4lconvert: warning more framesizes then I can handle!
VIDIOC_QUERYCTRL: Input/output error
mmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
Unable to stop the stream.: Bad file descriptor
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
munmap: Invalid argument
libv4lconvert: warning more framesizes then I can handle!
libv4lconvert: warning more framesizes then I can handle!
HIGHGUI ERROR: V4L: device /dev/video0: Unable to query number of channels


It seems to me that the cam has more framesizes than libv4lconvert 
actually can handle.This error happens on verions 0.6.1, 0.7.91 and 
0.8.0. A quick fix to this:


change in v4l-utils-version/lib/libv4lconvert/libv4lconvert-priv.h:

line 32:#define V4LCONVERT_MAX_FRAMESIZES 16
to: #define V4LCONVERT_MAX_FRAMESIZES 32
or any other higher number.

I have no idea which implications result from this.

The mmap/munmap/stream/HIGHGUI errors seem to be OpenCV related.

guvcview/luvcview both work BUT they don't link agains libv4lconvert.

I hope you can include this. If I can help testing I'm glad to 
participate. If you need more infos regarding the cam feel free to ask.




Thank you,

Uwe Sauter





--
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: Some issues with imon input driver

2010-07-07 Thread Anssi Hannula
Jarod Wilson kirjoitti keskiviikko, 7. heinäkuuta 2010 16:52:59:
 On Wed, Jul 07, 2010 at 05:36:45AM +0300, Anssi Hannula wrote:
  Hi!
  
  I tried to set up my imon remote, but run into the issue of buttons
  getting easily stuck. And while looking at the code, I noticed some more
  issues :)
 
 I'm not entirely surprised, I knew there were a few quirks left I'd not
 yet fully sorted out. Generally, it works quite well, but I didn't abuse
 the receiver quite as thoroughly as you. ;)
 
 Can I talk you into filing a bug to track this? I can probably work up
 fixes for a number of these sooner or later, if you don't beat me to them,
 but it'd be easy for one or more of the specific problems to slip through
 the cracks if not logged somewhere. My From: address here matches my
 b.k.o. account, if you want to assign said bug to me.

Done, though I didn't have the permissions to assign it to you:
https://bugzilla.kernel.org/show_bug.cgi?id=16351

 Ah, and because we're actually handing remote controls via
 drivers/media/IR/, you should cc linux-media as well (if not instead of
 linux-input) on anything regarding this driver.

OK.

BTW, I wonder if we should also disable kernel autorepeat and use the remote 
control's own repeat signals instead?
Then extra repeat codes would not not emitted if the release signal is missed.

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


[cron job] v4l-dvb daily build 2.6.22 and up: ERRORS, 2.6.16-2.6.21: ERRORS

2010-07-07 Thread Hans Verkuil
This message is generated daily by a cron job that builds v4l-dvb for
the kernels and architectures in the list below.

Results of the daily build of v4l-dvb:

date:Wed Jul  7 19:00:18 CEST 2010
path:http://www.linuxtv.org/hg/v4l-dvb
changeset:   14993:9652f85e688a
git master:   f6760aa024199cfbce564311dc4bc4d47b6fb349
git media-master: 41c5f984b67b331064e69acc9fca5e99bf73d400
gcc version:  i686-linux-gcc (GCC) 4.4.3
host hardware:x86_64
host os:  2.6.32.5

linux-2.6.32.6-armv5: OK
linux-2.6.33-armv5: OK
linux-2.6.34-armv5: WARNINGS
linux-2.6.35-rc1-armv5: ERRORS
linux-2.6.32.6-armv5-davinci: OK
linux-2.6.33-armv5-davinci: OK
linux-2.6.34-armv5-davinci: WARNINGS
linux-2.6.35-rc1-armv5-davinci: ERRORS
linux-2.6.32.6-armv5-ixp: WARNINGS
linux-2.6.33-armv5-ixp: WARNINGS
linux-2.6.34-armv5-ixp: WARNINGS
linux-2.6.35-rc1-armv5-ixp: ERRORS
linux-2.6.32.6-armv5-omap2: OK
linux-2.6.33-armv5-omap2: OK
linux-2.6.34-armv5-omap2: WARNINGS
linux-2.6.35-rc1-armv5-omap2: ERRORS
linux-2.6.22.19-i686: ERRORS
linux-2.6.23.17-i686: ERRORS
linux-2.6.24.7-i686: WARNINGS
linux-2.6.25.20-i686: WARNINGS
linux-2.6.26.8-i686: WARNINGS
linux-2.6.27.44-i686: WARNINGS
linux-2.6.28.10-i686: WARNINGS
linux-2.6.29.1-i686: WARNINGS
linux-2.6.30.10-i686: WARNINGS
linux-2.6.31.12-i686: OK
linux-2.6.32.6-i686: OK
linux-2.6.33-i686: OK
linux-2.6.34-i686: WARNINGS
linux-2.6.35-rc1-i686: ERRORS
linux-2.6.32.6-m32r: OK
linux-2.6.33-m32r: OK
linux-2.6.34-m32r: WARNINGS
linux-2.6.35-rc1-m32r: ERRORS
linux-2.6.32.6-mips: OK
linux-2.6.33-mips: OK
linux-2.6.34-mips: WARNINGS
linux-2.6.35-rc1-mips: ERRORS
linux-2.6.32.6-powerpc64: OK
linux-2.6.33-powerpc64: OK
linux-2.6.34-powerpc64: WARNINGS
linux-2.6.35-rc1-powerpc64: ERRORS
linux-2.6.22.19-x86_64: ERRORS
linux-2.6.23.17-x86_64: ERRORS
linux-2.6.24.7-x86_64: WARNINGS
linux-2.6.25.20-x86_64: WARNINGS
linux-2.6.26.8-x86_64: WARNINGS
linux-2.6.27.44-x86_64: WARNINGS
linux-2.6.28.10-x86_64: WARNINGS
linux-2.6.29.1-x86_64: WARNINGS
linux-2.6.30.10-x86_64: WARNINGS
linux-2.6.31.12-x86_64: OK
linux-2.6.32.6-x86_64: OK
linux-2.6.33-x86_64: OK
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35-rc1-x86_64: ERRORS
linux-git-armv5: WARNINGS
linux-git-armv5-davinci: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-armv5-omap2: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-x86_64: WARNINGS
spec: ERRORS
spec-git: OK
sparse: ERRORS
linux-2.6.16.62-i686: ERRORS
linux-2.6.17.14-i686: ERRORS
linux-2.6.18.8-i686: ERRORS
linux-2.6.19.7-i686: ERRORS
linux-2.6.20.21-i686: ERRORS
linux-2.6.21.7-i686: ERRORS
linux-2.6.16.62-x86_64: ERRORS
linux-2.6.17.14-x86_64: ERRORS
linux-2.6.18.8-x86_64: ERRORS
linux-2.6.19.7-x86_64: ERRORS
linux-2.6.20.21-x86_64: ERRORS
linux-2.6.21.7-x86_64: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The V4L-DVB specification from this daily build is here:

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


Re: [RFC/PATCH 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Laurent Pinchart
Hi Mauro,

Thanks for the review.

On Wednesday 07 July 2010 16:58:01 Mauro Carvalho Chehab wrote:
 Em 07-07-2010 08:53, Laurent Pinchart escreveu:
  Create a device node named subdevX for every registered subdev.
  As the device node is registered before the subdev core::s_config
  function is called, return -EGAIN on open until initialization
  completes.

[snip]

  diff --git a/drivers/media/video/v4l2-subdev.c
  b/drivers/media/video/v4l2-subdev.c new file mode 100644
  index 000..a048161
  --- /dev/null
  +++ b/drivers/media/video/v4l2-subdev.c
  @@ -0,0 +1,65 @@

[snip]

  +static int subdev_open(struct file *file)
  +{
  +   struct video_device *vdev = video_devdata(file);
  +   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
  +
  +   if (!sd-initialized)
  +   return -EAGAIN;
 
 Those internal interfaces should not be used on normal
 devices/applications, as none of the existing drivers are tested or
 supposed to properly work if an external program is touching on its
 internal interfaces. So, please add:
 
   if (!capable(CAP_SYS_ADMIN))
   return -EPERM;

As Hans pointed out, subdev device nodes should only be created if the subdev 
request it explicitly. I'll fix the patch accordingly. Existing subdevs will 
not have a device node by default anymore, so the CAP_SYS_ADMIN capability 
won't be required (new subdevs that explicitly ask for a device node are 
supposed to handle the calls properly, otherwise it's a bit pointless :-)).

  +
  +   return 0;
  +}

[snip]

  +static long subdev_ioctl(struct file *file, unsigned int cmd,
  +   unsigned long arg)
  +{
  +   return video_usercopy(file, cmd, arg, subdev_do_ioctl);
 
 This is a legacy call. Please, don't use it.

What should I use instead then ? I need the functionality of video_usercopy. I 
could copy it to v4l2-subdev.c verbatim. As video_ioctl2 shares lots of code 
with video_usercopy I think video_usercopy should stay, and video_ioctl2 
should use it.

 Also, while the API doc says that only certain ioctls are supported on
 subdev, there's no code here preventing the usage of invalid ioctls. So,
 it is possible to do bad things, like changing the video standard format
 individually on each subdev, creating all sorts of problems.

Invalid (or rather unsupported) ioctls will be routed to the subdev 
core::ioctl operation. Formats will not be changed automagically just because 
a userspace application issues a VIDIOC_S_FMT ioctl.

As the device node creation will need to be requested explicitly this won't be 
an issue anyway.

-- 
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: [RFC/PATCH 2/6] v4l: subdev: Add device node support

2010-07-07 Thread Mauro Carvalho Chehab
Em 07-07-2010 16:44, Laurent Pinchart escreveu:
 Hi Mauro,
 
 Thanks for the review.

 On Wednesday 07 July 2010 16:58:01 Mauro Carvalho Chehab wrote:
 Em 07-07-2010 08:53, Laurent Pinchart escreveu:
 Create a device node named subdevX for every registered subdev.
 As the device node is registered before the subdev core::s_config
 function is called, return -EGAIN on open until initialization
 completes.
 
 [snip]
 
 diff --git a/drivers/media/video/v4l2-subdev.c
 b/drivers/media/video/v4l2-subdev.c new file mode 100644
 index 000..a048161
 --- /dev/null
 +++ b/drivers/media/video/v4l2-subdev.c
 @@ -0,0 +1,65 @@
 
 [snip]
 
 +static int subdev_open(struct file *file)
 +{
 +   struct video_device *vdev = video_devdata(file);
 +   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 +
 +   if (!sd-initialized)
 +   return -EAGAIN;

 Those internal interfaces should not be used on normal
 devices/applications, as none of the existing drivers are tested or
 supposed to properly work if an external program is touching on its
 internal interfaces. So, please add:

  if (!capable(CAP_SYS_ADMIN))
  return -EPERM;
 
 As Hans pointed out, subdev device nodes should only be created if the subdev 
 request it explicitly. I'll fix the patch accordingly. Existing subdevs will 
 not have a device node by default anymore, so the CAP_SYS_ADMIN capability 
 won't be required (new subdevs that explicitly ask for a device node are 
 supposed to handle the calls properly, otherwise it's a bit pointless :-)).

It should be not requested by the subdev, but by the bridge driver (or maybe
by both).

On several drivers, the bridge is connected to more than one subdev, and some
changes need to go to both subdevs, in order to work. As the glue logic is at
the bridge driver, creating subdev interfaces will not make sense on those 
devices.

 +
 +   return 0;
 +}
 
 [snip]
 
 +static long subdev_ioctl(struct file *file, unsigned int cmd,
 +   unsigned long arg)
 +{
 +   return video_usercopy(file, cmd, arg, subdev_do_ioctl);

 This is a legacy call. Please, don't use it.
 
 What should I use instead then ? I need the functionality of video_usercopy. 
 I 
 could copy it to v4l2-subdev.c verbatim. As video_ioctl2 shares lots of code 
 with video_usercopy I think video_usercopy should stay, and video_ioctl2 
 should use it.

The bad thing of video_usercopy() is that it has a compat code, to fix broken
definitions of some iotls (see video_fix_command()), and that a few drivers 
still
use it, instead of video_ioctl2. For sure, we don't need the compat code for
subdev interface. Also, as time goes by, we'll eventually have different needs 
at
the subdev interface, as some types of ioctl's may be specific to subdevs and 
may
require different copy logic.

IMO, the better is to use the same logic inside the subdev stuff, of course
removing that old ioctl fix logic:

#ifdef __OLD_VIDIOC_
cmd = video_fix_command(cmd);
#endif

And replacing the call to:
err = func(file, cmd, parg);

By the proper subdev handling.

 Also, while the API doc says that only certain ioctls are supported on
 subdev, there's no code here preventing the usage of invalid ioctls. So,
 it is possible to do bad things, like changing the video standard format
 individually on each subdev, creating all sorts of problems.
 
 Invalid (or rather unsupported) ioctls will be routed to the subdev 
 core::ioctl operation. Formats will not be changed automagically just because 
 a userspace application issues a VIDIOC_S_FMT ioctl.
 
 As the device node creation will need to be requested explicitly this won't 
 be 
 an issue anyway.
 

Ok. It helps if you add the proper ioctl logic, instead of a stub.

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: Microsoft VX-1000 Microphone Drivers Crash in x86_64

2010-07-07 Thread Kyle Baker
On Wed, Jul 7, 2010 at 5:06 AM, Jean-Francois Moine moin...@free.fr wrote:

 The video and audio don't work at the same time because the video is
 opened before the audio and it takes all the USB bandwidth.

 The problem is in the main gspca.c, not in sonixj.c. It may fixed using
 a lower alternate setting. To check it, you may add the following lines:

        if (dev-config-desc.bNumInterfaces != 1)
                gspca_dev-nbalt -= 1;
 after
        gspca_dev-nbalt = intf-num_altsetting;
 in the function gspca_dev_probe() of gspca.c.

 If it still does not work, change -= 1 to -= 2 or -= 3 (there are
 8 alternate settings in your webcam).

I've edited the gspca.c file with your suggestion to begin testing,
but I'm unable to get the new drivers to compile with and Error 2.

 For a correct fix, the exact video bandwidth shall be calculated and I
 could not find yet time enough to do the job and people to test it...

If you find time to start progress on this, I will be ready to test
your changes. In the meantime, I will continue trying to compile and
test these changes. If I understood more of how everything works then
I'd start the bandwidth calculation progress myself. Unfortunately I
don't, but I may be able to get a patch working if this will ever
compile.

Thanks.

--
Kyle Baker
--
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/RFC v2 0/8] dsbr100: driver cleanup and fixes

2010-07-07 Thread David Ellingsworth
On Thu, May 27, 2010 at 12:39 PM, David Ellingsworth
da...@identd.dyndns.org wrote:
 This patch series addresses several issues in the dsbr100 driver.
 This series is based on the v4l-dvb master git branch and has been
 compile tested only. It should be tested before applying.

 This is the second version of this series. An additional patch has
 been added to cleanup/clarify the return values from dsbr100_start
 and dsbr100_stop.

 The following patches are included in this series:
   [PATCH/RFC v2 1/8] dsbr100: implement proper locking
   [PATCH/RFC v2 2/8] dsbr100: fix potential use after free
   [PATCH/RFC v2 3/8] dsbr100: only change frequency upon success
   [PATCH/RFC v2 4/8] dsbr100: remove disconnected indicator
   [PATCH/RFC v2 5/8] dsbr100: cleanup return value of start/stop handlers
   [PATCH/RFC v2 6/8] dsbr100: properly initialize the radio
   [PATCH/RFC v2 7/8] dsbr100: cleanup usb probe routine
   [PATCH/RFC v2 8/8] dsbr100: simplify access to radio device


Mauro,

This series has not received any comments and the original author
seems to have abandoned this driver. Please review these patches for
approval. All changes are relatively straight forward. The second
patch in this series is a bug fix for the normal case where the device
is unplugged while closed. The current implementation will cause a
NULL pointer dereference. The fact that no one has reported this bug
is probably due to the lack of people using this driver. The rest of
the changes mainly provide general cleanups and reduced overhead.

Regards,

David Ellingsworth
--
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 -next] IR: jvc-decoder needs BITREVERSE

2010-07-07 Thread Randy Dunlap
From: Randy Dunlap randy.dun...@oracle.com

ir-jvc-decoder uses bitreverse interfaces, so it should select
BITREVERSE.

ir-jvc-decoder.c:(.text+0x550bc): undefined reference to `byte_rev_table'
ir-jvc-decoder.c:(.text+0x550c6): undefined reference to `byte_rev_table'

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
Cc: Jarod Wilson ja...@redhat.com
Cc: David Härdeman da...@hardeman.nu
Cc: Mauro Carvalho Chehab mche...@infradead.org
---
 drivers/media/IR/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- linux-next-20100707.orig/drivers/media/IR/Kconfig
+++ linux-next-20100707/drivers/media/IR/Kconfig
@@ -53,6 +53,7 @@ config IR_RC6_DECODER
 config IR_JVC_DECODER
tristate Enable IR raw decoder for the JVC protocol
depends on IR_CORE
+   select BITREVERSE
default y
 
---help---
--
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


em28xx: success report for KWORLD DVD Maker USB 2.0 (VS-USB2800) [eb1a:2860]

2010-07-07 Thread Ivan
I recently purchased ($20 special deal from newegg; the price has gone 
back up) the following USB stick that captures composite video and 
S-video (no TV tuner):


KWORLD DVD Maker USB 2.0 (VS-USB2800)

It seemed likely to be supported by the em28xx driver, and I'm pleased 
to report that, in fact, it is!


I actually thought for a while that it might not be supported, because 
it wasn't obvious that I needed to set the appropriate V4L settings, 
which weren't defaulted to the ones I need (NTSC, composite video 
input), or even which program I should start testing with. So it looks 
like I should make sure that the documentation on linuxtv.org gets improved.


My first successful test occurred with MPlayer:

mplayer tv:// -tv device=/dev/video1:input=1:normid=0

(my webcam is /dev/video0, so the USB stick gets /dev/video1)

I'm wondering about firmware, though, because I notice that the Windows 
drivers include a firmware file (merlinFW.rom, 16382 bytes, md5sum 
647d818c6fc82f385ebfbbd4fb2def6d), and the video looks slightly cleaner 
in Windows-- this might be accomplished with a software filter, but I 
thought it might be possible that it's being done by firmware.


Does the em28xx driver load a firmware?

Also, any firmware that gets loaded only persists until the device is 
unplugged, right? And so my prior successful test on Windows has nothing 
to do with my later success on Linux... just want to be sure about that. 
I also tried testing with Windows in Virtualbox, but had no luck-- does 
anyone know if this should be possible? (I can provide more info about 
my virtualbox testing if anyone's interested.)


Finally, lsusb output:

Bus 002 Device 004: ID eb1a:2860 eMPIA Technology, Inc.
(let me know if you want the verbose output)

And dmesg output:

usb 2-1.2: new high speed USB device using ehci_hcd and address 4
usb 2-1.2: configuration #1 chosen from 1 choice
em28xx: New device @ 480 Mbps (eb1a:2860, interface 0, class 0)
em28xx #0: chip ID is em2860
em28xx #0: board has no eeprom
em28xx #0: Identified as Unknown EM2750/28xx video grabber (card=1)
em28xx #0: found i2c device @ 0x4a [saa7113h]
em28xx #0: Your board has no unique USB ID.
em28xx #0: A hint were successfully done, based on i2c devicelist hash.
em28xx #0: This method is not 100% failproof.
em28xx #0: If the board were missdetected, please email this log to:
em28xx #0:  V4L Mailing List  linux-media@vger.kernel.org
em28xx #0: Board detected as EM2860/SAA711X Reference Design
em28xx #0: Registering snapshot button...
input: em28xx snapshot button as 
/devices/pci:00/:00:1d.0/usb2/2-1/2-1.2/input/input10

saa7115 8-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx #0)
em28xx #0: Config register raw data: 0x00
em28xx #0: v4l2 driver version 0.1.2
em28xx #0: V4L2 video device registered as /dev/video1
em28xx #0: V4L2 VBI device registered as /dev/vbi0
usbcore: registered new interface driver em28xx
em28xx driver loaded

I guess the part about the snapshot button means that I can use the push 
button on the USB stick to trigger stuff if I want (yay!), but I have no 
idea how to make that actually happen.


I'll be happy to provide more info if needed. I really appreciate the 
great work that's been done on the V4L drivers!


Ivan
--
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: em28xx: success report for KWORLD DVD Maker USB 2.0 (VS-USB2800) [eb1a:2860]

2010-07-07 Thread Devin Heitmueller
On Wed, Jul 7, 2010 at 9:56 PM, Ivan ivan.q.pub...@gmail.com wrote:
 I recently purchased ($20 special deal from newegg; the price has gone back
 up) the following USB stick that captures composite video and S-video (no TV
 tuner):

 KWORLD DVD Maker USB 2.0 (VS-USB2800)

 It seemed likely to be supported by the em28xx driver, and I'm pleased to
 report that, in fact, it is!

Yup, it's supported.

 Does the em28xx driver load a firmware?

No firmware is involved at all for this device.  The Merlin ROM you
are seeing is for other devices that use the same underlying driver.

 Also, any firmware that gets loaded only persists until the device is
 unplugged, right? And so my prior successful test on Windows has nothing to
 do with my later success on Linux... just want to be sure about that. I also
 tried testing with Windows in Virtualbox, but had no luck-- does anyone know
 if this should be possible? (I can provide more info about my virtualbox
 testing if anyone's interested.)

Again, no firmware involved, and there is no transient state from
Windows to Linux.  Do a cold boot into Linux and you will see the
device works fine.

VirtualBox performs poorly with devices of this nature because the USB
emulation isn't really designed for high-speed realtime delivery of
video (and an uncompressed analog stream is about 20MB/sec).

 I guess the part about the snapshot button means that I can use the push
 button on the USB stick to trigger stuff if I want (yay!), but I have no
 idea how to make that actually happen.

If your device actually has a physical button on it then yes it will
work.  The driver will generate a KEY_CAMERA input event via
inputdev (similar to a keyboard event).  Read up on inputdev to see
how to write a userland application which can see it.

Cheers,

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: Status of the patches under review at LMML (60 patches)

2010-07-07 Thread Mike Isely
On Tue, 6 Jul 2010, Mauro Carvalho Chehab wrote:

 This is the summary of the patches that are currently under review at 
 Linux Media Mailing List linux-media@vger.kernel.org.
 Each patch is represented by its submission date, the subject (up to 70
 chars) and the patchwork link (if submitted via email).
 
 P.S.: This email is c/c to the developers where some action is expected.
   If you were copied, please review the patches, acking/nacking or
   submitting an update.
 

   [...]


   == Waiting for Mike Isely is...@isely.net review == 
 
 Apr,25 2010: Problem with cx25840 and Terratec Grabster AV400 
   http://patchwork.kernel.org/patch/94960
 

These are cx25840 patches and I'm not the maintainer of that module.  I 
can't really speak to the correctness of the changes.  Best I can do is 
to try the patch with a few pvrusb2-driven devices here that use the 
cx25840 module.  I've done that now (HVR-1950 and PVR-USB2 model 24012) 
and everything continues to work fine.  Note, this part of the patch:

int hw_fix = state-pvr150_workaround;
-
-   if (std == V4L2_STD_NTSC_M_JP) {
+   if (std == V4L2_STD_NTSC_M_JP) {
/* Japan uses EIAJ audio standard */
cx25840_write(client, 0x808, hw_fix ? 0x2f : 0xf7);
} else if (std == V4L2_STD_NTSC_M_KR) {

is a whitespace-only change which introduces a bogus tab and messes up 
the indentation of that opening if-statement.  It should probably be 
removed from the patch.  Other than that, you have my ack:

Acked-By: Mike Isely is...@pobox.com

  -Mike


-- 

Mike Isely
isely @ isely (dot) net
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8
--
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]video:gspca.c Fix warning: case value '7' not in enumerated type 'enum v4l2_memory'

2010-07-07 Thread Justin P. Mattock
This fixes a warning I'm seeing when building:
  CC [M]  drivers/media/video/gspca/gspca.o
drivers/media/video/gspca/gspca.c: In function 'vidioc_reqbufs':
drivers/media/video/gspca/gspca.c:1508:2: warning: case value '7' not in 
enumerated type 'enum v4l2_memory'

Signed-off-by: Justin P. Mattock justinmatt...@gmail.com

---
 drivers/media/video/gspca/gspca.c |1 -
 include/linux/videodev2.h |1 +
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/gspca/gspca.c 
b/drivers/media/video/gspca/gspca.c
index 678675b..a9b4d97 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -84,7 +84,6 @@ static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h)
 
 /* specific memory types - !! should be different from V4L2_MEMORY_xxx */
 #define GSPCA_MEMORY_NO 0  /* V4L2_MEMORY_xxx starts from 1 */
-#define GSPCA_MEMORY_READ 7
 
 #define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)
 
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 047f7e6..b73aa18 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -170,6 +170,7 @@ enum v4l2_memory {
V4L2_MEMORY_MMAP = 1,
V4L2_MEMORY_USERPTR  = 2,
V4L2_MEMORY_OVERLAY  = 3,
+   GSPCA_MEMORY_READ= 7,
 };
 
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
-- 
1.7.1.rc1.21.gf3bd6

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