OMAP3+: SR: enable/disable SR only on need
authorNishanth Menon <nm@ti.com>
Mon, 14 Feb 2011 15:44:17 +0000 (21:14 +0530)
committerKevin Hilman <khilman@ti.com>
Mon, 20 Jun 2011 21:12:31 +0000 (14:12 -0700)
Since we already know the state of the autocomp enablement, we can
see if the requested state is different from the current state and
enable/disable SR only on the need basis.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-omap2/smartreflex.c

index 616ef62b3fa51ebe7ee70c006f34e4c5c48dc611..3bd9facd8e0dcd269daa9c3aaad1c81ef7d10a9f 100644 (file)
@@ -807,10 +807,13 @@ static int omap_sr_autocomp_store(void *data, u64 val)
                return -EINVAL;
        }
 
-       if (!val)
-               sr_stop_vddautocomp(sr_info);
-       else
-               sr_start_vddautocomp(sr_info);
+       /* control enable/disable only if there is a delta in value */
+       if (sr_info->autocomp_active != val) {
+               if (!val)
+                       sr_stop_vddautocomp(sr_info);
+               else
+                       sr_start_vddautocomp(sr_info);
+       }
 
        return 0;
 }