diff options
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod.c | 22 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap-pm.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_device.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-omap/omap-pm-noop.c | 23 | ||||
-rw-r--r-- | arch/arm/plat-omap/omap_device.c | 28 |
6 files changed, 65 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 03ffa3b282b1..77a8be64cfae 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
@@ -2188,3 +2188,25 @@ ohsps_unlock: | |||
2188 | 2188 | ||
2189 | return ret; | 2189 | return ret; |
2190 | } | 2190 | } |
2191 | |||
2192 | /** | ||
2193 | * omap_hwmod_get_context_loss_count - get lost context count | ||
2194 | * @oh: struct omap_hwmod * | ||
2195 | * | ||
2196 | * Query the powerdomain of of @oh to get the context loss | ||
2197 | * count for this device. | ||
2198 | * | ||
2199 | * Returns the context loss count of the powerdomain assocated with @oh | ||
2200 | * upon success, or zero if no powerdomain exists for @oh. | ||
2201 | */ | ||
2202 | u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) | ||
2203 | { | ||
2204 | struct powerdomain *pwrdm; | ||
2205 | int ret = 0; | ||
2206 | |||
2207 | pwrdm = omap_hwmod_get_pwrdm(oh); | ||
2208 | if (pwrdm) | ||
2209 | ret = pwrdm_get_context_loss_count(pwrdm); | ||
2210 | |||
2211 | return ret; | ||
2212 | } | ||
diff --git a/arch/arm/plat-omap/include/plat/omap-pm.h b/arch/arm/plat-omap/include/plat/omap-pm.h index 47d61107ccda..c07bb44e9e5a 100644 --- a/arch/arm/plat-omap/include/plat/omap-pm.h +++ b/arch/arm/plat-omap/include/plat/omap-pm.h | |||
@@ -350,9 +350,9 @@ unsigned long omap_pm_cpu_get_freq(void); | |||
350 | * driver must restore device context. If the number of context losses | 350 | * driver must restore device context. If the number of context losses |
351 | * exceeds the maximum positive integer, the function will wrap to 0 and | 351 | * exceeds the maximum positive integer, the function will wrap to 0 and |
352 | * continue counting. Returns the number of context losses for this device, | 352 | * continue counting. Returns the number of context losses for this device, |
353 | * or -EINVAL upon error. | 353 | * or zero upon error. |
354 | */ | 354 | */ |
355 | int omap_pm_get_dev_context_loss_count(struct device *dev); | 355 | u32 omap_pm_get_dev_context_loss_count(struct device *dev); |
356 | 356 | ||
357 | 357 | ||
358 | #endif | 358 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h index 28e2d1a78433..e4c349ff9fd8 100644 --- a/arch/arm/plat-omap/include/plat/omap_device.h +++ b/arch/arm/plat-omap/include/plat/omap_device.h | |||
@@ -107,6 +107,7 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od); | |||
107 | int omap_device_align_pm_lat(struct platform_device *pdev, | 107 | int omap_device_align_pm_lat(struct platform_device *pdev, |
108 | u32 new_wakeup_lat_limit); | 108 | u32 new_wakeup_lat_limit); |
109 | struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); | 109 | struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); |
110 | u32 omap_device_get_context_loss_count(struct platform_device *pdev); | ||
110 | 111 | ||
111 | /* Other */ | 112 | /* Other */ |
112 | 113 | ||
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 619877c6b3ab..2825b456da0e 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h | |||
@@ -569,6 +569,7 @@ int omap_hwmod_for_each_by_class(const char *classname, | |||
569 | void *user); | 569 | void *user); |
570 | 570 | ||
571 | int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); | 571 | int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); |
572 | u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); | ||
572 | 573 | ||
573 | /* | 574 | /* |
574 | * Chip variant-specific hwmod init routines - XXX should be converted | 575 | * Chip variant-specific hwmod init routines - XXX should be converted |
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 | ||
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index abe933cd8f09..57adb270767b 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c | |||
@@ -280,6 +280,34 @@ static void _add_optional_clock_alias(struct omap_device *od, | |||
280 | /* Public functions for use by core code */ | 280 | /* Public functions for use by core code */ |
281 | 281 | ||
282 | /** | 282 | /** |
283 | * omap_device_get_context_loss_count - get lost context count | ||
284 | * @od: struct omap_device * | ||
285 | * | ||
286 | * Using the primary hwmod, query the context loss count for this | ||
287 | * device. | ||
288 | * | ||
289 | * Callers should consider context for this device lost any time this | ||
290 | * function returns a value different than the value the caller got | ||
291 | * the last time it called this function. | ||
292 | * | ||
293 | * If any hwmods exist for the omap_device assoiated with @pdev, | ||
294 | * return the context loss counter for that hwmod, otherwise return | ||
295 | * zero. | ||
296 | */ | ||
297 | u32 omap_device_get_context_loss_count(struct platform_device *pdev) | ||
298 | { | ||
299 | struct omap_device *od; | ||
300 | u32 ret = 0; | ||
301 | |||
302 | od = _find_by_pdev(pdev); | ||
303 | |||
304 | if (od->hwmods_cnt) | ||
305 | ret = omap_hwmod_get_context_loss_count(od->hwmods[0]); | ||
306 | |||
307 | return ret; | ||
308 | } | ||
309 | |||
310 | /** | ||
283 | * omap_device_count_resources - count number of struct resource entries needed | 311 | * omap_device_count_resources - count number of struct resource entries needed |
284 | * @od: struct omap_device * | 312 | * @od: struct omap_device * |
285 | * | 313 | * |