From: Yadwinder Singh Brar <yadi.brar@samsung.com>
To: linux-kernel@vger.kernel.org
Cc: sbkim73@samsung.com, broonie@kernel.org, lgirdwood@gmail.com,
sameo@linux.intel.com, rob.herring@calxeda.com,
grant.likely@linaro.org, sachin.kamat@linaro.org,
yadi.brar01@gmail.com,
Yadwinder Singh Brar <yadi.brar@samsung.com>
Subject: [v2 PATCH 1/6] regulator: core: Add support for disabling ramp delay
Date: Sat, 29 Jun 2013 18:21:15 +0530 [thread overview]
Message-ID: <1372510280-31931-2-git-send-email-yadi.brar@samsung.com> (raw)
In-Reply-To: <1372510280-31931-1-git-send-email-yadi.brar@samsung.com>
Some hardwares support disabling ramp delay, so adding ramp_disable flag to
constraints. It will be used to figure out whether ramp_delay in constraints
is explicitly set to zero or its unintialized (zero by default).
And we don't need to call set_voltage_time_sel() for regulators for whom ramp
delay is disabled in constraints.
Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
---
.../devicetree/bindings/regulator/regulator.txt | 2 ++
drivers/regulator/core.c | 6 ++++--
drivers/regulator/of_regulator.c | 12 +++++++++---
include/linux/regulator/machine.h | 1 +
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 48a3b8e..2bd8f09 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -12,6 +12,8 @@ Optional properties:
- regulator-allow-bypass: allow the regulator to go into bypass mode
- <name>-supply: phandle to the parent supply/regulator node
- regulator-ramp-delay: ramp delay for regulator(in uV/uS)
+ For hardwares which support disabling ramp rate, it should be explicitly
+ intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay.
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 288c75a..6e6371c 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -984,7 +984,8 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
- if (rdev->constraints->ramp_delay && ops->set_ramp_delay) {
+ if ((rdev->constraints->ramp_delay || rdev->constraints->ramp_disable)
+ && ops->set_ramp_delay) {
ret = ops->set_ramp_delay(rdev, rdev->constraints->ramp_delay);
if (ret < 0) {
rdev_err(rdev, "failed to set ramp_delay\n");
@@ -2438,7 +2439,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
}
/* Call set_voltage_time_sel if successfully obtained old_selector */
- if (ret == 0 && _regulator_is_enabled(rdev) && old_selector >= 0 &&
+ if (ret == 0 && !rdev->constraints->ramp_disable &&
+ _regulator_is_enabled(rdev) && old_selector >= 0 &&
old_selector != selector && rdev->desc->ops->set_voltage_time_sel) {
delay = rdev->desc->ops->set_voltage_time_sel(rdev,
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index f3c8f8f..7827384 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -21,6 +21,7 @@ static void of_get_regulation_constraints(struct device_node *np,
{
const __be32 *min_uV, *max_uV, *uV_offset;
const __be32 *min_uA, *max_uA, *ramp_delay;
+ struct property *prop;
struct regulation_constraints *constraints = &(*init_data)->constraints;
constraints->name = of_get_property(np, "regulator-name", NULL);
@@ -64,9 +65,14 @@ static void of_get_regulation_constraints(struct device_node *np,
if (of_property_read_bool(np, "regulator-allow-bypass"))
constraints->valid_ops_mask |= REGULATOR_CHANGE_BYPASS;
- ramp_delay = of_get_property(np, "regulator-ramp-delay", NULL);
- if (ramp_delay)
- constraints->ramp_delay = be32_to_cpu(*ramp_delay);
+ prop = of_find_property(np, "regulator-ramp-delay", NULL);
+ if (prop && prop->value) {
+ ramp_delay = prop->value;
+ if (*ramp_delay)
+ constraints->ramp_delay = be32_to_cpu(*ramp_delay);
+ else
+ constraints->ramp_disable = true;
+ }
}
/**
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 36adbc8..999b20c 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -134,6 +134,7 @@ struct regulation_constraints {
unsigned always_on:1; /* regulator never off when system is on */
unsigned boot_on:1; /* bootloader/firmware enabled regulator */
unsigned apply_uV:1; /* apply uV constraint if min == max */
+ unsigned ramp_disable:1; /* disable ramp delay */
};
/**
--
1.7.0.4
next prev parent reply other threads:[~2013-07-08 12:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-29 12:51 [v2 PATCH 0/6] Add DT support for s2mps11 Yadwinder Singh Brar
2013-06-29 12:51 ` Yadwinder Singh Brar [this message]
2013-07-08 13:19 ` [v2 PATCH 1/6] regulator: core: Add support for disabling ramp delay Mark Brown
2013-06-29 12:51 ` [v2 PATCH 2/6] regulator: s2mps11: Implement set_ramp_rate callback for bucks Yadwinder Singh Brar
2013-07-08 13:26 ` Mark Brown
2013-06-29 12:51 ` [v2 PATCH 3/6] regulator: s2mps11: Add DT support Yadwinder Singh Brar
2013-06-29 12:51 ` [v2 PATCH 4/6] regulator: s2mps11: Convert driver completely to use set_ramp_delay callback Yadwinder Singh Brar
2013-06-29 12:51 ` [v2 PATCH 5/6] regulator: core: Remove redundant checks Yadwinder Singh Brar
2013-07-08 13:21 ` Mark Brown
2013-06-29 12:51 ` [v2 PATCH 6/6] mfd: s2mps11: Add device tree support Yadwinder Singh Brar
2013-07-08 13:28 ` Mark Brown
2013-07-08 13:41 ` Yadwinder Singh Brar
2013-07-11 11:06 ` Lee Jones
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=1372510280-31931-2-git-send-email-yadi.brar@samsung.com \
--to=yadi.brar@samsung.com \
--cc=broonie@kernel.org \
--cc=grant.likely@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=sachin.kamat@linaro.org \
--cc=sameo@linux.intel.com \
--cc=sbkim73@samsung.com \
--cc=yadi.brar01@gmail.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
all inboxes | Powered by JetHome®