rk3288: modify to ensure pairwise call of clk_enable\disable
authordkl <dkl@rock-chips.com>
Tue, 3 Feb 2015 06:15:27 +0000 (14:15 +0800)
committerdkl <dkl@rock-chips.com>
Tue, 3 Feb 2015 06:26:58 +0000 (14:26 +0800)
        in rk3288_pll_early_suspend_notifier_call

Signed-off-by: dkl <dkl@rock-chips.com>
arch/arm/mach-rockchip/rk3288.c

index de229db2a63a0079498c21a31264ec44d03b6ec9..04af8772d603e516ca6a7b2d5a20cac8a8a46a70 100755 (executable)
@@ -504,12 +504,16 @@ static int rk3288_pll_early_suspend_notifier_call(struct notifier_block *self,
 {
        struct fb_event *event = data;
        int blank_mode = *((int *)event->data);
+       static bool enable = false;
 
        if (action == FB_EARLY_EVENT_BLANK) {
                switch (blank_mode) {
                case FB_BLANK_UNBLANK:
-                       clk_prepare_enable(clk_get_sys(NULL, "clk_cpll"));
-                       clk_prepare_enable(clk_get_sys(NULL, "clk_npll"));
+                       if (!enable) {
+                               clk_prepare_enable(clk_get_sys(NULL, "clk_cpll"));
+                               clk_prepare_enable(clk_get_sys(NULL, "clk_npll"));
+                               enable = true;
+                       }
                        break;
                default:
                        break;
@@ -517,8 +521,11 @@ static int rk3288_pll_early_suspend_notifier_call(struct notifier_block *self,
        } else if (action == FB_EVENT_BLANK) {
                switch (blank_mode) {
                case FB_BLANK_POWERDOWN:
-                       clk_disable_unprepare(clk_get_sys(NULL, "clk_cpll"));
-                       clk_disable_unprepare(clk_get_sys(NULL, "clk_npll"));
+                       if (enable) {
+                               clk_disable_unprepare(clk_get_sys(NULL, "clk_cpll"));
+                               clk_disable_unprepare(clk_get_sys(NULL, "clk_npll"));
+                               enable = false;
+                       }
                        break;
                default:
                        break;