Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

VIDEO: amba clcd: don't disable an already disabled clock

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>

+9 -2
+8 -2
drivers/video/amba-clcd.c
··· 80 80 /* 81 81 * Disable CLCD clock source. 82 82 */ 83 - clk_disable(fb->clk); 83 + if (fb->clk_enabled) { 84 + fb->clk_enabled = false; 85 + clk_disable(fb->clk); 86 + } 84 87 } 85 88 86 89 static void clcdfb_enable(struct clcd_fb *fb, u32 cntl) ··· 91 88 /* 92 89 * Enable the CLCD clock source. 93 90 */ 94 - clk_enable(fb->clk); 91 + if (!fb->clk_enabled) { 92 + fb->clk_enabled = true; 93 + clk_enable(fb->clk); 94 + } 95 95 96 96 /* 97 97 * Bring up by first enabling..
+1
include/linux/amba/clcd.h
··· 150 150 u16 off_cntl; 151 151 u32 clcd_cntl; 152 152 u32 cmap[16]; 153 + bool clk_enabled; 153 154 }; 154 155 155 156 static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)