Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3087325imm; Fri, 24 Aug 2018 10:16:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZx41LRUETDWouIo7kvTlaSEet0xIoYVwsVz3BDLTbW77jMoXhUrOcFGWTAIPqX4l8K8Vv7 X-Received: by 2002:a62:c60e:: with SMTP id m14-v6mr2941180pfg.40.1535130966262; Fri, 24 Aug 2018 10:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535130966; cv=none; d=google.com; s=arc-20160816; b=XAWxNN/SNNqgxf/Gr0wPBhFXuaWLsWMIrtUdFkaWBwGCi3D+bv/9c7IL9OwX5BxPYi JXNMrvfBzjtT0t4ofLVlmswl3ZAhgvO20iBqVA92S/MCEQFROogp//qRzBrJ9vkmuHSw pBXXBvJPZ1Ezft7Jtm/0VB+Z+tu6uJdSjVb8hYHSbpxcvTm6ZxDZNA/wUodL9oGLEHET iPC7u8S4e8PT90TvE/eEDfSYuCljsKdbsGvJ5cfCsRHP6HcusocB2UIqB0ltmccEmWy8 LUsYIxJfSoTO3h/UbLMOJDcMHy7y1UK7JMC+JSEkjEbDsZHocsqd+gtiyZEWrNeIMgWX Kdwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=JBPFBdQifZDA/aYH1Zqew1/4zqTY6bQ74oyNBMvVXAw=; b=w/o3e0R6tQMMUKscT1483pgZs6F9IRI5WqThJPIfAnzYg2k5934tlOGKWJYqYV1jQ6 PKm39uUchuszg6dVlMwCjAWmtIKi8yYzIItJoAPho2evJjE0oQcUnZ1B5y1D12Jp2S65 f9dgrW4Gi6z+astFjlwSw7It70K5b1/yGr7SBfMqFqAelKpGhilyAIiRTDYPZGysYJIh 2QyVTYreJkKE/H1koU0ovxMbI5EBk6gwaFKtAtdja/AZzq6J5bSN0flNvOB3A3loA84e qaZm1Ff/GsvMpjtn6ytzL39xxsPNyq+L3m4W3jlDSGsX9JiEOa5WoyfOr5K48Ef/IUtx wSjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Xtfe21uB; dkim=pass header.i=@codeaurora.org header.s=default header.b=fhWTauV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z128-v6si7607957pgb.185.2018.08.24.10.15.49; Fri, 24 Aug 2018 10:16:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Xtfe21uB; dkim=pass header.i=@codeaurora.org header.s=default header.b=fhWTauV7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727677AbeHXUuH (ORCPT + 99 others); Fri, 24 Aug 2018 16:50:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41390 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727574AbeHXUuG (ORCPT ); Fri, 24 Aug 2018 16:50:06 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 12D1A60227; Fri, 24 Aug 2018 17:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535130874; bh=JBPFBdQifZDA/aYH1Zqew1/4zqTY6bQ74oyNBMvVXAw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xtfe21uBK89NDb+b62BmpqrRzZ9mtOij9gxW/ynTEr4hhgqjj5TBMDVNGoJ5H1Hf6 rZIe4gz1TJBGiohpyI0bFayTJS3QBOUTU4yPBxkT3Bh3azLFOcusstqik/IAREDmrx LQMUTcfkkoqerGVKlUia55NJa9eGnPZesvlLZjbU= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EEB1F604BE; Fri, 24 Aug 2018 17:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1535130873; bh=JBPFBdQifZDA/aYH1Zqew1/4zqTY6bQ74oyNBMvVXAw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fhWTauV7sWiEQ71im3dySXsczEzDRA3ORtXehJBtXUkwes8ebDfh6pZwDe/92wp9D 0E1gCayzPbHeYbrz40IRoabOzDdiEzmfSTt46pCEkJWDN+TsByoGkSwNjT0oWlicSN CmUCpExKlqZtl7Bd3V3aDBLS8F23LBjSYCLpxTU8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EEB1F604BE Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Fri, 24 Aug 2018 11:14:32 -0600 From: Lina Iyer To: Stephen Boyd Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, linus.walleij@linaro.org, marc.zyngier@arm.com, rplsssn@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, rnayak@codeaurora.org, devicetree@vger.kernel.org, andy.gross@linaro.org, dianders@chromium.org Subject: Re: [PATCH RESEND v1 2/5] drivers: pinctrl: msm: enable PDC interrupt only during suspend Message-ID: <20180824171432.GM5081@codeaurora.org> References: <20180817191026.32245-1-ilina@codeaurora.org> <20180817191026.32245-3-ilina@codeaurora.org> <153509896098.28926.3622217918056498792@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <153509896098.28926.3622217918056498792@swboyd.mtv.corp.google.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 24 2018 at 02:22 -0600, Stephen Boyd wrote: >Quoting Lina Iyer (2018-08-17 12:10:23) >> During suspend the system may power down some of the system rails. As a >> result, the TLMM hw block may not be operational anymore and wakeup >> capable GPIOs will not be detected. The PDC however will be operational >> and the GPIOs that are routed to the PDC as IRQs can wake the system up. >> >> To avoid being interrupted twice (for TLMM and once for PDC IRQ) when a >> GPIO trips, use TLMM for active and switch to PDC for suspend. When >> entering suspend, disable the TLMM wakeup interrupt and instead enable >> the PDC IRQ and revert upon resume. > >What about idle paths? Don't we want to disable the TLMM interrupt and >enable the PDC interrupt when the whole cluster goes idle so we get >wakeup interrupts? We would need to do this from the idle paths. When we have that support (a patch for cluster power down is in the works), we would need to hook up to TLMM and do the same. >It's really unfortunate that the hardware can't >replay the interrupt from PDC to TLMM when it knows TLMM didn't get the >interrupt (because the whole chip was off) or the GIC didn't get the >summary irq (because the GIC was powered off). A little more hardware >effort would make this completely transparent to software and make TLMM >work across all low power modes. > I wouln't pretend to understand what it entails in the hardware. But, I believe the complication stems from the fact that PDC is sensing the raw GPIO just as TLMM when active and sensing itself. To know when to replay only the interrupt lines for the TLMM (knowing the TLMM was powered off) might be a lot of hardware. >Because of this complicated dance, it may make sense to always get the >interrupt at the PDC and then replay it into the TLMM chip "manually" >with the irq_set_irqchip_state() APIs. This way the duplicate interrupt >can't happen. The only way for the interrupt handler to run would be by >PDC poking the TLMM hardware to inject the irq into the status register. If the PDC interrupt was always enabled and the interrupt at TLMM was always disabled, all we would need to set the action handler of the PDC interrupt to that of the TLMM. I couldn't find a way to retrieve that nicely. >I think with the TLMM that's possible if we configure the pin to have >the raw status bit disabled (so that edges on the physical line don't >latch into the GPIO interrupt status register) and the normal status bit >enabled (so that if the status register changes we'll interrupt the >CPU). It needs some testing to make sure that actually works though. If >it does work, then we have a way to inject interrupts on TLMM without >worry that the TLMM hardware will also see the interrupt. > >Is there a good way to test an interrupt to see if it's edge or level >type configured? And is it really a problem to make PDC the hierarchical >parent of TLMM here so that PDC can intercept the type and wake state of >the GPIO irq? Alternately, could we just return the PDC interrupt in gpio_to_irq() and let the driver manipulate only the PDC interrupt ? Ofcourse, drivers that request the GPIO as interrupt in DT, would now have to request the PDC interrupt directly. That could avoid the dance during every idle/suspend. I am not sure how nice it is do this, would like to know your thoughts. >Plus there's the part where a GIC SPI interrupt runs for >some GPIO irq, and that needs to be decoded to figure out which GPIO it >is for and if it should be replayed or not. Maybe all types of GPIO irqs >can be replayed and if it's a level type interrupt we waste some time >handling the PDC interrupt just to do nothing besides forward what would >presumably already work without PDC intervention. >