From patchwork Mon Aug 29 18:15:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1109962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7TIV6ep013033 for ; Mon, 29 Aug 2011 18:38:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754556Ab1H2SO5 (ORCPT ); Mon, 29 Aug 2011 14:14:57 -0400 Received: from na3sys009aog111.obsmtp.com ([74.125.149.205]:56123 "EHLO na3sys009aog111.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754416Ab1H2SO5 (ORCPT ); Mon, 29 Aug 2011 14:14:57 -0400 Received: from mail-pz0-f44.google.com ([209.85.210.44]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKTlvXIFTkmTrlHsrBwv4RoVmelfp5IhRW@postini.com; Mon, 29 Aug 2011 11:14:57 PDT Received: by mail-pz0-f44.google.com with SMTP id 36so10337935pzk.17 for ; Mon, 29 Aug 2011 11:14:56 -0700 (PDT) Received: by 10.143.58.4 with SMTP id l4mr2841803wfk.145.1314641696558; Mon, 29 Aug 2011 11:14:56 -0700 (PDT) Received: from localhost.localdomain (c-24-19-7-36.hsd1.wa.comcast.net. [24.19.7.36]) by mx.google.com with ESMTPS id e3sm19639386pbi.7.2011.08.29.11.14.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Aug 2011 11:14:55 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/5] OMAP4: PM: TWL6030: fix uv to voltage for >0x39 Date: Mon, 29 Aug 2011 11:15:18 -0700 Message-Id: <1314641721-5172-3-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1314641721-5172-1-git-send-email-khilman@ti.com> References: <1314641721-5172-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 29 Aug 2011 18:38:03 +0000 (UTC) From: Nishanth Menon using 1.35V as a check is not correct, we know that beyond 0x39, voltages are non linear - hence use the conversion iff uV greater than that for 0x39. For example, with 709mV as the smps offset, the max linear is actually 1.41V(0x39vsel)! Signed-off-by: Nishanth Menon --- arch/arm/mach-omap2/omap_twl.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index a66bf6b..5def7c2 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c @@ -134,8 +134,13 @@ static u8 twl6030_uv_to_vsel(unsigned long uv) * hardcoding only for 1.35 V which is used for 1GH OPP for * OMAP4430. */ - if (uv == 1350000) + if (uv > twl6030_vsel_to_uv(0x39)) { + if (uv == 1350000) + return 0x3A; + pr_err("%s:OUT OF RANGE! non mapped vsel for %ld Vs max %ld\n", + __func__, uv, twl6030_vsel_to_uv(0x39)); return 0x3A; + } if (smps_offset & 0x8) return DIV_ROUND_UP(uv - 709000, 12660) + 1;