Subject: [PATCH 25/25] OMAP3: CPUidle: Make use of CPU PM notifiers

From: [email-masked] (Santosh)
Date: Fri, 09 Sep 2011 12:47:42 +0530

On Thursday 08 September 2011 11:27 PM, Kevin Hilman wrote:
>  From 8ad40f8c7f950105b25cc8d2cc35caa50871f86f Mon Sep 17 00:00:00 2001
> From: Kevin Hilman<[email-masked]>
> Date: Wed, 7 Sep 2011 12:04:44 -0700
> Subject: [PATCH 1/2] OMAP2/3: PM: trigger CPU PM notifiers in idle and
>   suspend path
>
> Add calls to CPU PM notifier core in the idle and suspend paths
> so any CPU PM notifiers are properly called.
>
> [add more description about the need to trigger notifiers only after
>   next power states are programmed.]
>
> Signed-off-by: Kevin Hilman<[email-masked]>
> ---
>   arch/arm/mach-omap2/pm24xx.c |    5 +++++
>   arch/arm/mach-omap2/pm34xx.c |    5 +++++
>   2 files changed, 10 insertions(+), 0 deletions(-)
>

[...]

> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 7255d9b..b167c7f 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -29,6 +29,7 @@
>   #include<linux/delay.h>
>   #include<linux/slab.h>
>   #include<linux/console.h>
> +#include<linux/cpu_pm.h>
>   #include<trace/events/power.h>
>
>   #include<asm/suspend.h>
> @@ -386,6 +387,8 @@ void omap_sram_idle(void)
>   			if (!console_trylock())
>   				goto console_still_active;
>
> +	cpu_pm_enter();
> +
I don't think you should blindly call CPU_PM notifiers.
This should called if the MPU targeted state is OFF.
With blind notifiers, CPU context like VFP or GIC or L2
will be saved and restored even if CPU/CPU cluster is
not entering into low power. This is highly un-optimal for
CPUIDLE and defeats the purpose of adding different
CPU PM events.

Looking at your UART driver notfier usage, you might need
add new events instead of using the CPU and CPU cluster
events.

Even though on OMAP UART is idles as part of CPU, it's still
an independent PD.

E.g just to make a point,
MPU is programmed to INACTIVE and let say PER PD is programmed
to OFF.
 From MPU point of view the CPU_PM notifier change need not be called 
because, it's doesn't loose any context, but UART notifier needs to
be executed since UART context must be saved.

Regards
Santosh