From patchwork Thu Jan 23 23:07:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 23660 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7005720307 for ; Thu, 23 Jan 2014 23:08:11 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id le5sf4143352vcb.7 for ; Thu, 23 Jan 2014 15:08:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=fkR2ea5qculN6qiVobabWavefOaCadEiJfFiN8C+PI0=; b=YjNyNB5Bpo+fg6nQBH9Gl5fbNmhaAoKbbTRu1sR2nmbZbCzWiSkxKZJJwaVql2tzzZ T9AXw4E4oAm2y7cjA7xYIF8sD0Z0vqtACatWBaw3FRWr67BhV8112XdaEM2NIC9IePxa 7KoxPHaHfb2QMhcOsDkIGsVycpCk4RzKPw9RrabGzHvAopWFuPUjjs187k8u7Tqj3Efc 0AbUwM0eZgIRzUHTRr73PvAfZMkvROjja+VpWkhypxAVQaGH1fljHYlONX65am6s4iRh Dej7pSXXNaRFgsmLkpFH3T85HS/NkHbSg8k72b46L6exjfR49HZS8c8mZGT3XBEwS3kq yvCw== X-Gm-Message-State: ALoCoQlvgVTvddjW745R6tIuCbteTpliH43PUfn6cKsGoGxDSi1Y6AcNKsyWKfbOHA2pfWdSVz14 X-Received: by 10.58.154.5 with SMTP id vk5mr4140426veb.32.1390518490404; Thu, 23 Jan 2014 15:08:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.109.8 with SMTP id ho8ls384872qeb.76.gmail; Thu, 23 Jan 2014 15:08:10 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr5895246vcb.27.1390518490287; Thu, 23 Jan 2014 15:08:10 -0800 (PST) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id uh1si7469597vcb.25.2014.01.23.15.08.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 15:08:10 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id ld13so1471385vcb.32 for ; Thu, 23 Jan 2014 15:08:10 -0800 (PST) X-Received: by 10.58.37.67 with SMTP id w3mr5894116vej.22.1390518490206; Thu, 23 Jan 2014 15:08:10 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp60637vcz; Thu, 23 Jan 2014 15:08:09 -0800 (PST) X-Received: by 10.180.99.100 with SMTP id ep4mr910558wib.31.1390518489386; Thu, 23 Jan 2014 15:08:09 -0800 (PST) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by mx.google.com with ESMTPS id hg7si9852071wjb.61.2014.01.23.15.08.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Jan 2014 15:08:09 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.47 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.47; Received: by mail-wg0-f47.google.com with SMTP id m15so2229442wgh.26 for ; Thu, 23 Jan 2014 15:08:08 -0800 (PST) X-Received: by 10.180.198.52 with SMTP id iz20mr865435wic.59.1390518488833; Thu, 23 Jan 2014 15:08:08 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id u6sm986587wif.6.2014.01.23.15.08.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jan 2014 15:08:08 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij , Ralf Baechle , linux-mips@linux-mips.org Subject: [PATCH] gpio: vr41xx: mark GPIO lines used for IRQ Date: Fri, 24 Jan 2014 00:07:57 +0100 Message-Id: <1390518477-10020-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.4.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Cc: Ralf Baechle Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij --- It would be much appreciated if one of the MIPS people could test this patch, thanks in advance. (I did compile-test it with a MIPS cross compiler.) --- drivers/gpio/gpio-vr41xx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c index b983bc079102..c6728cee0cfd 100644 --- a/drivers/gpio/gpio-vr41xx.c +++ b/drivers/gpio/gpio-vr41xx.c @@ -80,6 +80,7 @@ static DEFINE_SPINLOCK(giu_lock); static unsigned long giu_flags; static void __iomem *giu_base; +static struct gpio_chip vr41xx_gpio_chip; #define giu_read(offset) readw(giu_base + (offset)) #define giu_write(offset, value) writew((value), giu_base + (offset)) @@ -134,12 +135,31 @@ static void unmask_giuint_low(struct irq_data *d) giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(d->irq)); } +static unsigned int startup_giuint(struct irq_data *data) +{ + if (gpio_lock_as_irq(&vr41xx_gpio_chip, data->hwirq)) + dev_err(vr41xx_gpio_chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + data->hwirq); + /* Satisfy the .enable semantics by unmasking the line */ + unmask_giuint_low(data); + return 0; +} + +static void shutdown_giuint(struct irq_data *data) +{ + mask_giuint_low(data); + gpio_unlock_as_irq(&vr41xx_gpio_chip, data->hwirq); +} + static struct irq_chip giuint_low_irq_chip = { .name = "GIUINTL", .irq_ack = ack_giuint_low, .irq_mask = mask_giuint_low, .irq_mask_ack = mask_ack_giuint_low, .irq_unmask = unmask_giuint_low, + .irq_startup = startup_giuint, + .irq_shutdown = shutdown_giuint, }; static void ack_giuint_high(struct irq_data *d)