All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Tony Lindgren <tony@atomide.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>
Cc: Ladislav Michl <ladis@linux-mips.org>,
	Aaro Koskinen <aaro.koskinen@iki.fi>, Keerthy <j-keerthy@ti.com>,
	Tero Kristo <t-kristo@ti.com>,
	linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/3] gpio: omap: Remove custom PM calls and use cpu_pm instead
Date: Thu, 20 Sep 2018 18:01:22 -0500	[thread overview]
Message-ID: <35a1dccf-2b15-2d61-9210-7f3893c27795@ti.com> (raw)
In-Reply-To: <20180920193532.7714-3-tony@atomide.com>



On 09/20/2018 02:35 PM, Tony Lindgren wrote:
> For a long time the gpio-omap custom PM calls have been annoying me so
> let's replace them with cpu_pm instead. This will enable GPIO PM for
> deeper idle states on omap4. And we can handle GPIO PM for omap2/3/4
> in the same way.
> 
> Note that with this patch we are also slightly changing GPIO PM to be
> less aggressive for omap3 and only will idle GPIO when PER context
> may be lost.
> 
> For omap2, we don't need to save context and don't want to remove any
> triggering so let's add a quirk flag for that.
> 
> Let's do this all in a single patch to avoid a situation where old
> custom calls still are used with new code.
> 
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Ladislav Michl <ladis@linux-mips.org>
> Cc: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   arch/arm/mach-omap2/pm24xx.c            |   7 +-
>   arch/arm/mach-omap2/pm34xx.c            |  14 +-
>   drivers/gpio/gpio-omap.c                | 178 ++++++++++++++----------
>   include/linux/platform_data/gpio-omap.h |  13 --
>   4 files changed, 116 insertions(+), 96 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -18,6 +18,7 @@
>    * published by the Free Software Foundation.
>    */
>   

[...]

