From patchwork Fri Dec 6 14:03:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 22133 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EF90B202E0 for ; Fri, 6 Dec 2013 14:03:23 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id g10sf2948228pdj.5 for ; Fri, 06 Dec 2013 06:03:22 -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=opH02YRCYK3zN7DvSZX8Qmxl7feQmHAauOTEGMluIC4=; b=Qn8wV9HX3uY4vFZrv1nXlmiGOqKVeNAkB3QY+RfDl3aMYgyfLWGxO3sgrWeduAG9OI MGvHgx6BkeRaTIiiekqF3X9x2IqjeEd3p0b/pjvgDHydo01lHFvarU/MXrErxZi5MjVR eRwgfTbWkVNVjk5C0Y9zLmp6gO6RB/xtCU85FcumFD0YlXJ1UIBer9ruH15otztlq1we Mrd7RcWELfVKXZ5JMlITJBMescXwjQhaqWUKg8c/IeiBB+cb8Ia7QAGhgVCrpNHJLeGk a+q9Zx9ZoIvEkLxYAJhoyNI/k2INBIS/uhYjFW0sguFHTHYpQ/62KMXrTl/p4SKxnen0 7apw== X-Gm-Message-State: ALoCoQmprahgjw8f3W6J4XbfmKxJ0XjuEAe3fWJZUA+QvRC4+VzHZ6yu5dPGLH+hyP2pI5kzlgWJ X-Received: by 10.66.0.162 with SMTP id 2mr2045445paf.30.1386338602663; Fri, 06 Dec 2013 06:03:22 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.234 with SMTP id a10ls1344861qed.92.gmail; Fri, 06 Dec 2013 06:03:22 -0800 (PST) X-Received: by 10.58.6.239 with SMTP id e15mr1999428vea.29.1386338602484; Fri, 06 Dec 2013 06:03:22 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id cp3si36797456vcb.58.2013.12.06.06.03.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Dec 2013 06:03:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so789807veb.19 for ; Fri, 06 Dec 2013 06:03:22 -0800 (PST) X-Received: by 10.52.165.131 with SMTP id yy3mr1710897vdb.25.1386338601688; Fri, 06 Dec 2013 06:03:21 -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 u4csp101954vcz; Fri, 6 Dec 2013 06:03:21 -0800 (PST) X-Received: by 10.112.16.137 with SMTP id g9mr906229lbd.1.1386338600477; Fri, 06 Dec 2013 06:03:20 -0800 (PST) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id p10si26293057lag.166.2013.12.06.06.03.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 06 Dec 2013 06:03:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.171 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id q8so290849lbi.16 for ; Fri, 06 Dec 2013 06:03:19 -0800 (PST) X-Received: by 10.152.180.228 with SMTP id dr4mr983801lac.32.1386338599826; Fri, 06 Dec 2013 06:03:19 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id a8sm61349922lae.5.2013.12.06.06.03.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Dec 2013 06:03:18 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Cc: Andy Shevchenko , Mika Westerberg , Mathias Nyman , Linus Walleij Subject: [PATCH v3] pinctrl: baytrail: lock IRQs when starting them Date: Fri, 6 Dec 2013 15:03:12 +0100 Message-Id: <1386338592-1088-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 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.128.174 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: , This uses the new API for tagging GPIO lines as in use by IRQs. This enforces a few semantic checks on how the underlying GPIO line is used. Cc: Andy Shevchenko Cc: Mika Westerberg Cc: Mathias Nyman Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Use irq_data_get_irq_chip_data() to get the right data pointer. ChangeLog v1->v2: - Actually make the change compile, doh. --- drivers/pinctrl/pinctrl-baytrail.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 1174ea86b6e9..5888066d80c2 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c @@ -372,11 +372,33 @@ static void byt_irq_mask(struct irq_data *d) { } +static unsigned int byt_irq_startup(struct irq_data *d) +{ + struct byt_gpio *vg = irq_data_get_irq_chip_data(d); + + if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d))) + dev_err(vg->chip.dev, + "unable to lock HW IRQ %lu for IRQ\n", + irqd_to_hwirq(d)); + byt_irq_unmask(d); + return 0; +} + +static void byt_irq_shutdown(struct irq_data *d) +{ + struct byt_gpio *vg = irq_data_get_irq_chip_data(d); + + byt_irq_mask(d); + gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d)); +} + static struct irq_chip byt_irqchip = { .name = "BYT-GPIO", .irq_mask = byt_irq_mask, .irq_unmask = byt_irq_unmask, .irq_set_type = byt_irq_type, + .irq_startup = byt_irq_startup, + .irq_shutdown = byt_irq_shutdown, }; static void byt_gpio_irq_init_hw(struct byt_gpio *vg)