Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wenyou.Yang@Microchip.com (Yang, Wenyou)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] ARM: at91: pm: fallback to slowclock when backup mode fails
Date: Fri, 28 Apr 2017 09:34:12 +0800	[thread overview]
Message-ID: <cf16a132-8b3c-681c-d532-5f28b286a6ce@Microchip.com> (raw)
In-Reply-To: <20170426160419.22401-3-alexandre.belloni@free-electrons.com>



On 2017/4/27 0:04, Alexandre Belloni wrote:
> If the backup sram allocation fails, ensure we can suspend by falling back
> to the usual slow clock mode.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Wenyou Yang <wenyou.yang@atmel.com>

> ---
>   arch/arm/mach-at91/pm.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index d08f032f9d94..02823d8f3ada 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -519,24 +519,30 @@ static void __init at91_pm_bu_sram_init(void)
>   
>   	if (!pdev) {
>   		pr_warn("%s: failed to find securam device!\n", __func__);
> -		return;
> +		goto fallback;
>   	}
>   
>   	sram_pool = gen_pool_get(&pdev->dev, NULL);
>   	if (!sram_pool) {
>   		pr_warn("%s: securam pool unavailable!\n", __func__);
> -		return;
> +		goto fallback;
>   	}
>   
>   	pm_bu = (void *)gen_pool_alloc(sram_pool, sizeof(struct at91_pm_bu));
>   	if (!pm_bu) {
>   		pr_warn("%s: unable to alloc securam!\n", __func__);
> -		return;
> +		goto fallback;
>   	}
>   
>   	pm_bu->suspended = 0;
>   	pm_bu->canary = virt_to_phys(&canary);
>   	pm_bu->resume = virt_to_phys(cpu_resume);
> +
> +fallback:
> +	if (pm_data.standby_mode == AT91_PM_BACKUP)
> +		pm_data.standby_mode = AT91_PM_SLOW_CLOCK;
> +	if (pm_data.suspend_mode != AT91_PM_BACKUP)
> +		pm_data.suspend_mode = AT91_PM_SLOW_CLOCK;
>   }
>   
>   struct pmc_info {
Best Regards,
Wenyou Yang

  reply	other threads:[~2017-04-28  1:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26 16:04 [PATCH 1/3] ARM: at91: pm: Add sama5d2 backup mode Alexandre Belloni
2017-04-26 16:04 ` [PATCH 2/3] ARM: at91: pm: allow selecting standby and suspend modes Alexandre Belloni
2017-04-28  1:33   ` Yang, Wenyou
2017-04-26 16:04 ` [PATCH 3/3] ARM: at91: pm: fallback to slowclock when backup mode fails Alexandre Belloni
2017-04-28  1:34   ` Yang, Wenyou [this message]
2017-04-27 13:34 ` [PATCH 1/3] ARM: at91: pm: Add sama5d2 backup mode Romain Izard
2017-04-27 14:41   ` Alexandre Belloni
2017-04-28  1:25 ` Yang, Wenyou

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=cf16a132-8b3c-681c-d532-5f28b286a6ce@Microchip.com \
    --to=wenyou.yang@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox