From: Stephen Boyd <sboyd@codeaurora.org>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
David Collins <collinsd@codeaurora.org>,
devicetree@vger.kernel.org
Subject: [PATCH v2 4/6] regulator: Add soft start support
Date: Thu, 11 Jun 2015 17:37:05 -0700 [thread overview]
Message-ID: <1434069427-3642-5-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1434069427-3642-1-git-send-email-sboyd@codeaurora.org>
Some regulators support a "soft start" feature where the voltage
ramps up slowly when the regulator is enabled. Add an op
(set_soft_start) and a DT property + constraint to support this.
Cc: <devicetree@vger.kernel.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
Documentation/devicetree/bindings/regulator/regulator.txt | 1 +
drivers/regulator/core.c | 8 ++++++++
drivers/regulator/of_regulator.c | 3 +++
include/linux/regulator/driver.h | 2 ++
include/linux/regulator/machine.h | 1 +
5 files changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 6c79fd70ab5a..4b1df61ccbd7 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -19,6 +19,7 @@ Optional properties:
design requires. This property describes the total system ramp time
required due to the combination of internal ramping of the regulator itself,
and board design issues such as trace capacitance and load on the supply.
+- regulator-soft-start: Enable soft start so that voltage ramps slowly
- regulator-state-mem sub-root node for Suspend-to-RAM mode
: suspend to memory, the device goes to sleep, but all data stored in memory,
only some external interrupt can wake the device.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 1d6172a9f65c..88622fc76b81 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1059,6 +1059,14 @@ static int set_machine_constraints(struct regulator_dev *rdev,
}
}
+ if (rdev->constraints->soft_start && ops->set_soft_start) {
+ ret = ops->set_soft_start(rdev);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set soft start\n");
+ goto out;
+ }
+ }
+
print_constraints(rdev);
return 0;
out:
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 237b014666fa..72576dd9bf7b 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -84,6 +84,9 @@ static void of_get_regulation_constraints(struct device_node *np,
if (!ret)
constraints->enable_time = pval;
+ constraints->soft_start = of_property_read_bool(np,
+ "regulator-soft-start");
+
if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) {
if (desc && desc->of_map_mode) {
ret = desc->of_map_mode(pval);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 5eb85e152eb7..02e1e8d4b1bb 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -161,6 +161,8 @@ struct regulator_ops {
unsigned int old_selector,
unsigned int new_selector);
+ int (*set_soft_start) (struct regulator_dev *);
+
/* report regulator status ... most other accessors report
* control inputs, this reports results of combining inputs
* from Linux (and other sources) with the actual load.
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 8ffb0619a03c..7f7d0a3fe1e1 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -142,6 +142,7 @@ struct regulation_constraints {
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 */
+ unsigned soft_start:1; /* ramp voltage slowly */
unsigned pull_down:1; /* pull down resistor when regulator off */
};
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-06-12 0:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1434069427-3642-1-git-send-email-sboyd@codeaurora.org>
2015-06-12 0:37 ` [PATCH v2 1/6] regulator: Add QCOM SPMI regulator driver Stephen Boyd
2015-06-12 12:04 ` Mark Brown
2015-06-12 0:37 ` [PATCH v2 2/6] regulator: Add system_load constraint Stephen Boyd
2015-06-12 12:05 ` Mark Brown
2015-06-12 0:37 ` [PATCH v2 3/6] regulator: Add pull down support Stephen Boyd
2015-06-12 12:09 ` Mark Brown
2015-06-12 0:37 ` Stephen Boyd [this message]
2015-06-12 12:16 ` [PATCH v2 4/6] regulator: Add soft start support Mark Brown
2015-06-12 0:37 ` [PATCH v2 5/6] regulator: Add input current limit support Stephen Boyd
2015-06-12 12:18 ` Mark Brown
2015-06-12 0:37 ` [PATCH v2 6/6] regulator: qcom-spmi: Add vendor specific configuration Stephen Boyd
[not found] ` <1434069427-3642-7-git-send-email-sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-12 3:13 ` Rob Herring
2015-06-12 22:10 ` Stephen Boyd
2015-06-12 23:24 ` Stephen Boyd
[not found] ` <CAL_JsqL6R5jz1Xhgav0a0SeWqcRT200sofP-G_zQLfDVeqwarA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-14 4:12 ` Bjorn Andersson
[not found] <1434069067-1371-1-git-send-email-sboyd@codeaurora.org>
2015-06-12 0:31 ` [PATCH v2 4/6] regulator: Add soft start support Stephen Boyd
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=1434069427-3642-5-git-send-email-sboyd@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=broonie@kernel.org \
--cc=collinsd@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).