[PATCH 2/2] Hook into PM counters

2008-10-15 Thread Peter 'p2' De Schrijver
This patch modifies the clock, clockdomain and OMAP3 specific powerdomain
code to call the PM counter infrastructure whenever one or more powerdomains
might have changed state.

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
_omap2_clk_disable(clk);
+   if (clk-clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk-clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..1fbb690 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_transition();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_transition();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] Hook into PM counters

2008-10-01 Thread Kevin Hilman
Peter 'p2' De Schrijver [EMAIL PROTECTED] writes:

 Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
 ---
  arch/arm/mach-omap2/clock.c   |2 ++
  arch/arm/mach-omap2/clockdomain.c |4 
  arch/arm/mach-omap2/pm34xx.c  |6 ++
  3 files changed, 12 insertions(+), 0 deletions(-)

 diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
 index c3af24e..dbbc7c8 100644
 --- a/arch/arm/mach-omap2/clock.c
 +++ b/arch/arm/mach-omap2/clock.c
 @@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
  
   printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
   _omap2_clk_disable(clk);
 + if (clk-clkdm.ptr != NULL)
 + pwrdm_clkdm_state_switch(clk-clkdm.ptr);
  }
  #endif
 diff --git a/arch/arm/mach-omap2/clockdomain.c 
 b/arch/arm/mach-omap2/clockdomain.c
 index fa62f14..5249fe8 100644
 --- a/arch/arm/mach-omap2/clockdomain.c
 +++ b/arch/arm/mach-omap2/clockdomain.c
 @@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
 struct clk *clk)
   else
   omap2_clkdm_wakeup(clkdm);
  
 + pwrdm_clkdm_state_switch(clkdm);
 +
   return 0;
  }
  
 @@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
 struct clk *clk)
   else
   omap2_clkdm_sleep(clkdm);
  
 + pwrdm_clkdm_state_switch(clkdm);
 +
   return 0;
  }
  
 diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
 index a828db6..5913c4d 100644
 --- a/arch/arm/mach-omap2/pm34xx.c
 +++ b/arch/arm/mach-omap2/pm34xx.c
 @@ -170,6 +170,8 @@ static void omap_sram_idle(void)
   disable_smartreflex(SR1);
   disable_smartreflex(SR2);
  
 + pwrdm_pre_suspend();
 +

Maybe these hooks shouldn't be called suspend since they happen for
idle and for suspend.  Maybe pwrdm_pre_transition() ?

   omap2_gpio_prepare_for_retention();
  
   _omap_sram_idle(NULL, save_state);
 @@ -179,6 +181,9 @@ static void omap_sram_idle(void)
   /* Enable smartreflex after WFI */
   enable_smartreflex(SR1);
   enable_smartreflex(SR2);
 +
 + pwrdm_post_suspend();
 +

ditto.

  }
  
  /*
 @@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
 state)
   if (sleep_switch) {
   omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
   pwrdm_wait_transition(pwrdm);
 + pwrdm_state_switch(pwrdm);
   }
  
  err:
 -- 
 1.5.6.3

 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Hook into PM counters

2008-10-01 Thread Peter 'p2' De Schrijver

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
_omap2_clk_disable(clk);
+   if (clk-clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk-clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..1fbb690 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_transition();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_transition();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Hook into PM counters

2008-09-26 Thread Peter 'p2' De Schrijver

Signed-off-by: Peter 'p2' De Schrijver [EMAIL PROTECTED]
---
 arch/arm/mach-omap2/clock.c   |2 ++
 arch/arm/mach-omap2/clockdomain.c |4 
 arch/arm/mach-omap2/pm34xx.c  |6 ++
 3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index c3af24e..dbbc7c8 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -1013,5 +1013,7 @@ void omap2_clk_disable_unused(struct clk *clk)
 
printk(KERN_INFO Disabling unused clock \%s\\n, clk-name);
_omap2_clk_disable(clk);
+   if (clk-clkdm.ptr != NULL)
+   pwrdm_clkdm_state_switch(clk-clkdm.ptr);
 }
 #endif
diff --git a/arch/arm/mach-omap2/clockdomain.c 
b/arch/arm/mach-omap2/clockdomain.c
index fa62f14..5249fe8 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -567,6 +567,8 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_wakeup(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
@@ -618,6 +620,8 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, 
struct clk *clk)
else
omap2_clkdm_sleep(clkdm);
 
+   pwrdm_clkdm_state_switch(clkdm);
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a828db6..5913c4d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -170,6 +170,8 @@ static void omap_sram_idle(void)
disable_smartreflex(SR1);
disable_smartreflex(SR2);
 
+   pwrdm_pre_suspend();
+
omap2_gpio_prepare_for_retention();
 
_omap_sram_idle(NULL, save_state);
@@ -179,6 +181,9 @@ static void omap_sram_idle(void)
/* Enable smartreflex after WFI */
enable_smartreflex(SR1);
enable_smartreflex(SR2);
+
+   pwrdm_post_suspend();
+
 }
 
 /*
@@ -260,6 +265,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 
state)
if (sleep_switch) {
omap2_clkdm_allow_idle(pwrdm-pwrdm_clkdms[0]);
pwrdm_wait_transition(pwrdm);
+   pwrdm_state_switch(pwrdm);
}
 
 err:
-- 
1.5.6.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html