From patchwork Thu Mar 28 11:53:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2356141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id CCF1DDF2A1 for ; Thu, 28 Mar 2013 11:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755436Ab3C1Lws (ORCPT ); Thu, 28 Mar 2013 07:52:48 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:46513 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650Ab3C1Lwr (ORCPT ); Thu, 28 Mar 2013 07:52:47 -0400 Received: from avalon.ideasonboard.com (unknown [91.177.137.142]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C94E35A54; Thu, 28 Mar 2013 12:52:31 +0100 (CET) From: Laurent Pinchart To: linux-media@vger.kernel.org, linux-usb@vger.kernel.org Cc: Wolfram Sang Subject: [PATCH/RFC] uvcvideo: Disable USB autosuspend for Creative Live! Cam Optia AF Date: Thu, 28 Mar 2013 12:53:32 +0100 Message-Id: <1364471612-31792-1-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.8.1.5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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