linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maulik Shah <mkshah@codeaurora.org>
To: swboyd@chromium.org, bjorn.andersson@linaro.org,
	evgreen@chromium.org, mka@chromium.org
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	agross@kernel.org, linus.walleij@linaro.org, tglx@linutronix.de,
	maz@kernel.org, jason@lakedaemon.net, dianders@chromium.org,
	rnayak@codeaurora.org, ilina@codeaurora.org,
	lsrao@codeaurora.org, Maulik Shah <mkshah@codeaurora.org>
Subject: [RFC v3] pdc: Introduce irq_set_wake call
Date: Mon, 30 Mar 2020 22:10:59 +0530	[thread overview]
Message-ID: <1585586460-3272-1-git-send-email-mkshah@codeaurora.org> (raw)

Changes in v3:
- Add pm events notification to check if suspend started
- Add cpu pm notification to enable wake IRQs during deep/s2idle suspend
- Add pdc_pm_data structure as domain->host_data and as irq's chip_data
- Add changes to mark wakeup and enabled IRQs in respective domains
- Address Stephen's comments from v2.

Changes in v2:
- Drop pinctrl irqchip change and update in PDC irqchip change
- Include more details for .irq_set_wake introduction
- Address Stephen's comments for CPUidle need not call enable_irq_wake
- Update cover letter inline to add more detail on problem and solution

irqchip: qcom: pdc: Introduce irq_set_wake call

Some drivers using gpio interrupts want to configure gpio for wakeup using
enable_irq_wake() but during suspend entry disables irq and expects system
to resume when interrupt occurs. In the driver resume call interrupt is
re-enabled and removes wakeup capability using disable_irq_wake() one such
example is cros ec driver.

With [1] in documentation saying "An irq can be disabled with disable_irq()
and still wake the system as long as the irq has wake enabled".

In such scenario the gpio irq stays disabled at gpio irqchip but needs to
keep enabled in the hierarchy for wakeup capable parent PDC and GIC irqchip
to be able to detect and forward wake capable interrupt to CPU when system
is in sleep state like suspend.

The final status at PDC irq_chip should be an "OR" of "enable" and "wake" calls.
(i.e. same per below table)
|--------------------------------------------------|
| ENABLE in SW | WAKE in SW | PDC & GIC HW Status  |
|      0       |     0      |     0	           |
|      0       |     1      |     1	           |
|      1       |     0      |     1		   |
|      1       |     1      |     1	           |
|--------------------------------------------------|

Sending this as an RFC since this series attempts to add support for [1] by
introducing irq_set_wake call for PDC irqchip from which interrupt can be
enabled/disabled at PDC (and its parent GIC) hardware.

Note that *ALL* drivers using wakeup capable interrupt with enable_irq_wake()
and want to disable irq with disable_irq() need to call disable_irq_wake()
also if they want to stop wakeup capability at parent PDC irqchip.
Not doing so will lead to system getting woken up from sleep states if wakeup
capable IRQ comes in.

[1] https://www.spinics.net/lists/kernel/msg3398294.html

Maulik Shah (1):
  irqchip: qcom: pdc: Introduce irq_set_wake call

 drivers/irqchip/qcom-pdc.c | 271 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 256 insertions(+), 15 deletions(-)

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

             reply	other threads:[~2020-03-30 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 16:40 Maulik Shah [this message]
2020-03-30 16:41 ` [RFC v3] irqchip: qcom: pdc: Introduce irq_set_wake call Maulik Shah
2020-04-14  0:35   ` Stephen Boyd
2020-04-14  8:05     ` Maulik Shah
2020-04-15  8:06       ` Stephen Boyd
2020-04-21  6:35         ` Maulik Shah
2020-04-22 10:42           ` Stephen Boyd
     [not found]             ` <7cb97940-18d6-75b1-f4d2-7a80a6fe68c8@codeaurora.org>
2020-04-24  2:37               ` Stephen Boyd
2020-04-24  9:39                 ` Maulik Shah

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=1585586460-3272-1-git-send-email-mkshah@codeaurora.org \
    --to=mkshah@codeaurora.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=ilina@codeaurora.org \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsrao@codeaurora.org \
    --cc=maz@kernel.org \
    --cc=mka@chromium.org \
    --cc=rnayak@codeaurora.org \
    --cc=swboyd@chromium.org \
    --cc=tglx@linutronix.de \
    /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).