From patchwork Tue Dec 3 14:23:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21962 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 69D52202DA for ; Tue, 3 Dec 2013 14:24:00 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf31806144vcb.0 for ; Tue, 03 Dec 2013 06:24:00 -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=StmDg0/fuGIjAjlnUZ5BReV+niiIJkWgr5zcseKIa68=; b=EGx135Tymcoo9j11gkOTa5AXcggAw/YRW9bHMWngT+9dairFAuUiNmEKGf+6iTpBo/ RLoFBmiw99atSyVs95VbP3WHjIkHSKkFM4MPopDzx2jj25VzwykP42GsurDZED3HBOUG buGpqboLw23mkKQxRweRFKpikifJ/StjXAh6Q96fRL/HLNQVP90fAhrfTENSmPZ6+2F+ O2AiomHPCyJFRlQI+nU4OSykK+BZInCLvc1zY3MVVQ+t+hegPIarukQh+g/67Ukwuh4H a8zH8EpAe4U56qojVI4zvsUyn+8NV1KQdCxcx5+5P1izi/9CWYimBFRX6bcGwzLonAL6 Tfdw== X-Gm-Message-State: ALoCoQljYOOX1xXMAcewAnsmKyh02KJHmg4Fxa8ymsa+ArDkHBLSPPKUKikdVFwpFH1ZFjaPuEzM X-Received: by 10.236.123.136 with SMTP id v8mr1148161yhh.56.1386080640314; Tue, 03 Dec 2013 06:24:00 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.9 with SMTP id z9ls1073133qem.79.gmail; Tue, 03 Dec 2013 06:24:00 -0800 (PST) X-Received: by 10.52.164.203 with SMTP id ys11mr1375353vdb.37.1386080640181; Tue, 03 Dec 2013 06:24:00 -0800 (PST) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id gq10si31320264vdc.95.2013.12.03.06.24.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 06:24:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.181 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.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so10484539veb.12 for ; Tue, 03 Dec 2013 06:24:00 -0800 (PST) X-Received: by 10.52.168.4 with SMTP id zs4mr366243vdb.59.1386080639982; Tue, 03 Dec 2013 06:23:59 -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 u4csp212001vcz; Tue, 3 Dec 2013 06:23:59 -0800 (PST) X-Received: by 10.152.115.130 with SMTP id jo2mr7229934lab.2.1386080638874; Tue, 03 Dec 2013 06:23:58 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id jb7si3801619lbc.98.2013.12.03.06.23.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 06:23:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.50 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id el20so9336399lab.9 for ; Tue, 03 Dec 2013 06:23:58 -0800 (PST) X-Received: by 10.152.183.194 with SMTP id eo2mr262775lac.81.1386080638121; Tue, 03 Dec 2013 06:23:58 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id e10sm96095993laa.6.2013.12.03.06.23.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Dec 2013 06:23:57 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org Cc: Stephen Warren , Linus Walleij , Andy Shevchenko , Mika Westerberg , Mathias Nyman Subject: [PATCH] pinctrl: baytrail: lock IRQs when starting them Date: Tue, 3 Dec 2013 15:23:52 +0100 Message-Id: <1386080632-24402-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.181 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 --- I have no idea how to compile and test this, please help, I have high confidence in the patch though. --- 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..7ad61c59f34a 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 lp_irq_startup(struct irq_data *d) +{ + struct byt_gpio *vg = irq_data_get_irq_handler_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 lp_irq_shutdown(struct irq_data *d) +{ + struct byt_gpio *vg = irq_data_get_irq_handler_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)