public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <paul@pwsan.com>
To: nm@ti.com
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 05/12] OMAP TWL/TPS OPP: vsel rounding belongs in opp_twl_tps.c
Date: Thu, 17 Dec 2009 17:47:36 -0700	[thread overview]
Message-ID: <20091218004735.7694.13673.stgit@localhost.localdomain> (raw)
In-Reply-To: <20091218004617.7694.84525.stgit@localhost.localdomain>

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;
 }



  parent reply	other threads:[~2009-12-18  0:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20091218004617.7694.84525.stgit@localhost.localdomain>
2009-12-18  0:47 ` [PATCH 01/12] OMAP OPP: remove some unnecessary variables Paul Walmsley
2009-12-18 17:28   ` Kevin Hilman
2009-12-18  0:47 ` [PATCH 02/12] OMAP OPP: split opp_find_freq_approx() into opp_find_freq_{floor, ceil}() Paul Walmsley
2009-12-18  0:47 ` [PATCH 03/12] OMAP OPP: only traverse opp_find_freq_floor() once Paul Walmsley
2009-12-19 12:10   ` Menon, Nishanth
2009-12-18  0:47 ` [PATCH 04/12] OMAP TWL/TPS OPP: move TWL/TPS-specific code to its own file Paul Walmsley
2009-12-19 12:14   ` Menon, Nishanth
2009-12-18  0:47 ` Paul Walmsley [this message]
2009-12-19 12:16   ` [PATCH 05/12] OMAP TWL/TPS OPP: vsel rounding belongs in opp_twl_tps.c Menon, Nishanth
2009-12-18  0:47 ` [PATCH 07/12] OMAP OPP: add opp_find_opp_by_opp_id() Paul Walmsley
2009-12-18  0:47 ` [PATCH 06/12] OMAP OPP: add microvolts DC ("u_volt") field into struct omap_opp Paul Walmsley
2009-12-18  0:47 ` [PATCH 08/12] OMAP SR/SRF: use opp_find_opp_by_opp_id() Paul Walmsley
2009-12-18  0:47 ` [PATCH 09/12] OMAP OPP: remove vsel Paul Walmsley
2009-12-18  0:47 ` [PATCH 10/12] OMAP OPP: remove "initial terminators" from OPP lists Paul Walmsley
2009-12-18 19:08   ` Kevin Hilman
2009-12-18  0:47 ` [PATCH 11/12] OMAP OPP: use kzalloc() rather than kmalloc() Paul Walmsley
2009-12-18  0:47 ` [PATCH 12/12] OMAP3 OPP: move CPUFreq table init code to OPP layer Paul Walmsley
2009-12-19 12:22   ` Menon, Nishanth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091218004735.7694.13673.stgit@localhost.localdomain \
    --to=paul@pwsan.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox