From: Saurabh Singh <saurabh1.s@samsung.com>
To: lgirdwood@gmail.com, broonie@kernel.org, grant.likely@linaro.org,
rob.herring@calxeda.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, celinux-dev@tree.celinuxforum.org
Cc: srevatsa@samsung.com, bp.praveen@samsung.com
Subject: [PATCH] Parse missing regulator constraints from device tree blob
Date: Thu, 16 Jan 2014 06:34:45 +0000 (GMT) [thread overview]
Message-ID: <23745449.572421389854083634.JavaMail.weblogic@epml20> (raw)
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)
This patch is currently against a linux 3.12.6 kernel.
diffstat for this patch is:
of_regulator.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
To apply the patch, in the root of a kernel tree use:
patch -p1 < of_regulator.patch
Please let me know any feedback you have on this patch or the approach used.
Regards,
=====================
Saurabh Singh Sengar
Lead Engineer
Samsung R&D Institute
India
Samsung
=====================
Signed-off-by: Saurabh Singh Sengar <saurabh1.s@samsung.com>
--------------------------------------------------------------------------------
--- linux-3.12.6/drivers/regulator/of_regulator.c.orig 2014-01-08 17:19:43.085903573 +0530
+++ linux-3.12.6/drivers/regulator/of_regulator.c 2014-01-15 20:12:22.146543128 +0530
@@ -16,11 +16,40 @@
#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 *regulator_state)
+{
+ const __be32 *uV, *mode;
+
+ uV = of_get_property(np, "regulator-state-uV", NULL);
+ if (uV)
+ regulator_state->uV = be32_to_cpu(*uV);
+
+ mode = of_get_property(np, "regulator-state-mode", NULL);
+ if (mode)
+ regulator_state->mode = be32_to_cpu(*mode);
+
+ if (of_find_property(np, "regulator-state-enabled", NULL))
+ regulator_state->enabled = true;
+
+ if (of_find_property(np, "regulator-state-disabled", NULL))
+ regulator_state->disabled = true;
+}
+
+
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;
+ const __be32 *initial_mode, *initial_state;
+ const __be32 *input_uV, *valid_modes_mask;
+ struct device_node *state;
struct property *prop;
struct regulation_constraints *constraints = &(*init_data)->constraints;
@@ -73,6 +102,40 @@ static void of_get_regulation_constraint
else
constraints->ramp_disable = true;
}
+
+ valid_modes_mask = of_get_property(np,
+ "regulator-valid-modes-mask", NULL);
+ if (valid_modes_mask)
+ constraints->valid_modes_mask = be32_to_cpu(*valid_modes_mask);
+
+ input_uV = of_get_property(np, "regulator-input-microvolt", NULL);
+ if (input_uV)
+ constraints->input_uV = be32_to_cpu(*input_uV);
+
+ initial_mode = of_get_property(np, "regulator-initial-mode", NULL);
+ if (initial_mode)
+ constraints->initial_mode = be32_to_cpu(*initial_mode);
+
+ initial_state = of_get_property(np, "regulator-initial-state", NULL);
+ if (initial_state)
+ constraints->initial_state = be32_to_cpu(*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);
+
}
/**
WARNING: multiple messages have this Message-ID (diff)
From: Saurabh Singh <saurabh1.s@samsung.com>
To: lgirdwood@gmail.com, broonie@kernel.org, grant.likely@linaro.org,
rob.herring@calxeda.com, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, celinux-dev@tree.celinuxforum.org
Cc: srevatsa@samsung.com, bp.praveen@samsung.com
Subject: [PATCH] Parse missing regulator constraints from device tree blob
Date: Thu, 16 Jan 2014 06:34:45 +0000 (GMT) [thread overview]
Message-ID: <23745449.572421389854083634.JavaMail.weblogic@epml20> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=windows-1252, Size: 3857 bytes --]
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)
This patch is currently against a linux 3.12.6 kernel.
diffstat for this patch is:
of_regulator.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
To apply the patch, in the root of a kernel tree use:
patch -p1 < of_regulator.patch
Please let me know any feedback you have on this patch or the approach used.
Regards,
=====================
Saurabh Singh Sengar
Lead Engineer
Samsung R&D Institute
India
Samsung
=====================
Signed-off-by: Saurabh Singh Sengar <saurabh1.s@samsung.com>
--------------------------------------------------------------------------------
--- linux-3.12.6/drivers/regulator/of_regulator.c.orig 2014-01-08 17:19:43.085903573 +0530
+++ linux-3.12.6/drivers/regulator/of_regulator.c 2014-01-15 20:12:22.146543128 +0530
@@ -16,11 +16,40 @@
#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 *regulator_state)
+{
+ const __be32 *uV, *mode;
+
+ uV = of_get_property(np, "regulator-state-uV", NULL);
+ if (uV)
+ regulator_state->uV = be32_to_cpu(*uV);
+
+ mode = of_get_property(np, "regulator-state-mode", NULL);
+ if (mode)
+ regulator_state->mode = be32_to_cpu(*mode);
+
+ if (of_find_property(np, "regulator-state-enabled", NULL))
+ regulator_state->enabled = true;
+
+ if (of_find_property(np, "regulator-state-disabled", NULL))
+ regulator_state->disabled = true;
+}
+
+
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;
+ const __be32 *initial_mode, *initial_state;
+ const __be32 *input_uV, *valid_modes_mask;
+ struct device_node *state;
struct property *prop;
struct regulation_constraints *constraints = &(*init_data)->constraints;
@@ -73,6 +102,40 @@ static void of_get_regulation_constraint
else
constraints->ramp_disable = true;
}
+
+ valid_modes_mask = of_get_property(np,
+ "regulator-valid-modes-mask", NULL);
+ if (valid_modes_mask)
+ constraints->valid_modes_mask = be32_to_cpu(*valid_modes_mask);
+
+ input_uV = of_get_property(np, "regulator-input-microvolt", NULL);
+ if (input_uV)
+ constraints->input_uV = be32_to_cpu(*input_uV);
+
+ initial_mode = of_get_property(np, "regulator-initial-mode", NULL);
+ if (initial_mode)
+ constraints->initial_mode = be32_to_cpu(*initial_mode);
+
+ initial_state = of_get_property(np, "regulator-initial-state", NULL);
+ if (initial_state)
+ constraints->initial_state = be32_to_cpu(*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);
+
}
/**ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next reply other threads:[~2014-01-16 6:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 6:34 Saurabh Singh [this message]
2014-01-16 6:34 ` [PATCH] Parse missing regulator constraints from device tree blob Saurabh Singh
2014-01-16 10:28 ` Mark Rutland
2014-01-16 10:28 ` Mark Rutland
-- strict thread matches above, loose matches on Subject: below --
2014-01-16 13:43 Saurabh Singh
2014-01-16 13:43 ` Saurabh Singh
2014-01-16 14:07 ` Mark Brown
2014-01-16 14:07 ` Mark Brown
2014-01-17 15:04 Saurabh Singh
2014-01-17 15:04 ` Saurabh Singh
2014-01-17 15:11 Saurabh Singh
2014-01-17 15:11 ` Saurabh Singh
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=23745449.572421389854083634.JavaMail.weblogic@epml20 \
--to=saurabh1.s@samsung.com \
--cc=bp.praveen@samsung.com \
--cc=broonie@kernel.org \
--cc=celinux-dev@tree.celinuxforum.org \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=srevatsa@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.