From: Trilok Soni <[EMAIL PROTECTED]>

- Disable un-used clocks, this will save bit of power. It has
got Kconfig option, so if all of your drivers are not yet
using clock framework then you can disable this feature until
they are ready with clk framework.

Signed-off-by: Trilok Soni <[EMAIL PROTECTED]>
---
 arch/arm/mach-davinci/Kconfig |   12 ++++++++++++
 arch/arm/mach-davinci/clock.c |   24 ++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index aed1e70..dc666da 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -43,6 +43,18 @@ config DAVINCI_MCBSP
        ---help---
        DaVinci McBSP driver.  Auto-enabled by DaVinci sound driver.
 
+config DAVINCI_RESET_CLOCKS
+       bool "Reset unused clocks during boot"
+       depends on ARCH_DAVINCI
+       help
+         Say Y if you want to reset unused clocks during boot.
+         This option saves power, but assumes all drivers are
+         using the clock framework. Broken drivers that do not
+         yet use clock framework may not work with this option.
+         If you are booting from another operating system, you
+         probably do not want this option enabled until your
+         device drivers work properly.
+
 config DAVINCI_BOOT_TAG
        bool "DaVinci bootloader information passing"
         depends on ARCH_DAVINCI644x
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 8a91ac1..d9f3079 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -247,6 +247,30 @@ static struct clk davinci_clks[] = {
        }
 };
 
+#ifdef CONFIG_DAVINCI_RESET_CLOCKS
+/*
+ * Disable any unused clocks left on by the bootloader
+ */
+static int __init clk_disable_unused(void)
+{
+       struct clk *ck;
+       unsigned long flags;
+
+       list_for_each_entry(ck, &clocks, node) {
+               if (ck->usecount > 0 || (ck->flags & ALWAYS_ENABLED))
+                       continue;
+
+               printk(KERN_INFO "Clocks: disable unused %s\n", ck->name);
+               spin_lock_irqsave(&clockfw_lock, flags);
+               __clk_disable(ck);
+               spin_unlock_irqrestore(&clockfw_lock, flags);
+       }
+
+       return 0;
+}
+late_initcall(clk_disable_unused);
+#endif
+
 int __init davinci_clk_init(void)
 {
        struct clk *clkp;
-- 
1.5.5

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to