All of lore.kernel.org
 help / color / mirror / Atom feed
From: boris.brezillon@free-electrons.com (Boris Brezillon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 2/2] USB: host: ohci_at91: Stop/start USB PLL for all sleep modes
Date: Sat, 17 Jan 2015 18:05:20 +0100	[thread overview]
Message-ID: <20150117180520.125e456a@bbrezillon> (raw)
In-Reply-To: <1421508995-21290-2-git-send-email-sylvain.rochet@finsecur.com>

On Sat, 17 Jan 2015 16:36:35 +0100
Sylvain Rochet <sylvain.rochet@finsecur.com> wrote:

> Disable/unprepare clocks without testing the sleep target_state, removed
> the at91_suspend_entering_slow_clock() call (which is only a
> target_state == PM_SUSPEND_MEM).
> 
> Other kind of suspend now benefit from the power save induced by this
> PLL deactivation. The resume penalty is about 500 us, which is not
> negligible but acceptable considering the amount of power we are saving.
> 
> Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
> Reported-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

> ---
>  drivers/usb/host/ohci-at91.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index dc9e4e6..f0da734 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -49,6 +49,8 @@ extern int usb_disabled(void);
>  
>  static void at91_start_clock(void)
>  {
> +	if (clocked)
> +		return;
>  	if (IS_ENABLED(CONFIG_COMMON_CLK)) {
>  		clk_set_rate(uclk, 48000000);
>  		clk_prepare_enable(uclk);
> @@ -61,6 +63,8 @@ static void at91_start_clock(void)
>  
>  static void at91_stop_clock(void)
>  {
> +	if (!clocked)
> +		return;
>  	clk_disable_unprepare(fclk);
>  	clk_disable_unprepare(iclk);
>  	clk_disable_unprepare(hclk);
> @@ -615,16 +619,14 @@ ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
>  	 *
>  	 * REVISIT: some boards will be able to turn VBUS off...
>  	 */
> -	if (at91_suspend_entering_slow_clock()) {
> -		ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> -		ohci->hc_control &= OHCI_CTRL_RWC;
> -		ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
> -		ohci->rh_state = OHCI_RH_HALTED;
> -
> -		/* flush the writes */
> -		(void) ohci_readl (ohci, &ohci->regs->control);
> -		at91_stop_clock();
> -	}
> +	ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
> +	ohci->hc_control &= OHCI_CTRL_RWC;
> +	ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
> +	ohci->rh_state = OHCI_RH_HALTED;
> +
> +	/* flush the writes */
> +	(void) ohci_readl (ohci, &ohci->regs->control);
> +	at91_stop_clock();
>  
>  	return ret;
>  }
> @@ -636,8 +638,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
>  	if (device_may_wakeup(&pdev->dev))
>  		disable_irq_wake(hcd->irq);
>  
> -	if (!clocked)
> -		at91_start_clock();
> +	at91_start_clock();
>  
>  	ohci_resume(hcd, false);
>  	return 0;



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-01-17 17:05 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 19:41 [PATCH] USB: host: ehci_atmel: Add suspend/resume support Sylvain Rochet
2015-01-17  1:34 ` Alexandre Belloni
2015-01-17  9:36   ` Boris Brezillon
2015-01-17 10:43     ` Sylvain Rochet
2015-01-17 12:58       ` Boris Brezillon
2015-01-17 15:36         ` [PATCHv2 1/2] " Sylvain Rochet
2015-01-17 15:36           ` [PATCHv2 2/2] USB: host: ohci_at91: Stop/start USB PLL for all sleep modes Sylvain Rochet
2015-01-17 17:05             ` Boris Brezillon [this message]
2015-01-19  0:18             ` Alexandre Belloni
2015-01-17 16:55           ` [PATCHv2 1/2] USB: host: ehci_atmel: Add suspend/resume support Boris Brezillon
2015-01-17 16:03         ` [PATCH] " Sylvain Rochet
2015-01-17 18:23           ` [PATCH 1/3] USB: host: ehci_atmel: Move global variables to private struct Sylvain Rochet
2015-01-17 18:23             ` [PATCH 2/3] USB: host: ohci_at91: " Sylvain Rochet
2015-01-17 18:23             ` [PATCH 3/3] USB: host: ohci_at91: usb_hcd_at91_probe(), remove useless stack initialisation Sylvain Rochet
2015-01-17 19:18             ` [PATCH 1/3] USB: host: ehci_atmel: Move global variables to private struct Boris Brezillon
2015-01-17 20:30             ` Alan Stern
2015-01-17 21:25               ` [PATCHv3 0/5] USB: host: Atmel OHCI and EHCI drivers improvements Sylvain Rochet
2015-01-17 21:25                 ` [PATCHv3 1/5] USB: host: ehci_atmel: Add suspend/resume support Sylvain Rochet
2015-01-17 22:22                   ` Sergei Shtylyov
2015-01-17 22:49                     ` Sylvain Rochet
2015-01-18  8:14                       ` Boris Brezillon
2015-01-18 19:55                       ` Sergei Shtylyov
2015-01-17 21:25                 ` [PATCHv3 2/5] USB: host: ohci_at91: Stop/start USB PLL for all sleep modes Sylvain Rochet
2015-01-17 21:25                 ` [PATCHv3 3/5] USB: host: ehci_atmel: Move global variables to private struct Sylvain Rochet
2015-01-17 21:25                 ` [PATCHv3 4/5] USB: host: ohci_at91: " Sylvain Rochet
2015-01-17 21:25                 ` [PATCHv3 5/5] USB: host: ohci_at91: usb_hcd_at91_probe(), remove useless stack initialisation Sylvain Rochet
2015-01-18 17:20                 ` [PATCHv3 0/5] USB: host: Atmel OHCI and EHCI drivers improvements Alan Stern
2015-01-18 19:36                   ` [PATCHv4 0/6] " Sylvain Rochet
2015-01-18 19:36                     ` [PATCHv4 1/6] USB: host: ehci-atmel: Add suspend/resume support Sylvain Rochet
2015-01-18 19:36                     ` [PATCHv4 2/6] USB: host: ohci-at91: Use struct dev_pm_ops instead of struct platform_driver Sylvain Rochet
2015-01-18 19:36                     ` [PATCHv4 3/6] USB: host: ohci-at91: Stop/start USB PLL for all sleep modes Sylvain Rochet
2015-01-18 21:17                       ` Sylvain Rochet
2015-01-18 22:25                         ` [PATCHv5 0/6] USB: host: Atmel OHCI and EHCI drivers improvements Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 1/6] USB: host: ehci-atmel: Add suspend/resume support Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 2/6] USB: host: ohci-at91: Use struct dev_pm_ops instead of struct platform_driver Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 3/6] USB: host: ehci-atmel: Move global variables to private struct Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 4/6] USB: host: ohci-at91: Fix wake-up support Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 5/6] USB: host: ohci-at91: Move global variables to private struct Sylvain Rochet
2015-01-18 22:25                           ` [PATCHv5 6/6] USB: host: ohci-at91: usb_hcd_at91_probe(), remove useless stack initialisation Sylvain Rochet
2015-01-19 13:34                           ` [PATCHv5 0/6] USB: host: Atmel OHCI and EHCI drivers improvements Nicolas Ferre
2015-01-19 13:43                             ` Sylvain Rochet
2015-01-19 15:48                             ` Alan Stern
2015-01-18 19:36                     ` [PATCHv4 4/6] USB: host: ehci-atmel: Move global variables to private struct Sylvain Rochet
2015-01-18 19:36                     ` [PATCHv4 5/6] USB: host: ohci-at91: " Sylvain Rochet
2015-01-18 19:36                     ` [PATCHv4 6/6] USB: host: ohci-at91: usb_hcd_at91_probe(), remove useless stack initialisation Sylvain Rochet
2015-01-18 19:42                   ` [PATCHv3 0/5] USB: host: Atmel OHCI and EHCI drivers improvements Sylvain Rochet
2015-01-17 21:27               ` [PATCH 1/3] USB: host: ehci_atmel: Move global variables to private struct Sylvain Rochet
2015-01-19  0:17           ` [PATCH] USB: host: ehci_atmel: Add suspend/resume support Alexandre Belloni

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=20150117180520.125e456a@bbrezillon \
    --to=boris.brezillon@free-electrons.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 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.