From patchwork Thu Dec 31 13:29:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dasgupta, Romit" X-Patchwork-Id: 70374 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 nBVDTDwI000833 for ; Thu, 31 Dec 2009 13:29:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090AbZLaN3O (ORCPT ); Thu, 31 Dec 2009 08:29:14 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751951AbZLaN3O (ORCPT ); Thu, 31 Dec 2009 08:29:14 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:42125 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751926AbZLaN3N (ORCPT ); Thu, 31 Dec 2009 08:29:13 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id nBVDT884014053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 31 Dec 2009 07:29:11 -0600 Received: from [172.24.191.66] (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id nBVDT5Xw026325; Thu, 31 Dec 2009 18:59:05 +0530 (IST) Subject: [PATCH 1/10] OPP layer and additional cleanups. From: Romit Dasgupta Reply-To: romit@ti.com To: paul@pwsan.com, nm@ti.com, khilman@deeprootsystems.com Cc: "linux-omap@vger.kernel.org" Organization: Texas Instruments Date: Thu, 31 Dec 2009 18:59:05 +0530 Message-ID: <1262266145.20175.177.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..43dee2d 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; + /* Takes care of precision loss due to integer division */ + return (((uv + 99) / 100 - 6000) + 124) / 125; - 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; }