From: Saurabh Singh <saurabh1.s-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
"lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
"rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org"
<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org"
<celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org>,
SREEVATSA D B <srevatsa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
Praveen BP <bp.praveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Subject: Re: Re: [PATCH] Parse missing regulator constraints from device tree blob
Date: Thu, 16 Jan 2014 15:18:06 +0000 (GMT) [thread overview]
Message-ID: <8217085.584601389885483146.JavaMail.weblogic@epml20> (raw)
Hi Mark,
> Please send patches using the process in SubmittingPatches, the formatting
> of the submission is very important for tools like git am which people use to
> work with patches.
As per your request sending the patch and description in git format.
Please find below the patch.
Regards,
Saurabh Singh Sengar
Lead Engineer
Samsung R&D Institute
India
=================================================================================
From Saurabh Singh <saurabh1.s@samsung.com> Mon Sep 17 00:00:00 2001
Date: Thu, 16 Jan 2014 20:36:15 +0530
Subject: [PATCH] From: Saurabh Singh Sengar <saurabh1.s@samsung.com>
This patch adds support for parsing following regulator contraints from
device tree blob.
1. valid modes mask (valid_modes_mask)
2. input microvolt(input_uV)
3. initial mode (initial_mode)
4. initial state (initial_state)
5. state mem (state_mem)
6. state disk (state_disk)
7. state standby (state_standby)
Signed-off-by: Saurabh Singh Sengar <saurabh1.s@samsung.com>
---
.../devicetree/bindings/regulator/regulator.txt | 19 +++++++++
drivers/regulator/of_regulator.c | 41 ++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
index 2bd8f09..7793445 100644
--- a/Documentation/devicetree/bindings/regulator/regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/regulator.txt
@@ -14,6 +14,17 @@ Optional properties:
- 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.
+- regulator-valid-modes-mask: valid operations for regulator on particular machine
+- regulator-input-uv: regulator input voltage, only if supply is another regulator
+- regulator-initial-mode: default mode to set on startup
+- regulator-initial-state: suspend state to set at init
+- regulator-state-mem, regulator-state-disk, regulator-state-standby:
+ defines regulator suspend to memory, suspend to disk (hibernate) and standby respectively.
+ have following sub-constarints:
+ - regulator-state-uv: suspend voltage
+ - regulator-state-mode: suspend regulator operating mode
+ - regulator-state-enabled: is regulator enabled in this suspend state
+ - regulator-state-disabled: is the regulator disbled in this suspend state
Deprecated properties:
- regulator-compatible: If a regulator chip contains multiple
@@ -29,6 +40,14 @@ Example:
regulator-max-microvolt = <2500000>;
regulator-always-on;
vin-supply = <&vin>;
+ regulator-valid-modes-mask = <REGULATOR_MODE_FAST>;
+ regulator-initial-mode = <REGULATOR_MODE_STANDBY>;
+ regulator-initial-state = <PM_SUSPEND_MEM>;
+ regulator-state-mem {
+ regulator-state-mode = <REGULATOR_MODE_IDLE>;
+ regulator-state-enabled;
+ };
+
};
Regulator Consumers:
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 7827384..328d76f 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -16,11 +16,27 @@
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
+/**
+ * set_regulator_state_constraints - set regulator state for low power system states
+ * @np: device node for the low power regulator state
+ * @regulator_state: regulator_state structure need to be filled
+ */
+static void set_regulator_state_constraints(struct device_node *np,
+ struct regulator_state *state)
+{
+ of_property_read_u32(np, "regulator-state-uv", &state->uV);
+ of_property_read_u32(np, "regulator-state-mode", &state->mode);
+ state->enabled = of_property_read_bool(np, "regulator-state-enabled");
+ state->disabled = of_property_read_bool(np, "regulator-state-disabled");
+}
+
+
static void of_get_regulation_constraints(struct device_node *np,
struct regulator_init_data **init_data)
{
const __be32 *min_uV, *max_uV, *uV_offset;
const __be32 *min_uA, *max_uA, *ramp_delay;
+ struct device_node *state;
struct property *prop;
struct regulation_constraints *constraints = &(*init_data)->constraints;
@@ -73,6 +89,31 @@ static void of_get_regulation_constraints(struct device_node *np,
else
constraints->ramp_disable = true;
}
+
+ of_property_read_u32(np, "regulator-valid-modes-mask",
+ &constraints->valid_modes_mask);
+ of_property_read_u32(np, "regulator-input-uv",
+ &constraints->input_uV);
+ of_property_read_u32(np, "regulator-initial-mode",
+ &constraints->initial_mode);
+ of_property_read_u32(np, "regulator-initial-state",
+ &constraints->initial_state);
+
+ /* regulator state during low power system states */
+ state = of_find_node_by_name(np, "regulator-state-mem");
+ if (state)
+ set_regulator_state_constraints(state,
+ &constraints->state_mem);
+
+ state = of_find_node_by_name(np, "regulator-state-disk");
+ if (state)
+ set_regulator_state_constraints(state,
+ &constraints->state_disk);
+
+ state = of_find_node_by_name(np, "regulator-state-standby");
+ if (state)
+ set_regulator_state_constraints(state,
+ &constraints->state_standby);
}
/**
--
1.7.0.4
next reply other threads:[~2014-01-16 15:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 15:18 Saurabh Singh [this message]
2014-01-16 17:56 ` Re: [PATCH] Parse missing regulator constraints from device tree blob Mark Brown
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=8217085.584601389885483146.JavaMail.weblogic@epml20 \
--to=saurabh1.s-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
--cc=bp.praveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=celinux-dev-VxL1A5FK7jA05z2xGA6PZHhyD016LWXt@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=srevatsa-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.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).