<div class="gmail_quote">On Mon, May 9, 2011 at 5:35 AM, Govindraj.R <span dir="ltr">&lt;<a href="mailto:govindraj.raja@ti.com">govindraj.raja@ti.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Add API to enable IO pad wakeup capability based on mux dynamic pad and<br>
wake_up enable flag available from hwmod_mux initialization.<br>
<br>
Use the wakeup_enable flag and enable wakeup capability<br>
for the given pads. Wakeup capability will be enabled/disabled<br>
during hmwod idle transition based on whether wakeup_flag is<br>
set or cleared.<br>
<br>
Signed-off-by: Govindraj.R &lt;<a href="mailto:govindraj.raja@ti.com">govindraj.raja@ti.com</a>&gt;<br>
---<br>
 arch/arm/mach-omap2/omap_hwmod.c              |   51 +++++++++++++++++++++++++<br>
 arch/arm/plat-omap/include/plat/omap_device.h |    2 +<br>
 arch/arm/plat-omap/include/plat/omap_hwmod.h  |    3 +<br>
 arch/arm/plat-omap/omap_device.c              |   50 ++++++++++++++++++++++++<br>
 4 files changed, 106 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c<br>
index e034294..bbbe1ed 100644<br>
--- a/arch/arm/mach-omap2/omap_hwmod.c<br>
+++ b/arch/arm/mach-omap2/omap_hwmod.c<br>
@@ -2369,3 +2369,54 @@ int omap_hwmod_no_setup_reset(struct omap_hwmod *oh)<br>
<br>
        return 0;<br>
 }<br>
+<br>
+static int omap_hwmod_configure_ioring_wakeup(struct omap_hwmod *oh, u16 val)<br>
+{<br>
+       struct omap_device_pad *pad;<br>
+       int ret = -EINVAL, j;<br>
+<br>
+       if (oh-&gt;mux-&gt;enabled) {<br>
+               for (j = 0; j &lt; oh-&gt;mux-&gt;nr_pads_dynamic; j++) {<br>
+                       pad = oh-&gt;mux-&gt;pads_dynamic[j];<br>
+                       if (pad-&gt;flags &amp; OMAP_DEVICE_PAD_WAKEUP) {<br>
+                               pad-&gt;idle = pad-&gt;enable | val;<br>
+                               ret = 0;<br>
+                       }<br>
+               }<br>
+       }<br>
+<br>
+       return ret;<br>
+}<br>
+<br>
+/**<br>
+ * omap_hwmod_enable_ioring_wakeup - Set wakeup flag for iopad.<br>
+ * @oh: struct omap_hwmod *<br>
+ *<br>
+ * Traverse through dynamic pads, if pad is enabled then<br>
+ * set wakeup enable bit flag for the mux pin. Wakeup pad bit<br>
+ * will be set during hwmod idle transistion.<br>
+ * Return error if pads are not enabled or not available.<br>
+ */<br>
+int omap_hwmod_enable_ioring_wakeup(struct omap_hwmod *oh)<br>
+{<br>
+       /* Enable pad wake-up capability */<br>
+       return omap_hwmod_configure_ioring_wakeup(oh, OMAP_WAKEUP_EN);<br>
+}<br>
+<br>
+/**<br>
+ * omap_hwmod_disable_ioring_wakeup - Clear wakeup flag for iopad.<br>
+ * @oh: struct omap_hwmod *<br>
+ *<br>
+ * Traverse through dynamic pads, if pad is enabled then<br>
+ * clear wakeup enable bit flag for the mux pin. Wakeup pad bit<br>
+ * will be set during hwmod idle transistion.<br>
+ * Return error if pads are not enabled or not available.<br>
+ */<br>
+int omap_hwmod_disable_ioring_wakeup(struct omap_hwmod *oh)<br>
+{<br>
+       u16 val = 0;<br>
+<br>
+       /* Disable pad wakeup capability */<br>
+       val &amp;= ~OMAP_WAKEUP_EN;<br></blockquote><div><br></div><div>Will still leave val  = 0.</div><div><br></div><div>It sounds like omap_hwmod_configure_ioring_wakeup needs to take a new value for the OMAP_WAKEUP_EN bit (0 or 1), and that code needs to set pad-&gt;idle = pad-&gt;enable | OMAP_WAKEUP_EN if being enabled, or pad-&gt;idle = pad-&gt;enable &amp; ~OMAP_WAKEUP_EN if being disabled?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+       return omap_hwmod_configure_ioring_wakeup(oh, val);<br>
+}<br>
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h<br>
index e4c349f..a377dd0 100644<br>
--- a/arch/arm/plat-omap/include/plat/omap_device.h<br>
+++ b/arch/arm/plat-omap/include/plat/omap_device.h<br>
@@ -117,6 +117,8 @@ int omap_device_enable_hwmods(struct omap_device *od);<br>
 int omap_device_disable_clocks(struct omap_device *od);<br>
 int omap_device_enable_clocks(struct omap_device *od);<br>
