From patchwork Thu Nov 19 07:23:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 61242 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 nAJ7SVic000672 for ; Thu, 19 Nov 2009 07:28:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752074AbZKSH2Y (ORCPT ); Thu, 19 Nov 2009 02:28:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752418AbZKSH2Y (ORCPT ); Thu, 19 Nov 2009 02:28:24 -0500 Received: from smtp.nokia.com ([192.100.105.134]:53370 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752074AbZKSH2X (ORCPT ); Thu, 19 Nov 2009 02:28:23 -0500 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAJ7SFHI009556; Thu, 19 Nov 2009 01:28:28 -0600 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 09:28:14 +0200 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 09:28:12 +0200 Received: from localhost.localdomain (esdhcp04137.research.nokia.com [172.21.41.37]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nAJ7S8f0021180; Thu, 19 Nov 2009 09:28:11 +0200 From: Mika Westerberg To: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org Subject: [PATCH 1/2] Input: gpio-keys: allow drivers to specify whether IRQ can be shared Date: Thu, 19 Nov 2009 09:23:45 +0200 Message-Id: X-Mailer: git-send-email 1.5.6.5 In-Reply-To: References: <1257935192.21596.1004.camel@localhost> In-Reply-To: References: X-OriginalArrivalTime: 19 Nov 2009 07:28:13.0360 (UTC) FILETIME=[DA5BD300:01CA68E9] X-Nokia-AV: Clean Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 8941a8b..113d187 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -78,6 +78,7 @@ static int __devinit gpio_keys_setup_key(struct device *dev, struct gpio_keys_button *button) { char *desc = button->desc ? button->desc : "gpio_keys"; + unsigned long irqflags; int irq, error; setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata); @@ -106,10 +107,15 @@ static int __devinit gpio_keys_setup_key(struct device *dev, goto fail3; } - error = request_irq(irq, gpio_keys_isr, - IRQF_SHARED | - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, - desc, bdata); + irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; + /* + * If not explicitly specified in platform data, we allow + * IRQs to be shared with some other device. + */ + if (!button->exclusive_irq) + irqflags |= IRQF_SHARED; + + error = request_irq(irq, gpio_keys_isr, irqflags, desc, bdata); if (error) { dev_err(dev, "Unable to claim irq %d; error %d\n", irq, error); diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 1289fa7..82639c7 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -10,6 +10,7 @@ struct gpio_keys_button { int type; /* input event type (EV_KEY, EV_SW) */ int wakeup; /* configure the button as a wake-up source */ int debounce_interval; /* debounce ticks interval in msecs */ + int exclusive_irq; /* don't share the irq */ }; struct gpio_keys_platform_data {