linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lina Iyer <ilina@codeaurora.org>
To: Stephen Boyd <swboyd@chromium.org>
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
Date: Fri, 24 Aug 2018 11:14:32 -0600	[thread overview]
Message-ID: <20180824171432.GM5081@codeaurora.org> (raw)
In-Reply-To: <153509896098.28926.3622217918056498792@swboyd.mtv.corp.google.com>

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.
>


  reply	other threads:[~2018-08-24 17:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17 19:10 [PATCH RESEND v1 0/5] Wakeup GPIO support for SDM845 SoC Lina Iyer
2018-08-17 19:10 ` [PATCH RESEND v1 1/5] dt-bindings: pinctrl: add wakeup capable GPIOs for SDM845 Lina Iyer
2018-08-20 22:16   ` Rob Herring
2018-08-20 23:19   ` Bjorn Andersson
2018-08-21  8:37     ` Marc Zyngier
2018-08-17 19:10 ` [PATCH RESEND v1 2/5] drivers: pinctrl: msm: enable PDC interrupt only during suspend Lina Iyer
2018-08-18 13:13   ` Marc Zyngier
2018-08-20 15:26     ` Lina Iyer
2018-08-20 15:34       ` Marc Zyngier
2018-08-20 15:49         ` Lina Iyer
2018-08-21  7:11           ` Marc Zyngier
2018-08-24  8:22   ` Stephen Boyd
2018-08-24 17:14     ` Lina Iyer [this message]
2018-08-27 20:00       ` Stephen Boyd
2018-09-04 21:09         ` Lina Iyer
2018-09-04 22:00           ` Stephen Boyd
2018-09-06 16:36             ` Lina Iyer
2018-08-17 19:10 ` [PATCH RESEND v1 3/5] drivers: pinctrl: qcom: sdm845: support GPIO wakeup from suspend Lina Iyer
2018-08-17 19:10 ` [PATCH RESEND v1 4/5] arm64: dts: qcom: add wake up interrupts for GPIOs for SDM845 Lina Iyer
2018-08-17 19:10 ` [PATCH RESEND v1 5/5] irqchip/gic-v3: Allow interrupt to be configured as wake-up sources Lina Iyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180824171432.GM5081@codeaurora.org \
    --to=ilina@codeaurora.org \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=rnayak@codeaurora.org \
    --cc=rplsssn@codeaurora.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).