diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2010-12-21 23:31:55 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-12-21 23:31:55 -0500 |
commit | c80705aa7074045e7431ed2ebeb0f7d5773615ab (patch) | |
tree | 8c62b8e0456a95844237bdb87e021318fc588f9a /arch/arm/plat-omap/omap-pm-noop.c | |
parent | 7f595674e08b8b4d3faf64a19bccc95445d7ed35 (diff) |
OMAP: PM: implement context loss count APIs
Implement OMAP PM layer omap_pm_get_dev_context_loss_count() API by
creating similar APIs at the omap_device and omap_hwmod levels. The
omap_hwmod level call is the layer with access to the powerdomain
core, so it is the place where the powerdomain is queried to get the
context loss count.
The new APIs return an unsigned value that can wrap as the
context-loss count grows. However, the wrapping is not important as
the role of this function is to determine context loss by checking for
any difference in subsequent calls to this function.
Note that these APIs at each level can return zero when no context
loss is detected, or on errors. This is to avoid returning error
codes which could potentially be mistaken for large context loss
counters.
NOTE: only works for devices which have been converted to use
omap_device/omap_hwmod.
Longer term, we could possibly remove this API from the OMAP PM layer,
and instead directly use the omap_device level API.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/plat-omap/omap-pm-noop.c')
-rw-r--r-- | arch/arm/plat-omap/omap-pm-noop.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c index 19cb9f5a9f04..af58daddcf50 100644 --- a/arch/arm/plat-omap/omap-pm-noop.c +++ b/arch/arm/plat-omap/omap-pm-noop.c | |||
@@ -20,9 +20,11 @@ | |||
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 | /* | 29 | /* |
28 | * Device-driver-originated constraints (via board-*.c files) | 30 | * Device-driver-originated constraints (via board-*.c files) |
@@ -282,22 +284,19 @@ unsigned long omap_pm_cpu_get_freq(void) | |||
282 | * Device context loss tracking | 284 | * Device context loss tracking |
283 | */ | 285 | */ |
284 | 286 | ||
285 | int omap_pm_get_dev_context_loss_count(struct device *dev) | 287 | u32 omap_pm_get_dev_context_loss_count(struct device *dev) |
286 | { | 288 | { |
287 | if (!dev) { | 289 | struct platform_device *pdev = to_platform_device(dev); |
288 | WARN_ON(1); | 290 | u32 count; |
289 | return -EINVAL; | ||
290 | }; | ||
291 | 291 | ||
292 | pr_debug("OMAP PM: returning context loss count for dev %s\n", | 292 | if (WARN_ON(!dev)) |
293 | dev_name(dev)); | 293 | return 0; |
294 | 294 | ||
295 | /* | 295 | count = omap_device_get_context_loss_count(pdev); |
296 | * Map the device to the powerdomain. Return the powerdomain | 296 | pr_debug("OMAP PM: context loss count for dev %s = %d\n", |
297 | * off counter. | 297 | dev_name(dev), count); |
298 | */ | ||
299 | 298 | ||
300 | return 0; | 299 | return count; |
301 | } | 300 | } |
302 | 301 | ||
303 | 302 | ||