From patchwork Wed Jul 15 22:51:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valdis.Kletnieks@vt.edu X-Patchwork-Id: 30546 X-Patchwork-Delegate: hdegoede@redhat.com Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1ZFVgH-0002K3-P6; Thu, 16 Jul 2015 01:01:37 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-6) with esmtp id 1ZFVgF-0006pi-5g; Thu, 16 Jul 2015 01:01:37 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbbGOXBd (ORCPT + 1 other); Wed, 15 Jul 2015 19:01:33 -0400 Received: from outbound.smtp.vt.edu ([198.82.183.121]:35978 "EHLO omr1.cc.vt.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752722AbbGOXBc (ORCPT ); Wed, 15 Jul 2015 19:01:32 -0400 X-Greylist: delayed 567 seconds by postgrey-1.27 at vger.kernel.org; Wed, 15 Jul 2015 19:01:32 EDT Received: from mr2.cc.vt.edu (mr2.cc.ipv6.vt.edu [IPv6:2001:468:c80:2105:0:212:7ed0:359e]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id t6FMpxhJ019478; Wed, 15 Jul 2015 18:51:59 -0400 Received: from auth1.smtp.vt.edu (auth1.smtp.vt.edu [198.82.161.152] (may be forged)) by mr2.cc.vt.edu (8.14.4/8.14.4) with ESMTP id t6FMpsAZ031435; Wed, 15 Jul 2015 18:51:59 -0400 Received: from turing-police.cc.vt.edu ([IPv6:2001:468:c80:2103:5e3:f126:12d2:a6c8]) (authenticated bits=0) by auth1.smtp.vt.edu (8.14.4/8.14.4) with ESMTP id t6FMpr3v029525 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 15 Jul 2015 18:51:53 -0400 X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.6+dev To: Hans de Goede , Mauro Carvalho Chehab cc: contact@demhlyr.de, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ov519.c - allow setting i2c_detect_tries From: Valdis Kletnieks Mime-Version: 1.0 Date: Wed, 15 Jul 2015 18:51:53 -0400 Message-ID: <43010.1437000713@turing-police.cc.vt.edu> X-Spam-Status: No, score=-1.4 required=5.0 tests=RP_MATCHES_RCVD autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mr2.cc.vt.edu Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.7.15.225715 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, FROM_EDU_TLD 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __FW_1LN_BOT_MSGID 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS ' I encountered a user who was having troubles getting a PlayStation EyeToy (USB ID 054c:0155) working as a webcam. They reported that repeated attempts would often make it work. Looking at the code, there was support for repeated attempts at I2C transactions - but only if you rebuilt the module from source. Added module parameter support so that users running a distro kernel can tune it for recalcitrant devices. While we're at it, fix the comment to reflect the error message actually issued. Testing: [/usr/src/linux-next] insmod drivers/media/usb/gspca/gspca_ov519.ko [/usr/src/linux-next] cat /sys/module/gspca_ov519/parameters/i2c_detect_tries 10 [/usr/src/linux-next] rmmod gspca_ov519 [/usr/src/linux-next] insmod drivers/media/usb/gspca/gspca_ov519.ko i2c_detect_tries=50 [/usr/src/linux-next] cat /sys/module/gspca_ov519/parameters/i2c_detect_tries 50 [/usr/src/linux-next] modinfo drivers/media/usb/gspca/gspca_ov519.ko | grep parm parm: i2c_detect_tries:Number of times to try to init I2C (default 10) (int) parm: frame_rate:Frame rate (5, 10, 15, 20 or 30 fps) (int) Reported-By: Demhlyr Signed-Off-By: Valdis Kletnieks --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/media/usb/gspca/ov519.c 2014-10-21 10:06:09.359806243 -0400 +++ b/drivers/media/usb/gspca/ov519.c 2015-07-15 18:35:21.063790541 -0400 @@ -57,8 +57,10 @@ MODULE_LICENSE("GPL"); static int frame_rate; /* Number of times to retry a failed I2C transaction. Increase this if you - * are getting "Failed to read sensor ID..." */ + * are getting "Can't determine sensor slave IDs" */ static int i2c_detect_tries = 10; +module_param(i2c_detect_tries, int, 0644); +MODULE_PARM_DESC(i2c_detect_tries,"Number of times to try to init I2C (default 10)"); /* ov519 device descriptor */ struct sd {