From patchwork Sun Nov 28 15:40:03 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: 362172 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 oASFfSJe010609 for ; Sun, 28 Nov 2010 15:41:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753300Ab0K1Pl1 (ORCPT ); Sun, 28 Nov 2010 10:41:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:19390 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753171Ab0K1Pl0 (ORCPT ); Sun, 28 Nov 2010 10:41:26 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oASFfQp4015927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 28 Nov 2010 10:41:26 -0500 Received: from pedra (vpn-231-111.phx2.redhat.com [10.3.231.111]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oASFeIhx023822 for ; Sun, 28 Nov 2010 10:41:22 -0500 Date: Sun, 28 Nov 2010 13:40:03 -0200 From: Mauro Carvalho Chehab Cc: Linux Media Mailing List Subject: [PATCH 1/2] [media] bttv: remove custom_irq and gpioq from bttv struct Message-ID: <20101128134003.367dfc76@pedra> In-Reply-To: References: Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 To: unlisted-recipients:; (no To-header on input) 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]); Sun, 28 Nov 2010 15:41:28 +0000 (UTC) diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 3da6e80..97159ba 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -4153,9 +4153,6 @@ static irqreturn_t bttv_irq(int irq, void *dev_id) btv=(struct bttv *)dev_id; - if (btv->custom_irq) - handled = btv->custom_irq(btv); - count=0; while (1) { /* get/clear interrupt status bits */ @@ -4191,7 +4188,6 @@ static irqreturn_t bttv_irq(int irq, void *dev_id) btv->field_count++; if ((astat & BT848_INT_GPINT) && btv->remote) { - wake_up(&btv->gpioq); bttv_input_irq(btv); } @@ -4396,7 +4392,6 @@ static int __devinit bttv_probe(struct pci_dev *dev, mutex_init(&btv->lock); spin_lock_init(&btv->s_lock); spin_lock_init(&btv->gpio_lock); - init_waitqueue_head(&btv->gpioq); init_waitqueue_head(&btv->i2c_queue); INIT_LIST_HEAD(&btv->c.subs); INIT_LIST_HEAD(&btv->capture); @@ -4584,7 +4579,6 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) /* tell gpio modules we are leaving ... */ btv->shutdown=1; - wake_up(&btv->gpioq); bttv_input_fini(btv); bttv_sub_del_devices(&btv->c); diff --git a/drivers/media/video/bt8xx/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 989c048..7f48306 100644 --- a/drivers/media/video/bt8xx/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c @@ -120,11 +120,15 @@ static void ir_enltv_handle_key(struct bttv *btv) ir->last_gpio = data | keyup; } +static int bttv_rc5_irq(struct bttv *btv); + void bttv_input_irq(struct bttv *btv) { struct bttv_ir *ir = btv->remote; - if (!ir->polling) + if (ir->rc5_gpio) + bttv_rc5_irq(btv); + else if (!ir->polling) ir_handle_key(btv); } @@ -251,22 +255,25 @@ static int bttv_rc5_irq(struct bttv *btv) /* read gpio port */ gpio = bttv_gpio_read(&btv->c); + /* get time of bit */ + current_jiffies = jiffies; + do_gettimeofday(&tv); + + /* avoid overflow with gap >1s */ + if (tv.tv_sec - ir->base_time.tv_sec > 1) { + gap = 200000; + } else { + gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + + tv.tv_usec - ir->base_time.tv_usec; + } + + dprintk(KERN_INFO DEVNAME ": RC5 IRQ: gap %d us for %s\n", + gap, (gpio & 0x20) ? "mark" : "space"); + /* remote IRQ? */ if (!(gpio & 0x20)) return 0; - /* get time of bit */ - current_jiffies = jiffies; - do_gettimeofday(&tv); - - /* avoid overflow with gap >1s */ - if (tv.tv_sec - ir->base_time.tv_sec > 1) { - gap = 200000; - } else { - gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + - tv.tv_usec - ir->base_time.tv_usec; - } - /* active code => add bit */ if (ir->active) { /* only if in the code (otherwise spurious IRQ or timer @@ -479,8 +486,7 @@ int bttv_input_init(struct bttv *btv) break; case BTTV_BOARD_NEBULA_DIGITV: ir_codes = RC_MAP_NEBULA; - btv->custom_irq = bttv_rc5_irq; - ir->rc5_gpio = 1; + ir->rc5_gpio = true; break; case BTTV_BOARD_MACHTV_MAGICTV: ir_codes = RC_MAP_APAC_VIEWCOMP; diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 0712320..9b776fa 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -139,7 +139,7 @@ struct bttv_ir { int rc5_remote_gap; /* RC5 gpio */ - u32 rc5_gpio; + bool rc5_gpio; /* Is RC5 legacy GPIO enabled? */ u32 last_bit; /* last raw bit seen */ u32 code; /* raw code under construction */ struct timeval base_time; /* time of last seen code */ @@ -364,12 +364,10 @@ struct bttv { struct bttv_pll_info pll; int triton1; int gpioirq; - int (*custom_irq)(struct bttv *btv); int use_i2c_hw; /* old gpio interface */ - wait_queue_head_t gpioq; int shutdown; void (*volume_gpio)(struct bttv *btv, __u16 volume);