@@ -2369,3 +2369,25 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh)
return 0;
}
+
+/**
+ * omap_hwmod_can_ever_lose_context - can this hwmod ever lose context?
+ * @oh: struct omap_hwmod *
+ *
+ * Finds the powerdomain associated with the given hwmod, and calls
+ * pwrdm_can_ever_lose_context for the powerdomain.
+ *
+ * Returns the return value from pwrdm_can_ever_lose_context, or true if no
+ * powerdomain is associated with the hwmod.
+ */
+bool omap_hwmod_can_ever_lose_context(struct omap_hwmod *oh)
+{
+ struct powerdomain *pwrdm;
+ int ret = true;
+
+ pwrdm = omap_hwmod_get_pwrdm(oh);
+ if (pwrdm)
+ ret = pwrdm_can_ever_lose_context(pwrdm);
+
+ return ret;
+}
@@ -109,6 +109,7 @@ int omap_device_align_pm_lat(struct platform_device *pdev,
struct powerdomain *omap_device_get_pwrdm(struct omap_device *od);
int omap_device_get_context_loss_count(struct platform_device *pdev);
int omap_device_reset(struct platform_device *pdev);
+bool omap_device_can_ever_lose_context(struct platform_device *pdev);
/* Other */
@@ -601,6 +601,7 @@ int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);
+bool omap_hwmod_can_ever_lose_context(struct omap_hwmod *oh);
/*
* Chip variant-specific hwmod init routines - XXX should be converted
@@ -347,6 +347,29 @@ int omap_device_reset(struct platform_device *pdev)
}
/**
+ * omap_device_can_ever_lose_context - can this device ever lose context?
+ * @pdev: struct platform_device *
+ *
+ * Calls omap_hwmod_can_ever_lose_context for all hwmods associated with the
+ * given device, and returns true if one of the hwmods returns true. Otherwise
+ * returns false.
+ */
+bool omap_device_can_ever_lose_context(struct platform_device *pdev)
+{
+ struct omap_device *od;
+ int i;
+
+ od = _find_by_pdev(pdev);
+
+ for (i = 0; i < od->hwmods_cnt; i++) {
+ if (omap_hwmod_can_ever_lose_context(od->hwmods[i]))
+ return true;
+ }
+
+ return false;
+}
+
+/**
* omap_device_count_resources - count number of struct resource entries needed
* @od: struct omap_device *
*
Add hwmod and omap_device versions of can_ever_lose_context functions so that drivers are able to use it. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> --- arch/arm/mach-omap2/omap_hwmod.c | 22 ++++++++++++++++++++++ arch/arm/plat-omap/include/plat/omap_device.h | 1 + arch/arm/plat-omap/include/plat/omap_hwmod.h | 1 + arch/arm/plat-omap/omap_device.c | 23 +++++++++++++++++++++++ 4 files changed, 47 insertions(+), 0 deletions(-)