* [PATCH] gpio: omap: get rid of the conditional PM runtime calls
@ 2018-09-28 21:39 Grygorii Strashko
2018-09-28 22:33 ` Tony Lindgren
2018-10-01 10:29 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Grygorii Strashko @ 2018-09-28 21:39 UTC (permalink / raw)
To: Linus Walleij, Tony Lindgren
Cc: linux-omap, linux-gpio, linux-kernel, Grygorii Strashko
OMAP GPIO driver is checking !BANK_USED() used condition before calling PM
runtime API, because of PM runtime calls in
omap2_gpio_prepare/resume_for_idle(). It's not required any more since
"omap gpio add level idle, cpu_pm and drop runtime_irq_safe" series [1]
from Tony Lindgren was accepted and PM runtime management was enabled in
IRQ chip core by commit be45beb2df69 ("genirq: Add runtime power management
support for IRQ chips") .
As result safely drop !BANK_USED() checks from omap_gpio_request/free(),
omap_gpio_irq_bus_lock/unlock() and enable PM runtime management for OMAP
GPIO IRQ chip.
[1] https://www.spinics.net/lists/arm-kernel/msg677583.html
Tested-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
drivers/gpio/gpio-omap.c | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 287c933..c081f39 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -702,12 +702,7 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset)
struct gpio_bank *bank = gpiochip_get_data(chip);
unsigned long flags;
- /*
- * If this is the first gpio_request for the bank,
- * enable the bank module.
- */
- if (!BANK_USED(bank))
- pm_runtime_get_sync(chip->parent);
+ pm_runtime_get_sync(chip->parent);
raw_spin_lock_irqsave(&bank->lock, flags);
omap_enable_gpio_module(bank, offset);
@@ -731,12 +726,7 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
omap_disable_gpio_module(bank, offset);
raw_spin_unlock_irqrestore(&bank->lock, flags);
- /*
- * If this is the last gpio to be freed in the bank,
- * disable the bank module.
- */
- if (!BANK_USED(bank))
- pm_runtime_put(chip->parent);
+ pm_runtime_put(chip->parent);
}
/*
@@ -862,20 +852,14 @@ static void omap_gpio_irq_bus_lock(struct irq_data *data)
{
struct gpio_bank *bank = omap_irq_data_get_bank(data);
- if (!BANK_USED(bank))
- pm_runtime_get_sync(bank->chip.parent);
+ pm_runtime_get_sync(bank->chip.parent);
}
static void gpio_irq_bus_sync_unlock(struct irq_data *data)
{
struct gpio_bank *bank = omap_irq_data_get_bank(data);
- /*
- * If this is the last IRQ to be freed in the bank,
- * disable the bank module.
- */
- if (!BANK_USED(bank))
- pm_runtime_put(bank->chip.parent);
+ pm_runtime_put(bank->chip.parent);
}
static void omap_gpio_ack_irq(struct irq_data *d)
@@ -1385,6 +1369,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
irqc->irq_bus_sync_unlock = gpio_irq_bus_sync_unlock,
irqc->name = dev_name(&pdev->dev);
irqc->flags = IRQCHIP_MASK_ON_SUSPEND;
+ irqc->parent_device = dev;
bank->irq = platform_get_irq(pdev, 0);
if (bank->irq <= 0) {
--
2.10.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: omap: get rid of the conditional PM runtime calls
2018-09-28 21:39 [PATCH] gpio: omap: get rid of the conditional PM runtime calls Grygorii Strashko
@ 2018-09-28 22:33 ` Tony Lindgren
2018-10-01 10:29 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2018-09-28 22:33 UTC (permalink / raw)
To: Grygorii Strashko; +Cc: Linus Walleij, linux-omap, linux-gpio, linux-kernel
* Grygorii Strashko <grygorii.strashko@ti.com> [180928 21:44]:
> As result safely drop !BANK_USED() checks from omap_gpio_request/free(),
> omap_gpio_irq_bus_lock/unlock() and enable PM runtime management for OMAP
> GPIO IRQ chip.
Nice to get rid of the conditional PM runtime calls :)
Tony
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: omap: get rid of the conditional PM runtime calls
2018-09-28 21:39 [PATCH] gpio: omap: get rid of the conditional PM runtime calls Grygorii Strashko
2018-09-28 22:33 ` Tony Lindgren
@ 2018-10-01 10:29 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-10-01 10:29 UTC (permalink / raw)
To: Grygorii Strashko
Cc: ext Tony Lindgren, Linux-OMAP, open list:GPIO SUBSYSTEM,
linux-kernel@vger.kernel.org
On Fri, Sep 28, 2018 at 11:39 PM Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
> OMAP GPIO driver is checking !BANK_USED() used condition before calling PM
> runtime API, because of PM runtime calls in
> omap2_gpio_prepare/resume_for_idle(). It's not required any more since
> "omap gpio add level idle, cpu_pm and drop runtime_irq_safe" series [1]
> from Tony Lindgren was accepted and PM runtime management was enabled in
> IRQ chip core by commit be45beb2df69 ("genirq: Add runtime power management
> support for IRQ chips") .
>
> As result safely drop !BANK_USED() checks from omap_gpio_request/free(),
> omap_gpio_irq_bus_lock/unlock() and enable PM runtime management for OMAP
> GPIO IRQ chip.
>
> [1] https://www.spinics.net/lists/arm-kernel/msg677583.html
> Tested-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-01 10:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-28 21:39 [PATCH] gpio: omap: get rid of the conditional PM runtime calls Grygorii Strashko
2018-09-28 22:33 ` Tony Lindgren
2018-10-01 10:29 ` Linus Walleij
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).