linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND RFC 0/4] Wakeup GPIO support for SDM845 SoC
@ 2018-08-01  2:00 Lina Iyer
  2018-08-01  2:00 ` [PATCH RESEND RFC 1/4] drivers: pinctrl: qcom: add wakeup capability to GPIO Lina Iyer
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Lina Iyer @ 2018-08-01  2:00 UTC (permalink / raw)
  To: marc.zyngier, swboyd, evgreen, linus.walleij, bjorn.andersson
  Cc: rplsssn, linux-kernel, linux-arm-msm, rnayak, devicetree, Lina Iyer

Hi,

This is an attempt at a solution to enable wake up from suspend and deep idle
using GPIO as a wakeup source. The 845 uses a new interrupt controller (PDC)
that lies in the always-on domain and can sense interrupts that are routed to
it, when the GIC is powered off. It would then wakeup the GIC and replay the
interrupt which would then be relayed to the AP. The PDC interrupt controller
driver is merged upstream [1],[2]. The following set of patches extends the
wakeup capability to GPIOs using the PDC. The TLMM pinctrl driver for the SoC
available at [3].

The complexity with the solution stems from the fact that only a selected few
GPIO lines are routed to the PDC in addition the TLMMs. They are also from
different banks on the pinctrl and the TLMM summary line is not routed to the
PDC. Hence the PDC cannot be considered as parent of the TLMM irqchip (or can
we ?). This is what it looks like -

   [ PIN ] -----[ TLMM ]---------------> [ GIC ] ---> [ CPU ]
      |  		 <summary IRQ>       ^
      |                                      |
      ----------------------------------> [ PDC ]
		<wakeup IRQs>

I had a brief discussion with Linus on this and the idea implemented is based
on his suggestion.

When an IRQ (let's call this latent IRQ) for a GPIO is requested, the
->irq_request_resources() is used by the TLMM driver to request a PDC pin. The
PDC pin associated with the GPIO is read from a  static map available in the
pinctrl-sdm845.c. (I think there should be a better location than a static map,
more on that later). Knowing the PDC pin from the map, we could look up the DT
bindings and request the PDC interrupt with the same trigger mask as the
interrupt requested. The ->set_type and ->set_wake are also trapped to set the
PDC IRQ's polarity and enable it when the latent IRQ is requested. When the PDC
detects the interrupt at suspend, it wakes up the GIC and replays the wakeup
IRQ. The GPIO handler function for the latent IRQ is invoked in turn.

Please review these patches and your inputs would be greatly appreciated and
(kindly) let me know if I have committed any blunders with this approach. There
is definitely opportunity to improve the location of the static GPIO-PDC pin
map. We could possibly put it as an data argument in the interrupts definition
of the PDC or with interrupt names. Also, I am still sorting out some issues
with the IRQ handling part of these patches. And I am unsure of how to set the
polarity of the PDC pin without locking, since we are not in hierarchy with the
PDC interrupt controller. Again, your inputs on these would be greatly helpful.

Thanks,
Lina

[1]. drivers/irqchip/qcom-pdc.c
[2]. Documentation/devicetree/bindings/interrupt-controller/qcom,pdc.txt
[3]. drivers/pinctrl/qcom/pinctrl-msm.c

Lina Iyer (4):
  drivers: pinctrl: qcom: add wakeup capability to GPIO
  drivers: pinctrl: qcom: add wakeup gpio map for sdm845
  arm64: dts: msm: add PDC device bindings for sdm845
  arm64: dts: qcom: add wake up interrupts for GPIOs

 arch/arm64/boot/dts/qcom/sdm845.dtsi  |  78 ++++++++++++
 drivers/pinctrl/qcom/pinctrl-msm.c    | 163 ++++++++++++++++++++++++++
 drivers/pinctrl/qcom/pinctrl-msm.h    |  14 +++
 drivers/pinctrl/qcom/pinctrl-sdm845.c |  76 ++++++++++++
 4 files changed, 331 insertions(+)

--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-08-14  9:27 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01  2:00 [PATCH RESEND RFC 0/4] Wakeup GPIO support for SDM845 SoC Lina Iyer
2018-08-01  2:00 ` [PATCH RESEND RFC 1/4] drivers: pinctrl: qcom: add wakeup capability to GPIO Lina Iyer
2018-08-01  6:31   ` Marc Zyngier
2018-08-01 19:45     ` Lina Iyer
2018-08-01 22:36       ` Bjorn Andersson
2018-08-02  2:10         ` Lina Iyer
2018-08-02  6:08       ` Marc Zyngier
2018-08-02  6:51         ` Lina Iyer
2018-08-02  7:27           ` Marc Zyngier
2018-08-02 12:58             ` Lina Iyer
2018-08-08  6:05               ` Stephen Boyd
2018-08-08  6:26                 ` Marc Zyngier
2018-08-09 17:30                   ` Stephen Boyd
2018-08-10  7:45                     ` Marc Zyngier
2018-08-10 15:06                       ` Stephen Boyd
2018-08-10 16:15                         ` Lina Iyer
2018-08-01  2:00 ` [PATCH RESEND RFC 2/4] drivers: pinctrl: qcom: add wakeup gpio map for sdm845 Lina Iyer
2018-08-01  8:42   ` Marc Zyngier
2018-08-01 20:04     ` Lina Iyer
2018-08-13 19:41       ` Lina Iyer
2018-08-14  9:26         ` Marc Zyngier
2018-08-01  2:00 ` [PATCH RESEND RFC 3/4] arm64: dts: msm: add PDC device bindings " Lina Iyer
2018-08-01  2:00 ` [PATCH RESEND RFC 4/4] arm64: dts: qcom: add wake up interrupts for GPIOs Lina Iyer

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