VIDEO: amba clcd: don't disable an already disabled clock
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 17 Aug 2010 21:13:22 +0000 (22:13 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 17 Aug 2010 21:15:09 +0000 (22:15 +0100)
Fix the clock enable/disable tracking in the AMBA CLCD driver so
that the driver doesn't try to disable an already disabled clock,
thereby causing the clock (if shared) to become unbalanced.

This resolves a problem with CLCD on LPC32xx ARM platforms.

Reported-by: Kevin Wells <wellsk40@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/video/amba-clcd.c
include/linux/amba/clcd.h

index afe21e6eb5443cc8e8056e6f630fbd1c89caf991..1c2c68356ea7ecce8d3983fba656a4faf9cd26ae 100644 (file)
@@ -80,7 +80,10 @@ static void clcdfb_disable(struct clcd_fb *fb)
        /*
         * Disable CLCD clock source.
         */
-       clk_disable(fb->clk);
+       if (fb->clk_enabled) {
+               fb->clk_enabled = false;
+               clk_disable(fb->clk);
+       }
 }
 
 static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)
@@ -88,7 +91,10 @@ static void clcdfb_enable(struct clcd_fb *fb, u32 cntl)
        /*
         * Enable the CLCD clock source.
         */
-       clk_enable(fb->clk);
+       if (!fb->clk_enabled) {
+               fb->clk_enabled = true;
+               clk_enable(fb->clk);
+       }
 
        /*
         * Bring up by first enabling..
index ca16c3801a1e7c26332efd842be95c4299bcd1b4..be33b3affc8ada39fdaaf78bb2deefaca8385615 100644 (file)
@@ -150,6 +150,7 @@ struct clcd_fb {
        u16                     off_cntl;
        u32                     clcd_cntl;
        u32                     cmap[16];
+       bool                    clk_enabled;
 };
 
 static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)