Skip to content

Commit

Permalink
VIDEO: amba clcd: don't disable an already disabled clock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King committed Aug 17, 2010
1 parent 41e2e8f commit 99c796d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/video/amba-clcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,21 @@ 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)
{
/*
* 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..
Expand Down
1 change: 1 addition & 0 deletions include/linux/amba/clcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 99c796d

Please sign in to comment.