linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Cohen <david.a.cohen@intel.com>
To: grant.likely@secretlab.ca
Cc: linux-kernel@vger.kernel.org, alan@linux.intel.com, "Li,
	Ning" <ning.li@intel.com>, David Cohen <david.a.cohen@intel.com>
Subject: [PATCH 3/3] gpio-langwell: implement irq shutdown interface
Date: Tue, 18 Dec 2012 17:52:13 -0800	[thread overview]
Message-ID: <1355881933-15182-4-git-send-email-david.a.cohen@intel.com> (raw)
In-Reply-To: <1355881933-15182-1-git-send-email-david.a.cohen@intel.com>

From: "Li, Ning" <ning.li@intel.com>

Signed-off-by: David Cohen <david.a.cohen@intel.com>
Signed-off-by: Li, Ning <ning.li@intel.com>
---
 drivers/gpio/gpio-langwell.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index dc534a9..c702d3d 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -219,12 +219,30 @@ static int lnw_irq_type(struct irq_data *d, unsigned type)
 
 static void lnw_irq_noop(struct irq_data *d) {}
 
+static void lnw_irq_shutdown(struct irq_data *d)
+{
+	struct lnw_gpio *lnw = irq_data_get_irq_chip_data(d);
+	u32 gpio = irqd_to_hwirq(d);
+	unsigned long flags;
+	u32 value;
+	void __iomem *grer = gpio_reg(&lnw->chip, gpio, GRER);
+	void __iomem *gfer = gpio_reg(&lnw->chip, gpio, GFER);
+
+	spin_lock_irqsave(&lnw->lock, flags);
+	value = readl(grer) & ~BIT(gpio % 32);
+	writel(value, grer);
+	value = readl(gfer) & ~BIT(gpio % 32);
+	writel(value, gfer);
+	spin_unlock_irqrestore(&lnw->lock, flags);
+};
+
 static struct irq_chip lnw_irqchip = {
 	.name		= "LNW-GPIO",
 	.irq_mask	= lnw_irq_noop,
 	.irq_unmask	= lnw_irq_noop,
 	.irq_set_type	= lnw_irq_type,
 	.irq_ack	= lnw_irq_noop,
+	.irq_shutdown	= lnw_irq_shutdown,
 };
 
 static DEFINE_PCI_DEVICE_TABLE(lnw_gpio_ids) = {   /* pin number */
-- 
1.7.10.4


  parent reply	other threads:[~2012-12-19  1:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19  1:52 [PATCH 0/3] gpio-langwell updates David Cohen
2012-12-19  1:52 ` [PATCH 1/3] gpio-langwell: cleanup driver David Cohen
2012-12-20  1:18   ` Grant Likely
2012-12-20 21:35     ` David Cohen
2012-12-20 21:56       ` Grant Likely
2012-12-19  1:52 ` [PATCH 2/3] gpio-langwell: update pci device table David Cohen
2012-12-20  1:20   ` Grant Likely
2012-12-19  1:52 ` David Cohen [this message]
2012-12-20  1:26   ` [PATCH 3/3] gpio-langwell: implement irq shutdown interface Grant Likely
2012-12-20 21:37     ` David Cohen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355881933-15182-4-git-send-email-david.a.cohen@intel.com \
    --to=david.a.cohen@intel.com \
    --cc=alan@linux.intel.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ning.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).