The vsel roundoff code belongs in omap_twl_uv_to_vsel(), not omap_opp_populate(), since other code may use omap_twl_uv_to_vsel(). --- arch/arm/plat-omap/opp.c | 3 --- arch/arm/plat-omap/opp_twl_tps.c | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/plat-omap/opp.c b/arch/arm/plat-omap/opp.c index 9586e3b..2543932 100644 --- a/arch/arm/plat-omap/opp.c +++ b/arch/arm/plat-omap/opp.c @@ -144,9 +144,6 @@ static void omap_opp_populate(struct omap_opp *opp, opp->rate = opp_def->freq; opp->enabled = opp_def->enabled; opp->vsel = omap_twl_uv_to_vsel(opp_def->u_volt); - /* round off to higher voltage */ - if (opp_def->u_volt > omap_twl_vsel_to_uv(opp->vsel)) - opp->vsel++; } struct omap_opp *opp_add(struct omap_opp *oppl, diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c index edcb719..e0db39b 100644 --- a/arch/arm/plat-omap/opp_twl_tps.c +++ b/arch/arm/plat-omap/opp_twl_tps.c @@ -2,7 +2,9 @@ * opp_twl_tps.c - TWL/TPS-specific functions for the OPP code * * Copyright (C) 2009 Texas Instruments Incorporated. - * Nishanth Menon + * Nishanth Menon + * Copyright (C) 2009 Nokia Corporation + * Paul Walmsley * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -34,5 +36,14 @@ unsigned long omap_twl_vsel_to_uv(const u8 vsel) */ u8 omap_twl_uv_to_vsel(unsigned long uv) { - return ((uv / 100) - 6000) / 125; + u8 vsel; + + vsel = ((uv / 100) - 6000) / 125; + + /* round off to higher voltage */ + /* XXX Surely not the best way to handle this. */ + if (uv > omap_twl_vsel_to_uv(vsel)) + vsel++; + + return vsel; } -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html