From patchwork Mon Jun 17 16:50:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 2735501 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4EB6A9F39E for ; Mon, 17 Jun 2013 16:50:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D72E620473 for ; Mon, 17 Jun 2013 16:50:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AA0CE20472 for ; Mon, 17 Jun 2013 16:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751174Ab3FQQuu (ORCPT ); Mon, 17 Jun 2013 12:50:50 -0400 Received: from mail-ye0-f201.google.com ([209.85.213.201]:41822 "EHLO mail-ye0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752070Ab3FQQut (ORCPT ); Mon, 17 Jun 2013 12:50:49 -0400 Received: by mail-ye0-f201.google.com with SMTP id m7so327648yen.0 for ; Mon, 17 Jun 2013 09:50:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=/VA6+X1R28ppP/5CfPthPnJaWiHpVr3Wdx1yp9GHyiU=; b=kdJ16z32fy+GSW6wJnO4VhHFvqFJZIyPXmfAoBrVH/g+0o1d2nfbAKI6L1XsDGiOQ7 d05IMzeZEKRT/XcgQRKafcO/+kCVhMJC8zcKMv6FQGkU7dCgmev/X+D9Oq1m4KeXzgWm HuWzMNd9dWxCP6b6TEpyDzpDx+McHU7p3ekYqJBfeQtkGeMpXyYK08aZn1Fa1uPV2V7j AxMGeCKBi+QFjxQTyCibnTjKqW2je4s48FhD63JNlT3R/r2bgh0XNtXN6bLV8oS+F+rK eD40XWSjESRAQ8wln76KnWo7QBbFIbDJA6M3Ut+BWdLdNNi+9996qYgNMEvxZjuqDFay 4acA== X-Received: by 10.236.78.198 with SMTP id g46mr9171392yhe.56.1371487848844; Mon, 17 Jun 2013 09:50:48 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id x42si925380yha.7.2013.06.17.09.50.48 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Mon, 17 Jun 2013 09:50:48 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.34]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id AA36431C016; Mon, 17 Jun 2013 09:50:48 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 464EE804CE; Mon, 17 Jun 2013 09:50:48 -0700 (PDT) From: Doug Anderson To: Linus Walleij Cc: Kukjin Kim , Tomasz Figa , Olof Johansson , Simon Glass , Luigi Semenzato , ilho215.lee@samsung.com, eunki_kim@samsung.com, linux-samsung-soc@vger.kernel.org, Sachin Kamat , Doug Anderson , linux-kernel@vger.kernel.org Subject: [PATCH v3] pinctrl: exynos: ack level-triggered interrupts before unmasking Date: Mon, 17 Jun 2013 09:50:43 -0700 Message-Id: <1371487843-2066-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.8.3 X-Gm-Message-State: ALoCoQld184xAdzH2M69pHyt2xEb/0/IiCAekfJ+lyyl7sOdv6u994tyX92Hcn1k5WEeMigwveZvmjY62uSLRnM+AC/HU5rduyhpQ50dRgdg2If65/Z2DscEvH6Nf/H8vqL4qix2Tmv8OBFHMKuV9k6ocItKDo9sKAvsWbv+AS9qBNKQzpTTswMFt2be/oB7HXK3Xd9UyYi4uYaR7cX6xN/gc0zaRgRo2g== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 A level-triggered interrupt should be acked after the interrupt line becomes inactive and before it is unmasked, or else another interrupt will be immediately triggered. Acking before or after calling the handler is not enough. Signed-off-by: Luigi Semenzato Signed-off-by: Doug Anderson Acked-by: Tomasz Figa --- Changes in v3: - Rebased atop (44b6d93 pinctrl: rockchip: correctly handle arguments of pinconf options) Changes in v2: - Greatly simplified using Tomasz's suggestion of irqd_get_trigger_type - Moved acking out of the bank spinlock since since it's not needed. - Linus W. has already applied parts 1 and 2, so not resending. drivers/pinctrl/pinctrl-exynos.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c index c0729a3..ef75321 100644 --- a/drivers/pinctrl/pinctrl-exynos.c +++ b/drivers/pinctrl/pinctrl-exynos.c @@ -84,6 +84,17 @@ static void exynos_gpio_irq_unmask(struct irq_data *irqd) unsigned long mask; unsigned long flags; + /* + * Ack level interrupts right before unmask + * + * If we don't do this we'll get a double-interrupt. Level triggered + * interrupts must not fire an interrupt if the level is not + * _currently_ active, even if it was active while the interrupt was + * masked. + */ + if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK) + exynos_gpio_irq_ack(irqd); + spin_lock_irqsave(&bank->slock, flags); mask = readl(d->virt_base + reg_mask); @@ -302,6 +313,17 @@ static void exynos_wkup_irq_unmask(struct irq_data *irqd) unsigned long mask; unsigned long flags; + /* + * Ack level interrupts right before unmask + * + * If we don't do this we'll get a double-interrupt. Level triggered + * interrupts must not fire an interrupt if the level is not + * _currently_ active, even if it was active while the interrupt was + * masked. + */ + if (irqd_get_trigger_type(irqd) & IRQ_TYPE_LEVEL_MASK) + exynos_wkup_irq_ack(irqd); + spin_lock_irqsave(&b->slock, flags); mask = readl(d->virt_base + reg_mask);