linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: wellsk40@gmail.com (wellsk40 at gmail.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] video: amba_clcd: Fix driver clock enable/disable balance issues
Date: Wed, 11 Aug 2010 16:03:03 -0700	[thread overview]
Message-ID: <1281567784-12684-2-git-send-email-wellsk40@gmail.com> (raw)
In-Reply-To: <1281567784-12684-1-git-send-email-wellsk40@gmail.com>

From: Kevin Wells <wellsk40@gmail.com>

The amba clcd clock enable and disable calls can become unbalanced.
This usually occurs on the first call to clcdfb_set_par() during
LCD init, but can also occur when the LCD enters and exits blank
state. This fix prevents clk_disable() from being called until
clk_enable() has been called first.

Signed-off-by: Kevin Wells <wellsk40@gmail.com>
---
 drivers/video/amba-clcd.c |   10 ++++++++--
 include/linux/amba/clcd.h |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c
index afe21e6..1c2c683 100644
--- a/drivers/video/amba-clcd.c
+++ b/drivers/video/amba-clcd.c
@@ -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..
diff --git a/include/linux/amba/clcd.h b/include/linux/amba/clcd.h
index ca16c38..7bbf26a 100644
--- a/include/linux/amba/clcd.h
+++ b/include/linux/amba/clcd.h
@@ -142,6 +142,7 @@ struct clcd_fb {
 	struct fb_info		fb;
 	struct amba_device	*dev;
 	struct clk		*clk;
+	bool			clk_enabled;
 	struct clcd_panel	*panel;
 	struct clcd_board	*board;
 	void			*board_data;
-- 
1.7.1.1

  reply	other threads:[~2010-08-11 23:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 23:03 video: amba_clcd: Clock balance fixes and power optimization changes wellsk40 at gmail.com
2010-08-11 23:03 ` wellsk40 at gmail.com [this message]
2010-08-17 21:17   ` [PATCH 1/2] video: amba_clcd: Fix driver clock enable/disable balance issues Russell King - ARM Linux
2010-08-17 23:04     ` Kevin Wells
2010-08-11 23:03 ` [PATCH 2/2] video: amba_clcd: Seperate controller and register clock enables wellsk40 at gmail.com
2010-08-17 17:30 ` video: amba_clcd: Clock balance fixes and power optimization changes Kevin Wells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281567784-12684-2-git-send-email-wellsk40@gmail.com \
    --to=wellsk40@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).