All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4
@ 2010-12-16 12:46 ` Rajendra Nayak
  0 siblings, 0 replies; 6+ messages in thread
From: Rajendra Nayak @ 2010-12-16 12:46 UTC (permalink / raw)
  To: linux-omap
  Cc: linux-arm-kernel, Rajendra Nayak, Santosh Shilimkar, Kevin Hilman,
	Paul Walmsley

For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
up the domain to put it back to deeper sleep state.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
Changes in v2:
Changed implementation for better readability and code
reuse as suggested here
http://marc.info/?l=linux-omap&m=129245686306262&w=2

The below branch is updated with this version of the patch
git://gitorious.org/omap-pm/linux.git for_2.6.38/power

 arch/arm/mach-omap2/pm.c |   28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

Index: linux/arch/arm/mach-omap2/pm.c
===================================================================
--- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-15 17:29:42.361228780 +0530
+++ linux/arch/arm/mach-omap2/pm.c	2010-12-15 20:19:48.321228780 +0530
@@ -89,6 +89,10 @@
 	}
 }
 
+/* Types of sleep_switch used in omap_set_pwrdm_state */
+#define FORCEWAKEUP_SWITCH	0
+#define LOWPOWERSTATE_SWITCH	1
+
 /*
  * This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have
@@ -114,9 +118,14 @@
 		return ret;
 
 	if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
-		omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
-		sleep_switch = 1;
-		pwrdm_wait_transition(pwrdm);
+		if ((pwrdm_read_pwrst(pwrdm) > state) &&
+			(pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
+			sleep_switch = LOWPOWERSTATE_SWITCH;
+		} else {
+			omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
+			pwrdm_wait_transition(pwrdm);
+			sleep_switch = FORCEWAKEUP_SWITCH;
+		}
 	}
 
 	ret = pwrdm_set_next_pwrst(pwrdm, state);
@@ -126,12 +135,19 @@
 		goto err;
 	}
 
-	if (sleep_switch) {
+	switch (sleep_switch) {
+	case FORCEWAKEUP_SWITCH:
 		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
-		pwrdm_wait_transition(pwrdm);
-		pwrdm_state_switch(pwrdm);
+		break;
+	case LOWPOWERSTATE_SWITCH:
+		pwrdm_set_lowpwrstchange(pwrdm);
+		break;
+	default:
+		return ret;
 	}
 
+	pwrdm_wait_transition(pwrdm);
+	pwrdm_state_switch(pwrdm);
 err:
 	return ret;
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4
@ 2010-12-16 12:46 ` Rajendra Nayak
  0 siblings, 0 replies; 6+ messages in thread
From: Rajendra Nayak @ 2010-12-16 12:46 UTC (permalink / raw)
  To: linux-arm-kernel

For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
up the domain to put it back to deeper sleep state.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
Changes in v2:
Changed implementation for better readability and code
reuse as suggested here
http://marc.info/?l=linux-omap&m=129245686306262&w=2

The below branch is updated with this version of the patch
git://gitorious.org/omap-pm/linux.git for_2.6.38/power

 arch/arm/mach-omap2/pm.c |   28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

Index: linux/arch/arm/mach-omap2/pm.c
===================================================================
--- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-15 17:29:42.361228780 +0530
+++ linux/arch/arm/mach-omap2/pm.c	2010-12-15 20:19:48.321228780 +0530
@@ -89,6 +89,10 @@
 	}
 }
 
