Browse Source

Merge tag 'imx-fixes-3.8-3' of git://git.linaro.org/people/shawnguo/linux-2.6 into fixes

From Shawn Guo:

This is yet another critical imxfb fixes held off by absence of FB
maintainer for some time.

* tag 'imx-fixes-3.8-3' of git://git.linaro.org/people/shawnguo/linux-2.6:
  video: imxfb: Do not crash on reboot
Olof Johansson 12 years ago
parent
commit
4ad3041d3b
1 changed files with 10 additions and 0 deletions
  1. 10 0
      drivers/video/imxfb.c

+ 10 - 0
drivers/video/imxfb.c

@@ -139,6 +139,7 @@ struct imxfb_info {
 	struct clk		*clk_ahb;
 	struct clk		*clk_ahb;
 	struct clk		*clk_per;
 	struct clk		*clk_per;
 	enum imxfb_type		devtype;
 	enum imxfb_type		devtype;
+	bool			enabled;
 
 
 	/*
 	/*
 	 * These are the addresses we mapped
 	 * These are the addresses we mapped
@@ -536,6 +537,10 @@ static void imxfb_exit_backlight(struct imxfb_info *fbi)
 
 
 static void imxfb_enable_controller(struct imxfb_info *fbi)
 static void imxfb_enable_controller(struct imxfb_info *fbi)
 {
 {
+
+	if (fbi->enabled)
+		return;
+
 	pr_debug("Enabling LCD controller\n");
 	pr_debug("Enabling LCD controller\n");
 
 
 	writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
 	writel(fbi->screen_dma, fbi->regs + LCDC_SSA);
@@ -556,6 +561,7 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 	clk_prepare_enable(fbi->clk_ipg);
 	clk_prepare_enable(fbi->clk_ipg);
 	clk_prepare_enable(fbi->clk_ahb);
 	clk_prepare_enable(fbi->clk_ahb);
 	clk_prepare_enable(fbi->clk_per);
 	clk_prepare_enable(fbi->clk_per);
+	fbi->enabled = true;
 
 
 	if (fbi->backlight_power)
 	if (fbi->backlight_power)
 		fbi->backlight_power(1);
 		fbi->backlight_power(1);
@@ -565,6 +571,9 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 
 
 static void imxfb_disable_controller(struct imxfb_info *fbi)
 static void imxfb_disable_controller(struct imxfb_info *fbi)
 {
 {
+	if (!fbi->enabled)
+		return;
+
 	pr_debug("Disabling LCD controller\n");
 	pr_debug("Disabling LCD controller\n");
 
 
 	if (fbi->backlight_power)
 	if (fbi->backlight_power)
@@ -575,6 +584,7 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 	clk_disable_unprepare(fbi->clk_per);
 	clk_disable_unprepare(fbi->clk_per);
 	clk_disable_unprepare(fbi->clk_ipg);
 	clk_disable_unprepare(fbi->clk_ipg);
 	clk_disable_unprepare(fbi->clk_ahb);
 	clk_disable_unprepare(fbi->clk_ahb);
+	fbi->enabled = false;
 
 
 	writel(0, fbi->regs + LCDC_RMCR);
 	writel(0, fbi->regs + LCDC_RMCR);
 }
 }