aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/pm-debug.c5
-rw-r--r--arch/arm/plat-omap/include/plat/omap-pm.h2
-rw-r--r--arch/arm/plat-omap/omap-pm-noop.c46
3 files changed, 52 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index e535082b0c2e..125f56591fb5 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -32,6 +32,7 @@
32#include "powerdomain.h" 32#include "powerdomain.h"
33#include "clockdomain.h" 33#include "clockdomain.h"
34#include <plat/dmtimer.h> 34#include <plat/dmtimer.h>
35#include <plat/omap-pm.h>
35 36
36#include "cm2xxx_3xxx.h" 37#include "cm2xxx_3xxx.h"
37#include "prm2xxx_3xxx.h" 38#include "prm2xxx_3xxx.h"
@@ -581,6 +582,10 @@ static int option_set(void *data, u64 val)
581 *option = val; 582 *option = val;
582 583
583 if (option == &enable_off_mode) { 584 if (option == &enable_off_mode) {
585 if (val)
586 omap_pm_enable_off_mode();
587 else
588 omap_pm_disable_off_mode();
584 if (cpu_is_omap34xx()) 589 if (cpu_is_omap34xx())
585 omap3_pm_off_mode_enable(val); 590 omap3_pm_off_mode_enable(val);
586 } 591 }
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h
index c07bb44e9e5a..c0a752053039 100644
--- a/arch/arm/plat-omap/include/plat/omap-pm.h
+++ b/arch/arm/plat-omap/include/plat/omap-pm.h
@@ -354,5 +354,7 @@ unsigned long omap_pm_cpu_get_freq(void);
354 */ 354 */
355u32 omap_pm_get_dev_context_loss_count(struct device *dev); 355u32 omap_pm_get_dev_context_loss_count(struct device *dev);
356 356
357void omap_pm_enable_off_mode(void);
358void omap_pm_disable_off_mode(void);
357 359
358#endif 360#endif
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index af58daddcf50..b0471bb2d47d 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -26,6 +26,9 @@
26#include <plat/omap-pm.h> 26#include <plat/omap-pm.h>
27#include <plat/omap_device.h> 27#include <plat/omap_device.h>
28 28
29static bool off_mode_enabled;
30static u32 dummy_context_loss_counter;
31
29/* 32/*
30 * Device-driver-originated constraints (via board-*.c files) 33 * Device-driver-originated constraints (via board-*.c files)
31 */ 34 */
@@ -280,10 +283,34 @@ unsigned long omap_pm_cpu_get_freq(void)
280 return 0; 283 return 0;
281} 284}
282 285
286/**
287 * omap_pm_enable_off_mode - notify OMAP PM that off-mode is enabled
288 *
289 * Intended for use only by OMAP PM core code to notify this layer
290 * that off mode has been enabled.
291 */
292void omap_pm_enable_off_mode(void)
293{
294 off_mode_enabled = true;
295}
296
297/**
298 * omap_pm_disable_off_mode - notify OMAP PM that off-mode is disabled
299 *
300 * Intended for use only by OMAP PM core code to notify this layer
301 * that off mode has been disabled.
302 */
303void omap_pm_disable_off_mode(void)
304{
305 off_mode_enabled = false;
306}
307
283/* 308/*
284 * Device context loss tracking 309 * Device context loss tracking
285 */ 310 */
286 311
312#ifdef CONFIG_ARCH_OMAP2PLUS
313
287u32 omap_pm_get_dev_context_loss_count(struct device *dev) 314u32 omap_pm_get_dev_context_loss_count(struct device *dev)
288{ 315{
289 struct platform_device *pdev = to_platform_device(dev); 316 struct platform_device *pdev = to_platform_device(dev);
@@ -292,13 +319,30 @@ u32 omap_pm_get_dev_context_loss_count(struct device *dev)
292 if (WARN_ON(!dev)) 319 if (WARN_ON(!dev))
293 return 0; 320 return 0;
294 321
295 count = omap_device_get_context_loss_count(pdev); 322 if (dev->parent == &omap_device_parent) {
323 count = omap_device_get_context_loss_count(pdev);
324 } else {
325 WARN_ONCE(off_mode_enabled, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
326 dev_name(dev));
327 if (off_mode_enabled)
328 dummy_context_loss_counter++;
329 count = dummy_context_loss_counter;
330 }
331
296 pr_debug("OMAP PM: context loss count for dev %s = %d\n", 332 pr_debug("OMAP PM: context loss count for dev %s = %d\n",
297 dev_name(dev), count); 333 dev_name(dev), count);
298 334
299 return count; 335 return count;
300} 336}
301 337
338#else
339
340u32 omap_pm_get_dev_context_loss_count(struct device *dev)
341{
342 return dummy_context_loss_counter;
343}
344
345#endif
302 346
303/* Should be called before clk framework init */ 347/* Should be called before clk framework init */
304int __init omap_pm_if_early_init(void) 348int __init omap_pm_if_early_init(void)