From patchwork Tue Jan 12 14:39:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 72394 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0CEdfW1029965 for ; Tue, 12 Jan 2010 14:39:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753156Ab0ALOjk (ORCPT ); Tue, 12 Jan 2010 09:39:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753081Ab0ALOjk (ORCPT ); Tue, 12 Jan 2010 09:39:40 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:55701 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983Ab0ALOjk (ORCPT ); Tue, 12 Jan 2010 09:39:40 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0CEdcU0005942 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jan 2010 08:39:38 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o0CEdaVi012086; Tue, 12 Jan 2010 08:39:36 -0600 (CST) Received: from senorita (senorita.am.dhcp.ti.com [128.247.75.1]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id o0CEdaZ15424; Tue, 12 Jan 2010 08:39:36 -0600 (CST) Received: by senorita (Postfix, from userid 1000) id 0F204C18D; Tue, 12 Jan 2010 08:39:36 -0600 (CST) From: Nishanth Menon To: linux-omap Cc: Nishanth Menon , Romit Dasgupta , Kevin Hilman Subject: [PM-WIP-OPP][PATCH v3] pm: opp: twl/tps: optimize uv to vsel function Date: Tue, 12 Jan 2010 08:39:35 -0600 Message-Id: <1263307175-7493-1-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.6.3.3 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c index e0db39b..468fb97 100644 --- a/arch/arm/plat-omap/opp_twl_tps.c +++ b/arch/arm/plat-omap/opp_twl_tps.c @@ -36,14 +36,6 @@ unsigned long omap_twl_vsel_to_uv(const u8 vsel) */ u8 omap_twl_uv_to_vsel(unsigned long uv) { - 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; + /* Round up to higher voltage */ + return (((uv + 99) / 100 - 6000) + 124) / 125; }