[RFC v2] pdc: Introduce irq_set_wake call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 115 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 108 insertions(+), 7 deletions(-)

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux