]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: zynq: properly support runtime PM for GPIO used as interrupts
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 8 Feb 2019 10:40:46 +0000 (11:40 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 13 Feb 2019 09:36:54 +0000 (10:36 +0100)
commit89443862fa60087cf8f6484d3bf6dd8e536b110e
tree08b34f024ece1fda72d311d82db120ede10f60cb
parent56d769689e9e58bbb29806c5e92bceeeef9f53a9
gpio: zynq: properly support runtime PM for GPIO used as interrupts

The Zynq GPIO driver currently implements runtime PM by:

 - Enabling runtime PM support in ->probe() and letting the runtime PM
   reference counter drop to zero at the end of ->probe().

 - Increasing the runtime PM reference counter in ->request() and
   decreasing it in ->free().

However, the latter is not sufficient: when a GPIO is used as an
interrupt, ->request() and ->free() are not called. Due to this, the
runtime PM counter remains to zero when the only GPIOs in use are used
as interrupts, causing them to simply not work.

To address this problem, this commit implement the
->irq_request_resources() and ->irq_release_resources() hooks,
ensuring that the runtime PM counter is properly
incremented/decremented. Since we override the default hooks, we keep
the existing behavior by making sure they call gpiochip_reqres_irq() /
gpiochip_relres_irq() respectively.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-zynq.c