<br>
+int omap_device_enable_ioring_wakeup(struct platform_device *pdev);<br>
+int omap_device_disable_ioring_wakeup(struct platform_device *pdev);<br>
<br>
 /*<br>
  * Entries should be kept in latency order ascending<br>
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h<br>
index 1adea9c..7ef11a6 100644<br>
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h<br>
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h<br>
@@ -602,6 +602,9 @@ u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);<br>
<br>
 int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);<br>
<br>
+int omap_hwmod_enable_ioring_wakeup(struct omap_hwmod *oh);<br>
+int omap_hwmod_disable_ioring_wakeup(struct omap_hwmod *oh);<br>
+<br>
 /*<br>
  * Chip variant-specific hwmod init routines - XXX should be converted<br>
  * to use initcalls once the initial boot ordering is straightened out<br>
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c<br>
index 9bbda9a..04a4f15 100644<br>
--- a/arch/arm/plat-omap/omap_device.c<br>
+++ b/arch/arm/plat-omap/omap_device.c<br>
@@ -742,6 +742,56 @@ void __iomem *omap_device_get_rt_va(struct omap_device *od)<br>
        return omap_hwmod_get_mpu_rt_va(od-&gt;hwmods[0]);<br>
 }<br>
<br>
+/**<br>
+ * omap_device_enable_ioring_wakeup - Set wakeup bit for iopad ring.<br>
+ * @pdev: platform_device for which wakeup needs to be set.<br>
+ *<br>
+ * Caller should ensure this is called if device_may_wakeup(dev) is true<br>
+ * traverse through each hwmod and check each available pads<br>
+ * if pad is enabled then set wakeup enable flag for the mux pin.<br>
+ * Return error if pads are not enabled or not available.<br>
+ * Wakeup enable flag will be we used during hwmod idle transistion.<br>
+ */<br>
+int omap_device_enable_ioring_wakeup(struct platform_device *pdev)<br>
+{<br>
+       int ret = -EINVAL, i;<br>
+       struct omap_device *od;<br>
+       struct omap_hwmod *oh;<br>
+<br>
+       od = _find_by_pdev(pdev);<br>
+       for (i = 0; i &lt; od-&gt;hwmods_cnt; i++) {<br>
+               oh = od-&gt;hwmods[i];<br>
+               ret = omap_hwmod_enable_ioring_wakeup(oh);<br>
+       }<br>
+<br>
+       return ret;<br>
+}<br>
+<br>
+/**<br>
+ * omap_device_disable_ioring_wakeup - Clear wakeup bit for iopad ring.<br>
+ * @pdev: platform_device for which wakeup needs to be cleared.<br>
+ *<br>
+ * Caller should ensure this is called if device_may_wakeup(dev) is false<br>
+ * traverse through each hwmod and check each available pads<br>
+ * if pad is enabled then clear wakeup enable flag for the mux pin.<br>
+ * Return error if pads are not enabled or not available.<br>
+ * Wakeup enable flag will be we used during hwmod idle transistion.<br>
+ */<br>
+int omap_device_disable_ioring_wakeup(struct platform_device *pdev)<br>
+{<br>
+       int ret = -EINVAL, i;<br>
+       struct omap_device *od;<br>
+       struct omap_hwmod *oh;<br>
+<br>
+       od = _find_by_pdev(pdev);<br>
+       for (i = 0; i &lt; od-&gt;hwmods_cnt; i++) {<br>
+               oh = od-&gt;hwmods[i];<br>
+               ret = omap_hwmod_disable_ioring_wakeup(oh);<br>
+       }<br>
+<br>
+       return ret;<br>
+}<br>
+<br>
 /*<br>
  * Public functions intended for use in omap_device_pm_latency<br>
  * .activate_func and .deactivate_func function pointers<br>
--<br>
1.7.1<br>
<font color="#888888"><br>
--<br>
To unsubscribe from this list: send the line &quot;unsubscribe linux-omap&quot; in<br>
the body of a message to <a href="mailto:majordomo@vger.kernel.org">majordomo@vger.kernel.org</a><br>
More majordomo info at  <a href="http://vger.kernel.org/majordomo-info.html" target="_blank">http://vger.kernel.org/majordomo-info.html</a><br>
</font></blockquote></div><br>