public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Romit Dasgupta <romit@ti.com>
To: khilman@deeprootsystems.com
Cc: nm@ti.com, linux-omap@vger.kernel.org
Subject: [PM-WIP-OPP] [PATCH] cleaner ceil function for uv to vsel conversion
Date: Mon, 11 Jan 2010 11:23:38 +0530	[thread overview]
Message-ID: <1263189218.16324.3.camel@boson> (raw)

Cleaner ceil function.
Signed-off-by: Romit Dasgupta <romit@ti.com>
---
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;
 }



             reply	other threads:[~2010-01-11  5:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11  5:53 Romit Dasgupta [this message]
2010-01-11 22:29 ` [PM-WIP-OPP] [PATCH] cleaner ceil function for uv to vsel conversion Kevin Hilman
2010-01-12  8:58   ` Romit Dasgupta
2010-01-12 12:08     ` Nishanth Menon
2010-01-12 12:13       ` Romit Dasgupta

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=1263189218.16324.3.camel@boson \
    --to=romit@ti.com \
    --cc=khilman@deeprootsystems.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