+/* Types of sleep_switch used in omap_set_pwrdm_state */
+#define FORCEWAKEUP_SWITCH	0
+#define LOWPOWERSTATE_SWITCH	1
+
 /*
  * This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported. Function is assuming that clkdm doesn't have
@@ -114,9 +118,14 @@
 		return ret;
 
 	if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
-		omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
-		sleep_switch = 1;
-		pwrdm_wait_transition(pwrdm);
+		if ((pwrdm_read_pwrst(pwrdm) > state) &&
+			(pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
+			sleep_switch = LOWPOWERSTATE_SWITCH;
+		} else {
+			omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
+			pwrdm_wait_transition(pwrdm);
+			sleep_switch = FORCEWAKEUP_SWITCH;
+		}
 	}
 
 	ret = pwrdm_set_next_pwrst(pwrdm, state);
@@ -126,12 +135,19 @@
 		goto err;
 	}
 
-	if (sleep_switch) {
+	switch (sleep_switch) {
+	case FORCEWAKEUP_SWITCH:
 		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
-		pwrdm_wait_transition(pwrdm);
-		pwrdm_state_switch(pwrdm);
+		break;
+	case LOWPOWERSTATE_SWITCH:
+		pwrdm_set_lowpwrstchange(pwrdm);
+		break;
+	default:
+		return ret;
 	}
 
+	pwrdm_wait_transition(pwrdm);
+	pwrdm_state_switch(pwrdm);
 err:
 	return ret;
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/5] OMAP4: PM: Do not assume clkdm supports hw transitions
  2010-12-16 12:46 ` Rajendra Nayak
@ 2010-12-16 12:46   ` Rajendra Nayak
  -1 siblings, 0 replies; 6+ messages in thread
From: Rajendra Nayak @ 2010-12-16 12:46 UTC (permalink / raw)
  To: linux-omap
  Cc: linux-arm-kernel, Rajendra Nayak, Santosh Shilimkar,
	Paul Walmsley

omap_set_pwrdm_state today assumes a clkdm supports hw_auto
transitions and hence leaves some which do not support this
in sw wkup state preventing low power transitions.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
Changes in v2:
Rebased the patch on the previous patch in the series

The below branch is updated with this version of the patch
git://gitorious.org/omap-pm/linux.git for_2.6.38/power

 arch/arm/mach-omap2/pm.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux/arch/arm/mach-omap2/pm.c
===================================================================
--- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-16 11:47:35.000000000 +0530
+++ linux/arch/arm/mach-omap2/pm.c	2010-12-16 11:48:49.073228787 +0530
@@ -95,8 +95,7 @@
 
 /*
  * This sets pwrdm state (other than mpu & core. Currently only ON &
- * RET are supported. Function is assuming that clkdm doesn't have
- * hw_sup mode enabled.
+ * RET are supported.
  */
 int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
 {
@@ -137,7 +136,10 @@
 
 	switch (sleep_switch) {
 	case FORCEWAKEUP_SWITCH:
-		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
+		if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO)
+			omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
+		else
+			omap2_clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
 		break;
 	case LOWPOWERSTATE_SWITCH:
 		pwrdm_set_lowpwrstchange(pwrdm);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/5] OMAP4: PM: Do not assume clkdm supports hw transitions
@ 2010-12-16 12:46   ` Rajendra Nayak
  0 siblings, 0 replies; 6+ messages in thread
From: Rajendra Nayak @ 2010-12-16 12:46 UTC (permalink / raw)
  To: linux-arm-kernel

omap_set_pwrdm_state today assumes a clkdm supports hw_auto
transitions and hence leaves some which do not support this
in sw wkup state preventing low power transitions.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Paul Walmsley <paul@pwsan.com>
---
Changes in v2:
Rebased the patch on the previous patch in the series

The below branch is updated with this version of the patch
git://gitorious.org/omap-pm/linux.git for_2.6.38/power

 arch/arm/mach-omap2/pm.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux/arch/arm/mach-omap2/pm.c
===================================================================
--- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-16 11:47:35.000000000 +0530
+++ linux/arch/arm/mach-omap2/pm.c	2010-12-16 11:48:49.073228787 +0530
@@ -95,8 +95,7 @@
 
 /*
  * This sets pwrdm state (other than mpu & core. Currently only ON &
- * RET are supported. Function is assuming that clkdm doesn't have
- * hw_sup mode enabled.
+ * RET are supported.
  */
 int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
 {
@@ -137,7 +136,10 @@
 
 	switch (sleep_switch) {
 	case FORCEWAKEUP_SWITCH:
-		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
+		if (pwrdm->pwrdm_clkdms[0]->flags & CLKDM_CAN_ENABLE_AUTO)
+			omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
+		else
+			omap2_clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
 		break;
 	case LOWPOWERSTATE_SWITCH:
 		pwrdm_set_lowpwrstchange(pwrdm);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4
  2010-12-16 12:46 ` Rajendra Nayak
@ 2010-12-16 16:45   ` Kevin Hilman
  -1 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2010-12-16 16:45 UTC (permalink / raw)
  To: Rajendra Nayak
  Cc: linux-omap, linux-arm-kernel, Santosh Shilimkar, Paul Walmsley

Rajendra Nayak <rnayak@ti.com> writes:

> For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
> up the domain to put it back to deeper sleep state.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Acked-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Paul Walmsley <paul@pwsan.com>

Acked-by: Kevin Hilman <khilman@deeprootsystems.com>

> ---
> Changes in v2:
> Changed implementation for better readability and code
> reuse as suggested here
> http://marc.info/?l=linux-omap&m=129245686306262&w=2
>
> The below branch is updated with this version of the patch
> git://gitorious.org/omap-pm/linux.git for_2.6.38/power
>
>  arch/arm/mach-omap2/pm.c |   28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)
>
> Index: linux/arch/arm/mach-omap2/pm.c
> ===================================================================
> --- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-15 17:29:42.361228780 +0530
> +++ linux/arch/arm/mach-omap2/pm.c	2010-12-15 20:19:48.321228780 +0530
> @@ -89,6 +89,10 @@
>  	}
>  }
>  
> +/* Types of sleep_switch used in omap_set_pwrdm_state */
> +#define FORCEWAKEUP_SWITCH	0
> +#define LOWPOWERSTATE_SWITCH	1
> +
>  /*
>   * This sets pwrdm state (other than mpu & core. Currently only ON &
>   * RET are supported. Function is assuming that clkdm doesn't have
> @@ -114,9 +118,14 @@
>  		return ret;
>  
>  	if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
> -		omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> -		sleep_switch = 1;
> -		pwrdm_wait_transition(pwrdm);
> +		if ((pwrdm_read_pwrst(pwrdm) > state) &&
> +			(pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
> +			sleep_switch = LOWPOWERSTATE_SWITCH;
> +		} else {
> +			omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> +			pwrdm_wait_transition(pwrdm);
> +			sleep_switch = FORCEWAKEUP_SWITCH;
> +		}
>  	}
>  
>  	ret = pwrdm_set_next_pwrst(pwrdm, state);
> @@ -126,12 +135,19 @@
>  		goto err;
>  	}
>  
> -	if (sleep_switch) {
> +	switch (sleep_switch) {
> +	case FORCEWAKEUP_SWITCH:
>  		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
> -		pwrdm_wait_transition(pwrdm);
> -		pwrdm_state_switch(pwrdm);
> +		break;
> +	case LOWPOWERSTATE_SWITCH:
> +		pwrdm_set_lowpwrstchange(pwrdm);
> +		break;
> +	default:
> +		return ret;
>  	}
>  
> +	pwrdm_wait_transition(pwrdm);
> +	pwrdm_state_switch(pwrdm);
>  err:
>  	return ret;
>  }

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4
@ 2010-12-16 16:45   ` Kevin Hilman
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2010-12-16 16:45 UTC (permalink / raw)
  To: linux-arm-kernel

Rajendra Nayak <rnayak@ti.com> writes:

> For pwrdm's which support LOWPOWERSTATECHANGE, do not try waking
> up the domain to put it back to deeper sleep state.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Acked-by: Benoit Cousson <b-cousson@ti.com>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Paul Walmsley <paul@pwsan.com>

Acked-by: Kevin Hilman <khilman@deeprootsystems.com>

> ---
> Changes in v2:
> Changed implementation for better readability and code
> reuse as suggested here
> http://marc.info/?l=linux-omap&m=129245686306262&w=2
>
> The below branch is updated with this version of the patch
> git://gitorious.org/omap-pm/linux.git for_2.6.38/power
>
>  arch/arm/mach-omap2/pm.c |   28 ++++++++++++++++++++++------
>  1 file changed, 22 insertions(+), 6 deletions(-)
>
> Index: linux/arch/arm/mach-omap2/pm.c
> ===================================================================
> --- linux.orig/arch/arm/mach-omap2/pm.c	2010-12-15 17:29:42.361228780 +0530
> +++ linux/arch/arm/mach-omap2/pm.c	2010-12-15 20:19:48.321228780 +0530
> @@ -89,6 +89,10 @@
>  	}
>  }
>  
> +/* Types of sleep_switch used in omap_set_pwrdm_state */
> +#define FORCEWAKEUP_SWITCH	0
> +#define LOWPOWERSTATE_SWITCH	1
> +
>  /*
>   * This sets pwrdm state (other than mpu & core. Currently only ON &
>   * RET are supported. Function is assuming that clkdm doesn't have
> @@ -114,9 +118,14 @@
>  		return ret;
>  
>  	if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
> -		omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> -		sleep_switch = 1;
> -		pwrdm_wait_transition(pwrdm);
> +		if ((pwrdm_read_pwrst(pwrdm) > state) &&
> +			(pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
> +			sleep_switch = LOWPOWERSTATE_SWITCH;
> +		} else {
> +			omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
> +			pwrdm_wait_transition(pwrdm);
> +			sleep_switch = FORCEWAKEUP_SWITCH;
> +		}
>  	}
>  
>  	ret = pwrdm_set_next_pwrst(pwrdm, state);
> @@ -126,12 +135,19 @@
>  		goto err;
>  	}
>  
> -	if (sleep_switch) {
> +	switch (sleep_switch) {
> +	case FORCEWAKEUP_SWITCH:
>  		omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
> -		pwrdm_wait_transition(pwrdm);
> -		pwrdm_state_switch(pwrdm);
> +		break;
> +	case LOWPOWERSTATE_SWITCH:
> +		pwrdm_set_lowpwrstchange(pwrdm);
> +		break;
> +	default:
> +		return ret;
>  	}
>  
> +	pwrdm_wait_transition(pwrdm);
> +	pwrdm_state_switch(pwrdm);
>  err:
>  	return ret;
>  }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-16 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 12:46 [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4 Rajendra Nayak
2010-12-16 12:46 ` Rajendra Nayak
2010-12-16 12:46 ` [PATCH v2 2/5] OMAP4: PM: Do not assume clkdm supports hw transitions Rajendra Nayak
2010-12-16 12:46   ` Rajendra Nayak
2010-12-16 16:45 ` [PATCH v2 1/5] OMAP4: PM: Use the low-power state change feature on OMAP4 Kevin Hilman
2010-12-16 16:45   ` Kevin Hilman

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.