From patchwork Wed Jan 22 12:39:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 3522891 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01C52C02DD for ; Wed, 22 Jan 2014 12:42:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C9FF20115 for ; Wed, 22 Jan 2014 12:42:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 003D32015D for ; Wed, 22 Jan 2014 12:42:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5x8b-0002wM-5Y; Wed, 22 Jan 2014 12:42:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5x8Y-0004bK-ND; Wed, 22 Jan 2014 12:42:30 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W5x8V-0004a7-Nt for linux-arm-kernel@lists.infradead.org; Wed, 22 Jan 2014 12:42:28 +0000 Received: by mail-wi0-f179.google.com with SMTP id hr1so543886wib.6 for ; Wed, 22 Jan 2014 04:42:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id; bh=oyV8gHLhaer25AjwxtdhpARFjzBgwMXG5OjItme9Cs0=; b=Dy5EH+rPmd5zHFknmojGS8jIyLOOOespbCatCp++EtpTBwSPBxuGbErQ5QmWbnwqG3 6PZQNARJas11DbaS/tk4sCrgXpNcrW4jh8JQ7XaZsHrp1ip9mADaF6qgrR/nhx6i33b6 DUh22+38G79Yp55Ua9JeEaLncRaRdyJ+zbRWKn3yZZier4zfLuDF5neDrTBQIyoeERn8 AwQZqIXv0ncz0o/89beM7QHJKozNOqqHMb0aVBurj80ECe31WAU9z8ukq4POH1AsaF4O dl5pMyq9DmBocSekq9SsICKDzKK6FU73OKZXyfkNN2H9IRUmiAk30M+tjQ6c94AICvaH +vsw== X-Received: by 10.180.76.103 with SMTP id j7mr2977410wiw.58.1390394524020; Wed, 22 Jan 2014 04:42:04 -0800 (PST) Received: from stedf17-labo202.ds.jdsu.net. (4-161.80-90.static-ip.oleane.fr. [90.80.161.4]) by mx.google.com with ESMTPSA id f9sm18745851wib.3.2014.01.22.04.42.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Jan 2014 04:42:03 -0800 (PST) From: Jean-Jacques Hiblot To: linus.walleij@linaro.org, nicolas.ferre@atmel.com, b.brezillon@overkiz.com, plagnioj@jcrosoft.com Subject: [PATCH 1/2] at91: gpio: use gpiolib API to mark a GPIO used as an IRQ Date: Wed, 22 Jan 2014 13:39:00 +0100 Message-Id: <1390394341-12548-1-git-send-email-jjhiblot@traphandler.com> X-Mailer: git-send-email 1.8.5.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140122_074227_870331_FD848DB5 X-CRM114-Status: GOOD ( 11.58 ) X-Spam-Score: -2.6 (--) Cc: Jean-Jacques Hiblot , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When an IRQ is started on a GPIO line, mark this GPIO as IRQ in the gpiolib so we can keep track of the usage centrally. Signed-off-by: Jean-Jacques Hiblot --- arch/arm/mach-at91/gpio.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c index a5afcf7..6176b4b 100644 --- a/arch/arm/mach-at91/gpio.c +++ b/arch/arm/mach-at91/gpio.c @@ -577,8 +577,32 @@ static int alt_gpio_irq_type(struct irq_data *d, unsigned type) return 0; } +static unsigned int gpio_irq_startup(struct irq_data *d) +{ + struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); + unsigned pin = d->hwirq; + int ret; + + ret = gpio_lock_as_irq(&at91_gpio->chip, pin); + if (ret) { + dev_err(at91_gpio->chip.dev, "unable to lock pind %lu IRQ\n", + d->hwirq); + return ret; + } + return 0; +} +static void gpio_irq_shutdown(struct irq_data *d) +{ + struct at91_gpio_chip *at91_gpio = irq_data_get_irq_chip_data(d); + unsigned pin = d->hwirq; + + gpio_unlock_as_irq(&at91_gpio->chip, pin); +} + static struct irq_chip gpio_irqchip = { .name = "GPIO", + .irq_shutdown = gpio_irq_shutdown, + .irq_startup = gpio_irq_startup, .irq_disable = gpio_irq_mask, .irq_mask = gpio_irq_mask, .irq_unmask = gpio_irq_unmask,