linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] imxfb: add flag to avoid disabling clk multiple times
@ 2010-06-03 10:34 Luotao Fu
  2010-06-19 15:48 ` Martin Fuzzey
  0 siblings, 1 reply; 4+ messages in thread
From: Luotao Fu @ 2010-06-03 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

while the imxfb driver blanks the screen. The clock supply to the framebuffer
controller is disabled. The same callback to disable the fb is, however, also
used the remove and shutdown hooks of the imxfb platform driver. This means that
the imxfb driver can run into a WARN in clock_disable while unloading or
rebooting, if the screen is blanked previously, since the same clock will be
than eventually disabled multiple times.  This patch adds a flag to make sure
that the clock will only be disabled, if it was not already disabled before.

The remove or shutdown callbacks in the imxfb platform driver call
imxfb_disable_controller to disable the hardware,

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
---
 drivers/video/imxfb.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 17c6b5f..6ef9817 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -35,6 +35,7 @@
 
 #include <mach/imxfb.h>
 #include <mach/hardware.h>
+#include <mach/clock.h>
 
 /*
  * Complain if VAR is out of range.
@@ -176,6 +177,7 @@ struct imxfb_info {
 
 	struct imx_fb_videomode *mode;
 	int			num_modes;
+	bool			fbclk_disabled;
 
 	void (*lcd_power)(int);
 	void (*backlight_power)(int);
@@ -466,6 +468,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 	writel(RMCR_LCDC_EN, fbi->regs + LCDC_RMCR);
 
 	clk_enable(fbi->clk);
+	fbi->fbclk_disabled = 0;
 
 	if (fbi->backlight_power)
 		fbi->backlight_power(1);
@@ -482,7 +485,10 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 	if (fbi->lcd_power)
 		fbi->lcd_power(0);
 
-	clk_disable(fbi->clk);
+	if (!fbi->fbclk_disabled) {
+		fbi->fbclk_disabled = 1;
+		clk_disable(fbi->clk);
+	}
 
 	writel(0, fbi->regs + LCDC_RMCR);
 }
@@ -863,7 +869,10 @@ static int __devexit imxfb_remove(struct platform_device *pdev)
 
 	iounmap(fbi->regs);
 	release_mem_region(res->start, resource_size(res));
-	clk_disable(fbi->clk);
+
+	if (!fbi->fbclk_disabled)
+		clk_disable(fbi->clk);
+
 	clk_put(fbi->clk);
 
 	platform_set_drvdata(pdev, NULL);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-01 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03 10:34 [PATCH] imxfb: add flag to avoid disabling clk multiple times Luotao Fu
2010-06-19 15:48 ` Martin Fuzzey
2010-06-21  7:37   ` Luotao Fu
2010-07-01 10:50   ` Luotao Fu

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).