From patchwork Mon Jan 11 05:53:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dasgupta, Romit" X-Patchwork-Id: 72092 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 o0B5rnTG032287 for ; Mon, 11 Jan 2010 05:53:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751186Ab0AKFxs (ORCPT ); Mon, 11 Jan 2010 00:53:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751152Ab0AKFxs (ORCPT ); Mon, 11 Jan 2010 00:53:48 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:50330 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135Ab0AKFxr (ORCPT ); Mon, 11 Jan 2010 00:53:47 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o0B5rhW8026124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Jan 2010 23:53:46 -0600 Received: from [172.24.190.243] (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o0B5rcGt016462; Mon, 11 Jan 2010 11:23:39 +0530 (IST) Subject: [PM-WIP-OPP] [PATCH] cleaner ceil function for uv to vsel conversion From: Romit Dasgupta Reply-To: romit@ti.com To: khilman@deeprootsystems.com Cc: nm@ti.com, linux-omap@vger.kernel.org Organization: Texas Instruments Date: Mon, 11 Jan 2010 11:23:38 +0530 Message-ID: <1263189218.16324.3.camel@boson> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 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..1caa414 100644 --- a/arch/arm/plat-omap/opp_twl_tps.c +++ b/arch/arm/plat-omap/opp_twl_tps.c @@ -36,14 +36,7 @@ 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; + return (((uv + 99) / 100 - 6000) + 124) / 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; }