From patchwork Tue Dec 28 14:45:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 436251 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBSEjh2L024250 for ; Tue, 28 Dec 2010 14:45:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626Ab0L1Opk (ORCPT ); Tue, 28 Dec 2010 09:45:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20884 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242Ab0L1Opj (ORCPT ); Tue, 28 Dec 2010 09:45:39 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBSEjblf024311 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 Dec 2010 09:45:37 -0500 Received: from [10.11.11.84] (vpn-11-84.rdu.redhat.com [10.11.11.84]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBSEjVTY011239 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 28 Dec 2010 09:45:34 -0500 Message-ID: <4D19F809.3010409@redhat.com> Date: Tue, 28 Dec 2010 12:45:29 -0200 From: Mauro Carvalho Chehab User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: Andy Walls CC: Linux Media Mailing List Subject: Re: [PATCH 0/8] Fix V4L/DVB/RC warnings References: <4D195584.6020409@redhat.com> <1293545649.2728.28.camel@morgan.silverblock.net> In-Reply-To: <1293545649.2728.28.camel@morgan.silverblock.net> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 28 Dec 2010 14:45:43 +0000 (UTC) diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index 52be6de..8486b66 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c @@ -88,6 +88,7 @@ struct IR { struct i2c_client c_tx; int need_boot; int have_tx; + bool dont_wait; }; /* Minor -> data mapping */ @@ -841,46 +842,43 @@ static int send_code(struct IR *ir, unsigned int code, unsigned int key) return ret < 0 ? ret : -EFAULT; } -#ifdef I2C_HW_B_HDPVR /* * The sleep bits aren't necessary on the HD PVR, and in fact, the * last i2c_master_recv always fails with a -5, so for now, we're * going to skip this whole mess and say we're done on the HD PVR */ - if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR) - goto done; -#endif - - /* - * This bit NAKs until the device is ready, so we retry it - * sleeping a bit each time. This seems to be what the windows - * driver does, approximately. - * Try for up to 1s. - */ - for (i = 0; i < 20; ++i) { - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout((50 * HZ + 999) / 1000); - ret = i2c_master_send(&ir->c_tx, buf, 1); - if (ret == 1) - break; - dprintk("NAK expected: i2c_master_send " - "failed with %d (try %d)\n", ret, i+1); - } - if (ret != 1) { - zilog_error("IR TX chip never got ready: last i2c_master_send " - "failed with %d\n", ret); - return ret < 0 ? ret : -EFAULT; - } + if (!ir->dont_wait) { + /* + * This bit NAKs until the device is ready, so we retry it + * sleeping a bit each time. This seems to be what the + * windows driver does, approximately. + * Try for up to 1s. + */ + for (i = 0; i < 20; ++i) { + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout((50 * HZ + 999) / 1000); + ret = i2c_master_send(&ir->c_tx, buf, 1); + if (ret == 1) + break; + dprintk("NAK expected: i2c_master_send " + "failed with %d (try %d)\n", ret, i+1); + } + if (ret != 1) { + zilog_error("IR TX chip never got ready: last i2c_master_send " + "failed with %d\n", ret); + return ret < 0 ? ret : -EFAULT; + } - /* Seems to be an 'ok' response */ - i = i2c_master_recv(&ir->c_tx, buf, 1); - if (i != 1) { - zilog_error("i2c_master_recv failed with %d\n", ret); - return -EFAULT; - } - if (buf[0] != 0x80) { - zilog_error("unexpected IR TX response #2: %02x\n", buf[0]); - return -EFAULT; + /* Seems to be an 'ok' response */ + i = i2c_master_recv(&ir->c_tx, buf, 1); + if (i != 1) { + zilog_error("i2c_master_recv failed with %d\n", ret); + return -EFAULT; + } + if (buf[0] != 0x80) { + zilog_error("unexpected IR TX response #2: %02x\n", buf[0]); + return -EFAULT; + } } /* Oh good, it worked */ @@ -1278,6 +1276,11 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) strlcpy(ir->c_tx.name, ZILOG_HAUPPAUGE_IR_TX_NAME, I2C_NAME_SIZE); ir->have_tx = 1; + +#ifdef I2C_HW_B_HDPVR + if (ir->c_rx.adapter->id == I2C_HW_B_HDPVR) + ir->dont_wait = true; +#endif } /* set lirc_dev stuff */