From patchwork Tue Sep 1 14:19:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarod Wilson X-Patchwork-Id: 45077 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n81EMG3J026672 for ; Tue, 1 Sep 2009 14:22:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754949AbZIAOVU (ORCPT ); Tue, 1 Sep 2009 10:21:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754946AbZIAOVT (ORCPT ); Tue, 1 Sep 2009 10:21:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29397 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754935AbZIAOVS (ORCPT ); Tue, 1 Sep 2009 10:21:18 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n81ELIUS029862; Tue, 1 Sep 2009 10:21:18 -0400 Received: from xavier.bos.redhat.com (xavier.bos.redhat.com [10.16.16.50]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n81ELHsx002090; Tue, 1 Sep 2009 10:21:18 -0400 From: Jarod Wilson Organization: Red Hat, Inc. To: Janne Grunau Subject: [PATCH] hdpvr: i2c fixups for fully functional IR support Date: Tue, 1 Sep 2009 10:19:35 -0400 User-Agent: KMail/1.12.0 (Linux/2.6.29.6-217.2.8.fc11.x86_64; KDE/4.3.0; x86_64; ; ) Cc: linux-media@vger.kernel.org MIME-Version: 1.0 Message-Id: <200909011019.35798.jarod@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Patch is against http://hg.jannau.net/hdpvr/ 1) Adds support for building hdpvr i2c support when i2c is built as a module (based on work by David Engel on the mythtv-users list) 2) Refines the hdpvr_i2c_write() success check (based on a thread in the sagetv forums) With this patch in place, and the latest lirc_zilog driver in my lirc git tree, the IR part in my hdpvr works perfectly, both for reception and transmitting. Signed-off-by: Jarod Wilson --- Makefile | 4 +--- hdpvr-core.c | 4 ++-- hdpvr-i2c.c | 5 ++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff -r d49772394029 linux/drivers/media/video/hdpvr/Makefile --- a/linux/drivers/media/video/hdpvr/Makefile Sun Apr 05 21:15:57 2009 +0200 +++ b/linux/drivers/media/video/hdpvr/Makefile Tue Sep 01 10:12:59 2009 -0400 @@ -1,6 +1,4 @@ -hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-video.o - -hdpvr-$(CONFIG_I2C) += hdpvr-i2c.o +hdpvr-objs := hdpvr-control.o hdpvr-core.o hdpvr-i2c.o hdpvr-video.o obj-$(CONFIG_VIDEO_HDPVR) += hdpvr.o diff -r d49772394029 linux/drivers/media/video/hdpvr/hdpvr-core.c --- a/linux/drivers/media/video/hdpvr/hdpvr-core.c Sun Apr 05 21:15:57 2009 +0200 +++ b/linux/drivers/media/video/hdpvr/hdpvr-core.c Tue Sep 01 10:12:59 2009 -0400 @@ -362,7 +362,7 @@ goto error; } -#ifdef CONFIG_I2C +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) retval = hdpvr_register_i2c_adapter(dev); if (retval < 0) { v4l2_err(&dev->v4l2_dev, "registering i2c adapter failed\n"); @@ -413,7 +413,7 @@ mutex_unlock(&dev->io_mutex); /* deregister I2C adapter */ -#ifdef CONFIG_I2C +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) mutex_lock(&dev->i2c_mutex); if (dev->i2c_adapter) i2c_del_adapter(dev->i2c_adapter); diff -r d49772394029 linux/drivers/media/video/hdpvr/hdpvr-i2c.c --- a/linux/drivers/media/video/hdpvr/hdpvr-i2c.c Sun Apr 05 21:15:57 2009 +0200 +++ b/linux/drivers/media/video/hdpvr/hdpvr-i2c.c Tue Sep 01 10:12:59 2009 -0400 @@ -10,6 +10,7 @@ * */ +#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) #include #include "hdpvr.h" @@ -67,7 +68,7 @@ REQTYPE_I2C_WRITE_STAT, CTRL_READ_REQUEST, 0, 0, buf, 2, 1000); - if (ret == 2) + if ((ret == 2) && (buf[1] == (len - 1))) ret = 0; else if (ret >= 0) ret = -EIO; @@ -164,3 +165,5 @@ error: return retval; } + +#endif /* CONFIG_I2C */