This patch disables smartreflex across both frequency and voltage
scaling instead of just across voltage scaling as before.
This is the hardware recommended practice.
This bug was first reported and solved on Nokia N900
code base by Nishanth Menon and Paul Walmsley.

This patch also does some changes in SRF to adapt to the new smartreflex
and voltage driver.

Signed-off-by: Thara Gopinath <th...@ti.com>
---
 arch/arm/mach-omap2/resource34xx.c |   27 ++++++++++-----------------
 arch/arm/mach-omap2/resource34xx.h |    1 -
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/resource34xx.c 
b/arch/arm/mach-omap2/resource34xx.c
index c6cce8b..853c563 100644
--- a/arch/arm/mach-omap2/resource34xx.c
+++ b/arch/arm/mach-omap2/resource34xx.c
@@ -28,6 +28,7 @@
 #include <plat/opp_twl_tps.h>
 
 #include "smartreflex.h"
+#include "voltage.h"
 #include "resource34xx.h"
 #include "pm.h"
 #include "cm.h"
@@ -331,12 +332,6 @@ static int program_opp(int res, enum opp_t opp_type, int 
target_level,
 {
        int i, ret = 0, raise;
        unsigned long freq;
-#ifdef CONFIG_OMAP_SMARTREFLEX
-       unsigned long t_opp, c_opp;
-
-       t_opp = ID_VDD(res) | ID_OPP_NO(target_level);
-       c_opp = ID_VDD(res) | ID_OPP_NO(current_level);
-#endif
 
        /* See if have a freq associated, if not, invalid opp */
        ret = opp_to_freq(&freq, opp_type, target_level);
@@ -348,15 +343,15 @@ static int program_opp(int res, enum opp_t opp_type, int 
target_level,
        else
                raise = 0;
 
+       omap_smartreflex_disable(res - 1, 0);
+
        for (i = 0; i < 2; i++) {
-               if (i == raise)
+               if (i == raise) {
                        ret = program_opp_freq(res, target_level,
                                        current_level);
-#ifdef CONFIG_OMAP_SMARTREFLEX
-               else {
-                       u8 vc, vt;
+               } else {
                        struct omap_opp *oppx;
-                       unsigned long uvdc;
+                       unsigned long uvdc_current, uvdc_target;
 
                        /*
                         * transitioning from good to good OPP
@@ -364,21 +359,19 @@ static int program_opp(int res, enum opp_t opp_type, int 
target_level,
                         */
                        oppx = opp_find_freq_exact(opp_type, freq, true);
                        BUG_ON(IS_ERR(oppx));
-                       uvdc = opp_get_voltage(oppx);
-                       vt = omap_twl_uv_to_vsel(uvdc);
+                       uvdc_target = opp_get_voltage(oppx);
 
                        BUG_ON(opp_to_freq(&freq, opp_type, current_level));
                        oppx = opp_find_freq_exact(opp_type, freq, true);
                        BUG_ON(IS_ERR(oppx));
-                       uvdc = opp_get_voltage(oppx);
-                       vc = omap_twl_uv_to_vsel(uvdc);
+                       uvdc_current = opp_get_voltage(oppx);
 
                        /* ok to scale.. */
-                       sr_voltagescale_vcbypass(t_opp, c_opp, vt, vc);
+                       omap_voltage_scale(res - 1, uvdc_target, uvdc_current);
                }
-#endif
        }
 
+       omap_smartreflex_enable(res - 1);
        return ret;
 }
 
diff --git a/arch/arm/mach-omap2/resource34xx.h 
b/arch/arm/mach-omap2/resource34xx.h
index 0b4e76e..b56d2df 100644
--- a/arch/arm/mach-omap2/resource34xx.h
+++ b/arch/arm/mach-omap2/resource34xx.h
@@ -30,7 +30,6 @@
 #include <plat/opp.h>
 #include <plat/omap34xx.h>
 
-extern int sr_voltagescale_vcbypass(u32 t_opp, u32 c_opp, u8 t_vsel, u8 
c_vsel);
 extern void lock_scratchpad_sem(void);
 extern void unlock_scratchpad_sem(void);
 
-- 
1.7.0.rc1.33.g07cf0f

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to