Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2573313imm; Fri, 24 Aug 2018 01:24:08 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdaa7P6y7j/H6I1wcoU0/FtdZvrxVIEXLU0kOUqYt7miD2jHJsauEYy2vAWTcKLynekLBnza X-Received: by 2002:a65:508b:: with SMTP id r11-v6mr674235pgp.271.1535099048504; Fri, 24 Aug 2018 01:24:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535099048; cv=none; d=google.com; s=arc-20160816; b=ehJBy0BVyKEAt3emKDLVAEmW0TzTqLe0Pk7kxURrLnbF30cLwCTU2o6R7mEEiLTjcP CbYQYWJeVxeQBHUrleIfqcDp29HZ73mah80wWP3jUutdQDHdzkG1q/iB9xVvaoT1fSt2 gHMRPbtDRq8Cb7zA7Uel+g4iDGu0XhG5KeqGWZRuQUkzYpdGLHWofxD73NWJxHpg/Y+L wuByL+eLG6Uv9CR8KB0kPKxR7d2QWQuy1N97MpGOvo7yzHTUD0OJgRHUZZAuPBNIF1IF PFB3y3LhoqE56odknxf/uijkjfXy6k+AoF6jmW3dih6N7Px23z1dpEyzGWZi9v7OVUtg H/bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=BYbArSWLlD9BeWe+HSmpb3sGYvyY6JnBEUU2tEHyIuc=; b=hVCAkSRTA47CaohnQDf9qHrl7xDhJ/dLCgR6BbGPsm70AcrqinenXZbBDuEfuHPFev wWfWIIEEk/N2RUt227Gc/hD044vqQa1XRWc2LsSiSfI847+TH3duN0a5+FEBifcWFItT LeT67MMxJTC39+cKKio/IiSs7eQiIdqnzwkdFffaso7adQo6q6ipgyO1XQD3L4iWc8jV GaIh/LCqfDtKZV4g2iZpBxx/0IKK7xeYAjk2Ncpz9U/D9NCCRU0CxVIonp4ukRl++kI9 WSu4k70LqLm6aYotLVGM+1IecNJkS+dl+Z9DGs13b5+8vFLZVFS0vo+5FvsgJ7RF66b6 SWhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=D1lKNXhI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si2532463plr.267.2018.08.24.01.23.52; Fri, 24 Aug 2018 01:24:08 -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=@chromium.org header.s=google header.b=D1lKNXhI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727318AbeHXL4R (ORCPT + 99 others); Fri, 24 Aug 2018 07:56:17 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:32892 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726510AbeHXL4Q (ORCPT ); Fri, 24 Aug 2018 07:56:16 -0400 Received: by mail-pf1-f194.google.com with SMTP id d4-v6so4206765pfn.0 for ; Fri, 24 Aug 2018 01:22:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:to:from:in-reply-to:cc :references:message-id:user-agent:subject:date; bh=BYbArSWLlD9BeWe+HSmpb3sGYvyY6JnBEUU2tEHyIuc=; b=D1lKNXhIlfiEsbgcoupszN7CKxJ68V3x0gDtzaLQGzIdlGaAPdZq0+CxV7xmBfhoPP LJuH7mgx0cRZYGlegI9eO+qgk2TLc/rtZTZMpseXPf7UvWpb/Urmq0W1s/Ml+rtGhhtw xJ5kJUZGFLVT1VQLJs7VpxaN7mNDUcXFNCCSU= 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:to:from :in-reply-to:cc:references:message-id:user-agent:subject:date; bh=BYbArSWLlD9BeWe+HSmpb3sGYvyY6JnBEUU2tEHyIuc=; b=VkC7sDvXoa7Jjogr+qUmKcnbS9r1Aeuui0GaVSO7RlB8HcrNmhYwvyr5vPpa4N1toA V0b4m7in6KzZKEe5XY4HI77zHDSDC/XHJD4RXft2C+lUU43wqLIxCkJzxstMYWV/JFJQ ivDkyCcKkmRFoAe0s5NhfXIBESsJ1dk4qAZEv5O+fFLwEDVvd7EtS0Cg2jUXC/p2ZYzS zh+O0NKU+I8qoAsXOjHvDtMMiH8/aSZxxdoBwCff1jZ1mLrg3E9pRwwb/6Ratt7YHM7A +1CBK3RnY1M4qoAgY574lhhni3MWhTIX0ldzLEZ3luc35+/BvbkjNULNb51rXd7d+60m Uo5g== X-Gm-Message-State: APzg51C3vZaGE2uyZD+53Arn0Nmn5ouv42H9BytRAEo0rPBcMuF50Ufl Q+CeJUj5ST0onkT6Op4PQVgF/A== X-Received: by 2002:a62:54c7:: with SMTP id i190-v6mr789955pfb.155.1535098962546; Fri, 24 Aug 2018 01:22:42 -0700 (PDT) Received: from localhost ([2620:15c:202:201:7e28:b9f3:6afc:5326]) by smtp.gmail.com with ESMTPSA id 1-v6sm13846561pfk.134.2018.08.24.01.22.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Aug 2018 01:22:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Lina Iyer , bjorn.andersson@linaro.org, evgreen@chromium.org, linus.walleij@linaro.org, marc.zyngier@arm.com From: Stephen Boyd In-Reply-To: <20180817191026.32245-3-ilina@codeaurora.org> Cc: 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, Lina Iyer References: <20180817191026.32245-1-ilina@codeaurora.org> <20180817191026.32245-3-ilina@codeaurora.org> Message-ID: <153509896098.28926.3622217918056498792@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH RESEND v1 2/5] drivers: pinctrl: msm: enable PDC interrupt only during suspend Date: Fri, 24 Aug 2018 01:22:40 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? 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. 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. 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? 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.