Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp472826pxb; Wed, 11 Nov 2020 08:12:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJw4VOUXgcDXJdM4txGt9UlgoWL3CsTa79uhbtitgvDQvjd4nMHKsWXTb/wH5WYDoYxSJBH6 X-Received: by 2002:a17:906:d8b0:: with SMTP id qc16mr25492850ejb.268.1605111172637; Wed, 11 Nov 2020 08:12:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605111172; cv=none; d=google.com; s=arc-20160816; b=Q0+X1r20rPSY3vQ3REwWPh2r64pnVfvI4m3iKA484vVd63mNELTMwNQc/NwwQ4hhc1 cfdacGYwaICNpGFH9dOvBtNYJk/Y8Tvf3xmCNNIWHxSfcS6QrZrffgsi30Wwr2Cx796V 4O2HUotq/LJXstscv4WtRXFXKf1RWPde7xo4uUCJ1hVvyTQjQVmzzn7mChLUxJkggQJU Euaos+L3k/KZgqN22jo9nz553OL8bplzIPGCXxKeJmLywtmGcVNKK6Bl4rIhjxCHpzPi aUl+cvDA5qxkLUqZrIRTmqVWcjmtmhaNOMxDIuaxpyLx8EFJHIbNu1VjRJ2pmVuE8Pqz 2w9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=DRY6wscalWlfAwtOkmgsX3II8ZIYotcHkm4m7nc9FkI=; b=uZsmTIjnr9E6afswnL9y4ELsK3658pSp86MoTn97LVZDOQvzQQMc2tUS1CvOIldGch +ebm1Bbhc9s+oJHgpTwqMgAdaDcrQFwBmSIqk0VknmFAfUYiVUS51Tb4ah3HZfdi24tT x02zl1LDhIx8f8PiWpHzHX6C3Z0uHeL01HsiSEdCJUUx2OxNeYrMhPqX9snyzL/N2k/e K29llT0H2xW3dlNgak//U5FJ6fkCxTmiltxV7X1yKbkdR50bpsghTCfzPwp5tG8f2r8T D4j4kTYn5jLyjlDt5hlsru49gjGcg2xcG/0wUnWTkIXPD3fIBAV2BEygq4u0OER8Sndw SxOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O8J0xfVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr31si1636256ejc.233.2020.11.11.08.12.28; Wed, 11 Nov 2020 08:12:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=O8J0xfVp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727205AbgKKQKS (ORCPT + 99 others); Wed, 11 Nov 2020 11:10:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726148AbgKKQKR (ORCPT ); Wed, 11 Nov 2020 11:10:17 -0500 Received: from mail-vk1-xa41.google.com (mail-vk1-xa41.google.com [IPv6:2607:f8b0:4864:20::a41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF28C0613D6 for ; Wed, 11 Nov 2020 08:10:16 -0800 (PST) Received: by mail-vk1-xa41.google.com with SMTP id i3so591147vkk.11 for ; Wed, 11 Nov 2020 08:10:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DRY6wscalWlfAwtOkmgsX3II8ZIYotcHkm4m7nc9FkI=; b=O8J0xfVpMlvjjaXvgxM+BwL1TecH5uBPa/pX/dNJFLUV23dmQ8lmsU1himQoNB7de3 T0JODIENIA7SBkCHXmEjvR4jUUOgI7hjE7Nf8O6PB3EeOenxZWxeqOFHP0aBFjMI4iBR Alki7AZiCSDRi0Rgcsk7j1v5x6+5J9f37lpT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DRY6wscalWlfAwtOkmgsX3II8ZIYotcHkm4m7nc9FkI=; b=K2klOMpL8ISYQbHnNBIdE8R62aLS7e+C70Ov2UmOUfVa8dyo6OVom0+1CM29ri+Jhl crhHcu/uCm2VcB2R5lxqSIQXO4nY2cfarJF2ArRd738J2DkoogKwOHrkiHn/bOGRJFou FRETtIbWgm3J67yBBB1CzfD2Ng1mvlGCDrRHhe9CqwiglcYxuRGofjGs/KX8lkHgkWu5 UOZo6hyOJbZ9/Rf2pDjjlWymDjkIGYndtb4xCypWtoYtWgJ9uMCjcSBqKqmylHU5TMmA xWt9lGmefYokMyhD4LUhl2hibKO1VU/CkjNVyDAZjZZDgMLCQnNbqn2nAd7h9wPj1+vF ZFhw== X-Gm-Message-State: AOAM532ma/oEjjrw0+xHJZg6g5D/t/QJ2EprXDacFzllvLltQ4IrcScb iFjF+MbFfgmdcaJnFa71nDBJDoYrUpurAw== X-Received: by 2002:a1f:a0cf:: with SMTP id j198mr14207597vke.3.1605111014613; Wed, 11 Nov 2020 08:10:14 -0800 (PST) Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com. [209.85.217.42]) by smtp.gmail.com with ESMTPSA id v140sm288524vke.50.2020.11.11.08.10.13 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Nov 2020 08:10:14 -0800 (PST) Received: by mail-vs1-f42.google.com with SMTP id r14so1428225vsa.13 for ; Wed, 11 Nov 2020 08:10:13 -0800 (PST) X-Received: by 2002:a05:6102:309a:: with SMTP id l26mr15977310vsb.4.1605111010929; Wed, 11 Nov 2020 08:10:10 -0800 (PST) MIME-Version: 1.0 References: <1604561884-10166-1-git-send-email-mkshah@codeaurora.org> In-Reply-To: <1604561884-10166-1-git-send-email-mkshah@codeaurora.org> From: Doug Anderson Date: Wed, 11 Nov 2020 08:09:59 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] pinctrl: qcom: Move clearing pending IRQ to .irq_request_resources callback To: Maulik Shah Cc: LinusW , Bjorn Andersson , Andy Gross , LKML , linux-arm-msm , "open list:GPIO SUBSYSTEM" , Stephen Boyd , Evan Green , Matthias Kaehlcke , Rajendra Nayak , Lina Iyer , Srinivas Rao L Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, Nov 4, 2020 at 11:38 PM Maulik Shah wrote: > > When GPIOs that are routed to PDC are used as output they can still latch > the IRQ pending at GIC. As a result the spurious IRQ was handled when the > client driver change the direction to input to starts using it as IRQ. > > Currently such erroneous latched IRQ are cleared with .irq_enable callback > however if the driver continue to use GPIO as interrupt and invokes > disable_irq() followed by enable_irq() then everytime during enable_irq() > previously latched interrupt gets cleared. > > This can make edge IRQs not seen after enable_irq() if they had arrived > after the driver has invoked disable_irq() and were pending at GIC. > > Move clearing erroneous IRQ to .irq_request_resources callback as this is > the place where GPIO direction is changed as input and its locked as IRQ. > > While at this add a missing check to invoke msm_gpio_irq_clear_unmask() > from .irq_enable callback only when GPIO is not routed to PDC. > > Fixes: e35a6ae0eb3a ("pinctrl/msm: Setup GPIO chip in hierarchy") > Signed-off-by: Maulik Shah > --- > drivers/pinctrl/qcom/pinctrl-msm.c | 32 +++++++++++++++++++------------- > 1 file changed, 19 insertions(+), 13 deletions(-) > > diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c > index c4bcda9..77a25bd 100644 > --- a/drivers/pinctrl/qcom/pinctrl-msm.c > +++ b/drivers/pinctrl/qcom/pinctrl-msm.c > @@ -815,21 +815,14 @@ static void msm_gpio_irq_clear_unmask(struct irq_data *d, bool status_clear) > > static void msm_gpio_irq_enable(struct irq_data *d) > { > - /* > - * Clear the interrupt that may be pending before we enable > - * the line. > - * This is especially a problem with the GPIOs routed to the > - * PDC. These GPIOs are direct-connect interrupts to the GIC. > - * Disabling the interrupt line at the PDC does not prevent > - * the interrupt from being latched at the GIC. The state at > - * GIC needs to be cleared before enabling. > - */ > - if (d->parent_data) { > - irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, 0); > + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); > + struct msm_pinctrl *pctrl = gpiochip_get_data(gc); > + > + if (d->parent_data) > irq_chip_enable_parent(d); > - } > > - msm_gpio_irq_clear_unmask(d, true); > + if (!test_bit(d->hwirq, pctrl->skip_wake_irqs)) > + msm_gpio_irq_clear_unmask(d, true); I'm happy that this patch landed and it seems a definite improvement. However, it seems like we're still clearing important edges in the case where the PDC isn't used. Can't we just unconditionally move the clearing to msm_gpio_irq_reqres()? -Doug