@@ -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);
+
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, uvdc_target, uvdc_current);
}
-#endif
}
+ omap_smartreflex_enable(res);
return ret;
}
@@ -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);