diff options
Diffstat (limited to 'arch/arm/plat-omap/omap-pm-noop.c')
-rw-r--r-- | arch/arm/plat-omap/omap-pm-noop.c | 67 |
1 files changed, 54 insertions, 13 deletions
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c index ca75abb18068..b0471bb2d47d 100644 --- a/arch/arm/plat-omap/omap-pm-noop.c +++ b/arch/arm/plat-omap/omap-pm-noop.c | |||
@@ -20,11 +20,14 @@ | |||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/cpufreq.h> | 21 | #include <linux/cpufreq.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/platform_device.h> | ||
23 | 24 | ||
24 | /* Interface documentation is in mach/omap-pm.h */ | 25 | /* Interface documentation is in mach/omap-pm.h */ |
25 | #include <plat/omap-pm.h> | 26 | #include <plat/omap-pm.h> |
27 | #include <plat/omap_device.h> | ||
26 | 28 | ||
27 | #include <plat/powerdomain.h> | 29 | static bool off_mode_enabled; |
30 | static u32 dummy_context_loss_counter; | ||
28 | 31 | ||
29 | /* | 32 | /* |
30 | * Device-driver-originated constraints (via board-*.c files) | 33 | * Device-driver-originated constraints (via board-*.c files) |
@@ -280,28 +283,66 @@ 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 | */ | ||
292 | void 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 | */ | ||
303 | void 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 | ||
287 | int omap_pm_get_dev_context_loss_count(struct device *dev) | 312 | #ifdef CONFIG_ARCH_OMAP2PLUS |
313 | |||
314 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | ||
288 | { | 315 | { |
289 | if (!dev) { | 316 | struct platform_device *pdev = to_platform_device(dev); |
290 | WARN_ON(1); | 317 | u32 count; |
291 | return -EINVAL; | 318 | |
292 | }; | 319 | if (WARN_ON(!dev)) |
320 | return 0; | ||
321 | |||
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 | } | ||
293 | 331 | ||
294 | pr_debug("OMAP PM: returning context loss count for dev %s\n", | 332 | pr_debug("OMAP PM: context loss count for dev %s = %d\n", |
295 | dev_name(dev)); | 333 | dev_name(dev), count); |
296 | 334 | ||
297 | /* | 335 | return count; |
298 | * Map the device to the powerdomain. Return the powerdomain | 336 | } |
299 | * off counter. | ||
300 | */ | ||
301 | 337 | ||
302 | return 0; | 338 | #else |
339 | |||
340 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) | ||
341 | { | ||
342 | return dummy_context_loss_counter; | ||
303 | } | 343 | } |
304 | 344 | ||
345 | #endif | ||
305 | 346 | ||
306 | /* Should be called before clk framework init */ | 347 | /* Should be called before clk framework init */ |
307 | int __init omap_pm_if_early_init(void) | 348 | int __init omap_pm_if_early_init(void) |