From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC739C433FE for ; Thu, 10 Dec 2020 21:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7687B23340 for ; Thu, 10 Dec 2020 21:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393912AbgLJVMK (ORCPT ); Thu, 10 Dec 2020 16:12:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393867AbgLJVLz (ORCPT ); Thu, 10 Dec 2020 16:11:55 -0500 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C194DC0613CF for ; Thu, 10 Dec 2020 13:11:14 -0800 (PST) Received: by mail-pl1-x642.google.com with SMTP id r4so3427829pls.11 for ; Thu, 10 Dec 2020 13:11:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=VwbWtl7I5SNOkqfVgZBMF+Ns0M8yx5wYS1SIU5pQb/U=; b=ihZj7nSGjap4zuU1cvocTPMsVzAcVG+c8r27U7BIAQsJIhQGJHahvDA7mml1atoWOv /6jBRBLriIzcyBSmYNt6aY8R8HPhAApld6H74D7uqotaqUmELwXOZ5NsIkMwUdOtee+f wb0vVvm2PsSsJQL5NkYzczgswgPD46/5/lE4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=VwbWtl7I5SNOkqfVgZBMF+Ns0M8yx5wYS1SIU5pQb/U=; b=GuFB8pp+t7kfub6BX0NeGAyvlgvsvyMU2P6PMEudFcYQjxox76uSGIg5vuxM5sZcoE x+OSaQE28Wp8OG1ijKIE3RISmW8V1XRvLr7HbpLL1jbTIK+DaPkEiaPg/PSqVZ5bYy4x nN6esA+NUHjzhZxrdfTZoARK1NDfonfkxNg5IoQosUZi2apZWIM43eDUB2oi4j/ao+6e jzsaPHpNeq6B7P/agh5Dv59qEBXCONux6w9ZOhcOYSmLTcObTnlmtkudsn23F/rtMvex fn31rGgoBIhaWIclg+NJbE9GmJQQSbBr0AFIiVGoh8K0D0gJ9iyNqKAu9ezS3JTmyqJr 8+Gg== X-Gm-Message-State: AOAM531Iw8BFFkQuLNqcMci1W8BUx3x2JOYFfyYjRcTbwsxm0nCmjC6N w0vN7JdPaqaxrVaYbrVYe++CKA== X-Google-Smtp-Source: ABdhPJzsLWN8oF/VACejoWTnJtiUEsk4HkfSyYbFZKn2e+Y4Twinla4wH0SCKzt/mRNZ986H55DXVQ== X-Received: by 2002:a17:902:aa84:b029:da:f114:6022 with SMTP id d4-20020a170902aa84b02900daf1146022mr8011396plr.46.1607634674333; Thu, 10 Dec 2020 13:11:14 -0800 (PST) Received: from chromium.org ([2620:15c:202:201:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id d4sm7171879pfo.127.2020.12.10.13.11.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Dec 2020 13:11:13 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20201209163818.v3.1.I2702919afc253e2a451bebc3b701b462b2d22344@changeid> References: <20201209163818.v3.1.I2702919afc253e2a451bebc3b701b462b2d22344@changeid> Subject: Re: [PATCH v3 1/3] irqchip: qcom-pdc: Fix phantom irq when changing between rising/falling From: Stephen Boyd Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Srinivas Ramana , Maulik Shah , Neeraj Upadhyay , Rajendra Nayak , linux-gpio@vger.kernel.org, Douglas Anderson , Andy Gross , Archana Sathyakumar , Lina Iyer , linux-kernel@vger.kernel.org To: Douglas Anderson , Jason Cooper , Linus Walleij , Marc Zyngier , Thomas Gleixner Date: Thu, 10 Dec 2020 13:11:12 -0800 Message-ID: <160763467203.1580929.264104038298819006@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Douglas Anderson (2020-12-09 16:41:01) > We have a problem if we use gpio-keys and configure wakeups such that > we only want one edge to wake us up. AKA: > wakeup-event-action =3D ; > wakeup-source; >=20 > Specifically we end up with a phantom interrupt that blocks suspend if > the line was already high and we want wakeups on rising edges (AKA we > want the GPIO to go low and then high again before we wake up). The > opposite is also problematic. >=20 > Specifically, here's what's happening today: > 1. Normally, gpio-keys configures to look for both edges. Due to the > current workaround introduced in commit c3c0c2e18d94 ("pinctrl: > qcom: Handle broken/missing PDC dual edge IRQs on sc7180"), if the > line was high we'd configure for falling edges. > 2. At suspend time, we change to look for rising edges. > 3. After qcom_pdc_gic_set_type() runs, we get a phantom interrupt. >=20 > We can solve this by just clearing the phantom interrupt. >=20 > NOTE: it is possible that this could cause problems for a client with > very specific needs, but there's not much we can do with this > hardware. As an example, let's say the interrupt signal is currently > high and the client is looking for falling edges. The client now > changes to look for rising edges. The client could possibly expect > that if the line has a short pulse low (and back high) that it would > always be detected. Specifically no matter when the pulse happened, > it should either have tripped the (old) falling edge trigger or the > (new) rising edge trigger. We will simply not trip it. We could > narrow down the race a bit by polling our parent before changing > types, but no matter what we do there will still be a period of time > where we can't tell the difference between a real transition (or more > than one transition) and the phantom. >=20 > Fixes: f55c73aef890 ("irqchip/pdc: Add PDC interrupt controller for QCOM = SoCs") > Signed-off-by: Douglas Anderson > Reviewed-by: Maulik Shah > Tested-by: Maulik Shah > --- Reviewed-by: Stephen Boyd