public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF
@ 2013-03-28 11:53 Laurent Pinchart
  2013-03-28 14:45 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2013-03-28 11:53 UTC (permalink / raw)
  To: linux-media, linux-usb; +Cc: Wolfram Sang

The camera fails to start video streaming after having been autosuspend.
Add a new quirk to selectively disable autosuspend for devices that
don't support it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 14 +++++++++++++-
 drivers/media/usb/uvc/uvcvideo.h   |  1 +
 2 files changed, 14 insertions(+), 1 deletion(-)

I've tried to set the reset resume quirk for this device in the USB core but
the camera still failed to start video streaming after having been
autosuspended. Regardless of whether the reset resume quirk was set, it would
respond to control messages but wouldn't send video data.

This solution below is a hack, but I'm not sure what else I can try. Crazy
ideas are welcome.

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 5dbefa6..99e2de0 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1913,8 +1913,11 @@ static int uvc_probe(struct usb_interface *intf,
 			"supported.\n", ret);
 	}
 
+	if (!(dev->quirks & UVC_QUIRK_DISABLE_AUTOSUSPEND))
+		usb_enable_autosuspend(udev);
+
 	uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n");
-	usb_enable_autosuspend(udev);
+
 	return 0;
 
 error:
@@ -2061,6 +2064,15 @@ static struct usb_device_id uvc_ids[] = {
 	  .bInterfaceSubClass	= 1,
 	  .bInterfaceProtocol	= 0,
 	  .driver_info		= UVC_QUIRK_PROBE_MINMAX },
+	/* Creative Live! Cam Optia AF */
+	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
+				| USB_DEVICE_ID_MATCH_INT_INFO,
+	  .idVendor		= 0x041e,
+	  .idProduct		= 0x4058,
+	  .bInterfaceClass	= USB_CLASS_VIDEO,
+	  .bInterfaceSubClass	= 1,
+	  .bInterfaceProtocol	= 0,
+	  .driver_info		= UVC_QUIRK_DISABLE_AUTOSUSPEND },
 	/* Genius eFace 2025 */
 	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
 				| USB_DEVICE_ID_MATCH_INT_INFO,
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
index af505fd..9cd584a 100644
--- a/drivers/media/usb/uvc/uvcvideo.h
+++ b/drivers/media/usb/uvc/uvcvideo.h
@@ -137,6 +137,7 @@
 #define UVC_QUIRK_FIX_BANDWIDTH		0x00000080
 #define UVC_QUIRK_PROBE_DEF		0x00000100
 #define UVC_QUIRK_RESTRICT_FRAME_RATE	0x00000200
+#define UVC_QUIRK_DISABLE_AUTOSUSPEND	0x00000400
 
 /* Format flags */
 #define UVC_FMT_FLAG_COMPRESSED		0x00000001
-- 
Regards,

Laurent Pinchart


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF
  2013-03-28 11:53 [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF Laurent Pinchart
@ 2013-03-28 14:45 ` Alan Stern
  2013-04-04 15:28   ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2013-03-28 14:45 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, linux-usb, Wolfram Sang

On Thu, 28 Mar 2013, Laurent Pinchart wrote:

> The camera fails to start video streaming after having been autosuspend.
> Add a new quirk to selectively disable autosuspend for devices that
> don't support it.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 14 +++++++++++++-
>  drivers/media/usb/uvc/uvcvideo.h   |  1 +
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> I've tried to set the reset resume quirk for this device in the USB core but
> the camera still failed to start video streaming after having been
> autosuspended. Regardless of whether the reset resume quirk was set, it would
> respond to control messages but wouldn't send video data.

Presumably the camera won't work after a system suspend, either.

> This solution below is a hack, but I'm not sure what else I can try. Crazy
> ideas are welcome.

It's not a hack; it's a normal use for a quirk flag.  Of course, if you 
can figure out what's wrong with the camera and see how to fix it, that 
would be best.

How does the camera perform on a Windows system after being put to
sleep and then woken up?

Alan Stern


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF
  2013-03-28 14:45 ` Alan Stern
@ 2013-04-04 15:28   ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-04-04 15:28 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-media, linux-usb, Wolfram Sang

Hi Alan,

On Thursday 28 March 2013 10:45:27 Alan Stern wrote:
> On Thu, 28 Mar 2013, Laurent Pinchart wrote:
> > The camera fails to start video streaming after having been autosuspend.
> > Add a new quirk to selectively disable autosuspend for devices that
> > don't support it.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > 
> >  drivers/media/usb/uvc/uvc_driver.c | 14 +++++++++++++-
> >  drivers/media/usb/uvc/uvcvideo.h   |  1 +
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > I've tried to set the reset resume quirk for this device in the USB core
> > but the camera still failed to start video streaming after having been
> > autosuspended. Regardless of whether the reset resume quirk was set, it
> > would respond to control messages but wouldn't send video data.
> 
> Presumably the camera won't work after a system suspend, either.

That was my expectation as well, but the device has survived system suspend 
without being reenumerated. I don't know if the USB port power got cut off 
during system suspend.

> > This solution below is a hack, but I'm not sure what else I can try. Crazy
> > ideas are welcome.
> 
> It's not a hack; it's a normal use for a quirk flag.  Of course, if you
> can figure out what's wrong with the camera and see how to fix it, that
> would be best.

I've tried to but I can't figure out what goes wrong exactly.

> How does the camera perform on a Windows system after being put to
> sleep and then woken up?

I don't know, I have no Windows system to test the camera on.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-28 11:53 [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF Laurent Pinchart
2013-03-28 14:45 ` Alan Stern
2013-04-04 15:28   ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox