linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] regulator: add a new API regulator_set_voltage_tol()
Date: Sun, 5 Aug 2012 23:05:20 +0800	[thread overview]
Message-ID: <1344179121-17738-4-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1344179121-17738-1-git-send-email-shawn.guo@linaro.org>

There are some use cases where a voltage range could be reasonably
specified by a target voltage and tolerance.  Add a new API
regulator_set_voltage_tol() wrapping regulator_set_voltage() call
to ease the users.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 include/linux/regulator/consumer.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index da339fd..2160352 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -352,4 +352,11 @@ static inline void regulator_set_drvdata(struct regulator *regulator,
 
 #endif
 
+static inline int regulator_set_voltage_tol(struct regulator *regulator,
+					    int new_uV, int tol_uV)
+{
+	return regulator_set_voltage(regulator,
+				     new_uV - tol_uV, new_uV + tol_uV);
+}
+
 #endif
-- 
1.7.5.4

  parent reply	other threads:[~2012-08-05 15:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 15:05 [PATCH v2 0/4] Add a generic cpufreq-cpu0 driver Shawn Guo
2012-08-05 15:05 ` [PATCH v2 1/4] ARM: add cpufreq transiton notifier to adjust loops_per_jiffy for smp Shawn Guo
2012-08-05 15:05 ` [PATCH v2 2/4] PM / OPP: Initialize OPP table from device tree Shawn Guo
2012-08-06  2:50   ` Rob Herring
2012-08-06  3:19     ` Shawn Guo
2012-08-06  4:43       ` Rob Herring
2012-08-06  5:23         ` Shawn Guo
2012-08-05 15:05 ` Shawn Guo [this message]
2012-08-08 13:35   ` [PATCH v2 3/4] regulator: add a new API regulator_set_voltage_tol() Mark Brown
2012-08-08 14:30     ` Shawn Guo
2012-08-09 10:53       ` Mark Brown
2012-08-05 15:05 ` [PATCH v2 4/4] cpufreq: Add a generic cpufreq-cpu0 driver Shawn Guo

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=1344179121-17738-4-git-send-email-shawn.guo@linaro.org \
    --to=shawn.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).