>   
> +static int __maybe_unused omap_gpio_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct gpio_bank *bank = platform_get_drvdata(pdev);
> +	unsigned long flags;
> +	int error = 0;
> +
> +	raw_spin_lock_irqsave(&bank->lock, flags);
> +	/* Must be idled only by CPU_CLUSTER_PM_ENTER? */
> +	if (bank->irq_usage) {
> +		error = -EBUSY;

Sry, I didn't get how will it work with suspend to ram?
omap_device will call this handler and, seems, abort suspend always
if gpio bank has gpios requested as IRQ. Am I missing smth?

> +		goto unlock;
> +	}
> +	omap_gpio_idle(bank, true);
> +	bank->is_suspended = true;
> +unlock:
> +	raw_spin_unlock_irqrestore(&bank->lock, flags);
> +
> +	return error;
> +}
> +
> +static int __maybe_unused omap_gpio_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct gpio_bank *bank = platform_get_drvdata(pdev);
> +	unsigned long flags;
> +	int error = 0;
> +
> +	raw_spin_lock_irqsave(&bank->lock, flags);
> +	/* Must be unidled only by CPU_CLUSTER_PM_ENTER? */
> +	if (bank->irq_usage) {
> +		error = -EBUSY;
> +		goto unlock;
> +	}
> +	omap_gpio_unidle(bank);
> +	bank->is_suspended = false;
> +unlock:
> +	raw_spin_unlock_irqrestore(&bank->lock, flags);
> +
> +	return error;
> +}
> +
> +#ifdef CONFIG_ARCH_OMAP2PLUS
>   static const struct dev_pm_ops gpio_pm_ops = {
>   	SET_RUNTIME_PM_OPS(omap_gpio_runtime_suspend, omap_gpio_runtime_resume,
>   									NULL)
>   };
> +#else
> +static const struct dev_pm_ops gpio_pm_ops;
> +#endif	/* CONFIG_ARCH_OMAP2PLUS */
>   
>   #if defined(CONFIG_OF)
>   static struct omap_gpio_reg_offs omap2_gpio_regs = {
> @@ -1774,6 +1805,11 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = {
>   	.fallingdetect =	OMAP4_GPIO_FALLINGDETECT,
>   };
>   

[...]

-- 
regards,
-grygorii

WARNING: multiple messages have this Message-ID (diff)
From: grygorii.strashko@ti.com (Grygorii Strashko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] gpio: omap: Remove custom PM calls and use cpu_pm instead
Date: Thu, 20 Sep 2018 18:01:22 -0500	[thread overview]
Message-ID: <35a1dccf-2b15-2d61-9210-7f3893c27795@ti.com> (raw)
In-Reply-To: <20180920193532.7714-3-tony@atomide.com>



On 09/20/2018 02:35 PM, Tony Lindgren wrote:
> For a long time the gpio-omap custom PM calls have been annoying me so
> let's replace them with cpu_pm instead. This will enable GPIO PM for
> deeper idle states on omap4. And we can handle GPIO PM for omap2/3/4
> in the same way.
> 
> Note that with this patch we are also slightly changing GPIO PM to be
> less aggressive for omap3 and only will idle GPIO when PER context
> may be lost.
> 
> For omap2, we don't need to save context and don't want to remove any
> triggering so let's add a quirk flag for that.
> 
> Let's do this all in a single patch to avoid a situation where old
> custom calls still are used with new code.
> 
> Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Grygorii Strashko <grygorii.strashko@ti.com>
> Cc: Keerthy <j-keerthy@ti.com>
> Cc: Ladislav Michl <ladis@linux-mips.org>
> Cc: Tero Kristo <t-kristo@ti.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>   arch/arm/mach-omap2/pm24xx.c            |   7 +-
>   arch/arm/mach-omap2/pm34xx.c            |  14 +-
>   drivers/gpio/gpio-omap.c                | 178 ++++++++++++++----------
>   include/linux/platform_data/gpio-omap.h |  13 --
>   4 files changed, 116 insertions(+), 96 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -18,6 +18,7 @@
>    * published by the Free Software Foundation.
>    */
>   

[...]

>   
> +static int __maybe_unused omap_gpio_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct gpio_bank *bank = platform_get_drvdata(pdev);
> +	unsigned long flags;
> +	int error = 0;
> +
> +	raw_spin_lock_irqsave(&bank->lock, flags);
> +	/* Must be idled only by CPU_CLUSTER_PM_ENTER? */
> +	if (bank->irq_usage) {
> +		error = -EBUSY;

Sry, I didn't get how will it work with suspend to ram?
omap_device will call this handler and, seems, abort suspend always
if gpio bank has gpios requested as IRQ. Am I missing smth?

> +		goto unlock;
> +	}
> +	omap_gpio_idle(bank, true);
> +	bank->is_suspended = true;
> +unlock:
> +	raw_spin_unlock_irqrestore(&bank->lock, flags);
> +
> +	return error;
> +}
> +
> +static int __maybe_unused omap_gpio_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct gpio_bank *bank = platform_get_drvdata(pdev);
> +	unsigned long flags;
> +	int error = 0;
> +
> +	raw_spin_lock_irqsave(&bank->lock, flags);
> +	/* Must be unidled only by CPU_CLUSTER_PM_ENTER? */
> +	if (bank->irq_usage) {
> +		error = -EBUSY;
> +		goto unlock;
> +	}
> +	omap_gpio_unidle(bank);
> +	bank->is_suspended = false;
> +unlock:
> +	raw_spin_unlock_irqrestore(&bank->lock, flags);
> +
> +	return error;
> +}
> +
> +#ifdef CONFIG_ARCH_OMAP2PLUS
>   static const struct dev_pm_ops gpio_pm_ops = {
>   	SET_RUNTIME_PM_OPS(omap_gpio_runtime_suspend, omap_gpio_runtime_resume,
>   									NULL)
>   };
> +#else
> +static const struct dev_pm_ops gpio_pm_ops;
> +#endif	/* CONFIG_ARCH_OMAP2PLUS */
>   
>   #if defined(CONFIG_OF)
>   static struct omap_gpio_reg_offs omap2_gpio_regs = {
> @@ -1774,6 +1805,11 @@ static struct omap_gpio_reg_offs omap4_gpio_regs = {
>   	.fallingdetect =	OMAP4_GPIO_FALLINGDETECT,
>   };
>   

[...]

-- 
regards,
-grygorii

  reply	other threads:[~2018-09-20 23:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-20 19:35 [PATCHv2 0/3] omap gpio add level idle, cpu_pm and drop runtime_irq_safe Tony Lindgren
2018-09-20 19:35 ` Tony Lindgren
2018-09-20 19:35 ` [PATCH 1/3] gpio: omap: Add level wakeup handling for omap4 based SoCs Tony Lindgren
2018-09-20 19:35   ` Tony Lindgren
2018-09-21  5:45   ` Keerthy
2018-09-21  5:45     ` Keerthy
2018-09-20 19:35 ` [PATCH 2/3] gpio: omap: Remove custom PM calls and use cpu_pm instead Tony Lindgren
2018-09-20 19:35   ` Tony Lindgren
2018-09-20 23:01   ` Grygorii Strashko [this message]
2018-09-20 23:01     ` Grygorii Strashko
2018-09-20 23:47     ` Tony Lindgren
2018-09-20 23:47       ` Tony Lindgren
2018-09-21  0:58       ` Grygorii Strashko
2018-09-21  0:58         ` Grygorii Strashko
2018-09-20 19:35 ` [PATCH 3/3] gpio: omap: Get rid of pm_runtime_irq_safe() Tony Lindgren
2018-09-20 19:35   ` Tony Lindgren
2018-09-22  3:12 ` [PATCHv2 0/3] omap gpio add level idle, cpu_pm and drop runtime_irq_safe Grygorii Strashko
2018-09-22  3:12   ` Grygorii Strashko
2018-09-25  6:53 ` Linus Walleij
2018-09-25  6:53   ` Linus Walleij
2018-09-25 14:35   ` Tony Lindgren
2018-09-25 14:35     ` Tony Lindgren

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=35a1dccf-2b15-2d61-9210-7f3893c27795@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=gnurou@gmail.com \
    --cc=j-keerthy@ti.com \
    --cc=ladis@linux-mips.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.