From: Kevin Hilman <khilman@deeprootsystems.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>, Romit Dasgupta <romit@ti.com>
Subject: Re: [PM-WIP-OPP][PATCH v3] pm: opp: twl/tps: optimize uv to vsel function
Date: Tue, 12 Jan 2010 08:07:53 -0800 [thread overview]
Message-ID: <87ockzi9wm.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1263306978-7150-1-git-send-email-nm@ti.com> (Nishanth Menon's message of "Tue\, 12 Jan 2010 08\:36\:18 -0600")
Nishanth Menon <nm@ti.com> writes:
> From: Romit Dasgupta <romit@ti.com>
>
> For integer values x and y; int div x / y causes truncation. Current
> omap_twl_uv_to_vsel function implements an equivalent of ceil which
> is based on an if condition to check truncation and round up. We can
> do this in a more optimal manner without the if condition. The round
> up is handled by adding the round off factor prior to truncation as:
> (x + (y - 1)) / y
>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Acked-by: Nishanth Menon <nm@ti.com>
>
> Signed-off-by: Romit Dasgupta <romit@ti.com>
Thanks, adding to pm-wip-opp
Kevin
> ---
> Discussions:
> v2: http://marc.info/?t=126318930800001&r=1&w=2
> v1: http://marc.info/?t=126226623800006&r=1&w=2
>
> arch/arm/plat-omap/opp_twl_tps.c | 12 ++----------
> 1 files changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/plat-omap/opp_twl_tps.c b/arch/arm/plat-omap/opp_twl_tps.c
> index e0db39b..468fb97 100644
> --- a/arch/arm/plat-omap/opp_twl_tps.c
> +++ b/arch/arm/plat-omap/opp_twl_tps.c
> @@ -36,14 +36,6 @@ 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;
> -
> - /* 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;
> + /* Round up to higher voltage */
> + return (((uv + 99) / 100 - 6000) + 124) / 125;
> }
> --
> 1.6.3.3
next parent reply other threads:[~2010-01-12 16:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1263306978-7150-1-git-send-email-nm@ti.com>
2010-01-12 16:07 ` Kevin Hilman [this message]
2010-01-12 14:39 [PM-WIP-OPP][PATCH v3] pm: opp: twl/tps: optimize uv to vsel function Nishanth Menon
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=87ockzi9wm.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=romit@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