From: Grant Likely <grant.likely@secretlab.ca>
To: Rajendra Nayak <rnayak@ti.com>
Cc: broonie@opensource.wolfsonmicro.com,
devicetree-discuss@lists.ozlabs.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, tony@atomide.com,
lrg@ti.com, b-cousson@ti.com
Subject: Re: [RFC PATCH 06/11] DT: regulator: Helper routine to extract fixed_voltage_config
Date: Thu, 15 Sep 2011 16:19:12 -0600 [thread overview]
Message-ID: <20110915221912.GO3523@ponder.secretlab.ca> (raw)
In-Reply-To: <1316085727-15023-7-git-send-email-rnayak@ti.com>
On Thu, Sep 15, 2011 at 04:52:02PM +0530, Rajendra Nayak wrote:
> The helper routine defined here (of_get_fixed_voltage_config) can
> be used to extract information about fixed regulators (which are not
> software controlable) from device tree.
>
> Add documenation about additional bindings for fixed
> regulators that can be passed through DT.
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> ---
> .../devicetree/bindings/regulator/regulator.txt | 19 ++++++++++++
> drivers/of/of_regulator.c | 31 ++++++++++++++++++++
> include/linux/of_regulator.h | 7 ++++
> 3 files changed, 57 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt
> index 001e5ce..f8c51d8 100644
> --- a/Documentation/devicetree/bindings/regulator/regulator.txt
> +++ b/Documentation/devicetree/bindings/regulator/regulator.txt
> @@ -2,6 +2,8 @@ Voltage/Current Regulators
>
> Required properties:
> - compatible: Must be "regulator";
> +or
> +- compatible: Must be "regulator-fixed"; /* For Fixed volatge regulator */
regulator-fixed should actually just be another driver binding that
uses the regulator binding.
>
> Optional properties:
> - supply-regulator: Name of the parent regulator
> @@ -24,6 +26,13 @@ Optional properties:
> - always-on: boolean, regulator should never be disabled
> - boot-on: bootloader/firmware enabled regulator
> - apply-uV: apply uV constraint if min == max
> +# For fixed voltage regulators
> +- supply-name: Name of the regulator supply
> +- microvolts: Output voltage of regulator
> +- gpio: gpio to use for enable control
> +- startup-delay: startup time in microseconds
> +- enable-high: Polarity of enable GPIO, 1 = Active High, 0 = Active low
> +- enabled-at-boot: 1 = yes, 0 = no
>
> Example:
>
> @@ -35,3 +44,13 @@ Example:
> change-voltage;
> always-on;
> };
> +
> + abc-fixedregulator {
> + compatible = "regulator-fixed";
> + supply-name = "fixed-supply";
> + microvolts = <1800000>;
> + gpio = <43>;
> + startup-delay = <70000>;
> + enable-high;
> + enabled-at-boot;
> + };
> diff --git a/drivers/of/of_regulator.c b/drivers/of/of_regulator.c
> index f01d275..4d7a49d 100644
> --- a/drivers/of/of_regulator.c
> +++ b/drivers/of/of_regulator.c
> @@ -13,6 +13,7 @@
> #include <linux/slab.h>
> #include <linux/of.h>
> #include <linux/regulator/machine.h>
> +#include <linux/regulator/fixed.h>
>
> static void of_get_regulation_constraints(struct device_node *np,
> struct regulator_init_data **init_data)
> @@ -83,3 +84,33 @@ struct regulator_init_data *of_get_regulator_init_data(struct device_node *np)
> return init_data;
> }
> EXPORT_SYMBOL(of_get_regulator_init_data);
> +
> +/**
> + * of_get_fixed_voltage_config - extract fixed_voltage_config structure info
> + * @np: Pointer to fixed-regulator device tree node
> + *
> + * Populates fixed_voltage_config structure by extracting data from device
> + * tree node, returns a pointer to the populated structure of NULL if memory
> + * alloc fails.
> + */
> +struct fixed_voltage_config *of_get_fixed_voltage_config(struct device_node *np)
> +{
> + struct fixed_voltage_config *config;
> +
> + config = kzalloc(sizeof(struct fixed_voltage_config), GFP_KERNEL);
> + if (!config)
> + return NULL;
> +
> + config->supply_name = (char *)of_get_property(np, "supply-name", NULL);
> + of_property_read_u32(np, "microvolts", &config->microvolts);
> + of_property_read_u32(np, "gpio", &config->gpio);
> + of_property_read_u32(np, "startup-delay", &config->startup_delay);
> + if (of_find_property(np, "enable-high", NULL))
> + config->enable_high = true;
> + if (of_find_property(np, "enabled-at-boot", NULL))
> + config->enabled_at_boot = true;
> + config->init_data = of_get_regulator_init_data(np);
> +
> + return config;
> +}
> +EXPORT_SYMBOL(of_get_fixed_voltage_config);
> diff --git a/include/linux/of_regulator.h b/include/linux/of_regulator.h
> index 5eb048c..39860c5 100644
> --- a/include/linux/of_regulator.h
> +++ b/include/linux/of_regulator.h
> @@ -11,12 +11,19 @@
> #if defined(CONFIG_OF_REGULATOR)
> extern struct regulator_init_data
> *of_get_regulator_init_data(struct device_node *np);
> +extern struct fixed_voltage_config
> + *of_get_fixed_voltage_config(struct device_node *np);
> #else
> static inline struct regulator_init_data
> *of_get_regulator_init_data(struct device_node *np)
> {
> return NULL;
> }
> +static inline struct fixed_voltage_config
> + *of_get_fixed_voltage_config(struct device_node *np)
> +{
> + return NULL;
> +}
> #endif /* CONFIG_OF_REGULATOR */
>
> #endif /* __LINUX_OF_REG_H */
> --
> 1.7.1
>
next prev parent reply other threads:[~2011-09-15 22:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 11:21 [RFC PATCH 00/11] Device tree support for regulators Rajendra Nayak
2011-09-15 11:21 ` [RFC PATCH 01/11] OMAP: TWL: Clean up mode and ops mask passed from board files Rajendra Nayak
2011-09-15 11:21 ` [RFC PATCH 02/11] regulator: Fix error check in set_consumer_device_supply Rajendra Nayak
2011-09-15 11:21 ` [RFC PATCH 03/11] DT: regulator: Helper routine to extract regulator_init_data Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 04/11] omap4: SDP: Pass regulator_init_data from DT Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 05/11] TWL: regulator: Make twl-regulator driver extract data " Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 06/11] DT: regulator: Helper routine to extract fixed_voltage_config Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 07/11] regulator: Make fixed regulator driver extract data from DT Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 08/11] omap4: panda: Pass fixed regulator " Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 09/11] DT: regulator: Helper to extract regulator node based on supply name Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree Rajendra Nayak
2011-09-15 11:22 ` [RFC PATCH 11/11] DT: regulator: register regulators as platform devices Rajendra Nayak
2011-09-15 14:21 ` Mark Brown
2011-09-16 7:22 ` Rajendra Nayak
2011-09-15 13:59 ` [RFC PATCH 10/11] regulator: Implement consumer regulator mapping from device tree Mark Brown
2011-09-16 7:21 ` Rajendra Nayak
[not found] ` <4E72F8E2.3020200-l0cyMroinI0@public.gmane.org>
2011-09-16 9:02 ` Mark Brown
2011-09-15 13:54 ` [RFC PATCH 09/11] DT: regulator: Helper to extract regulator node based on supply name Mark Brown
2011-09-15 22:50 ` Grant Likely
2011-09-15 23:03 ` Mark Brown
2011-09-16 7:19 ` Rajendra Nayak
2011-09-15 13:51 ` [RFC PATCH 07/11] regulator: Make fixed regulator driver extract data from DT Mark Brown
2011-09-15 13:50 ` [RFC PATCH 06/11] DT: regulator: Helper routine to extract fixed_voltage_config Mark Brown
2011-09-16 7:19 ` Rajendra Nayak
2011-09-16 9:01 ` Mark Brown
[not found] ` <20110916090123.GE22062-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-09-16 9:26 ` Rajendra Nayak
2011-09-15 22:19 ` Grant Likely [this message]
2011-09-15 22:18 ` [RFC PATCH 05/11] TWL: regulator: Make twl-regulator driver extract data from DT Grant Likely
2011-09-16 7:25 ` Rajendra Nayak
2011-09-15 13:46 ` [RFC PATCH 04/11] omap4: SDP: Pass regulator_init_data " Mark Brown
2011-09-15 22:16 ` Grant Likely
2011-09-16 7:17 ` Rajendra Nayak
2011-09-16 9:00 ` Mark Brown
2011-09-16 9:26 ` Rajendra Nayak
2011-09-15 22:15 ` Grant Likely
2011-09-15 13:44 ` [RFC PATCH 03/11] DT: regulator: Helper routine to extract regulator_init_data Mark Brown
2011-09-15 18:17 ` Rob Herring
2011-09-16 7:15 ` Rajendra Nayak
2011-09-16 8:58 ` Mark Brown
2011-09-15 18:30 ` Rob Herring
2011-09-15 22:12 ` Grant Likely
2011-09-16 7:24 ` Rajendra Nayak
2011-09-16 9:52 ` Mark Brown
2011-09-15 13:33 ` [RFC PATCH 02/11] regulator: Fix error check in set_consumer_device_supply Mark Brown
2011-09-16 7:12 ` Rajendra Nayak
2011-09-15 13:32 ` [RFC PATCH 01/11] OMAP: TWL: Clean up mode and ops mask passed from board files Mark Brown
2011-09-16 7:11 ` Rajendra Nayak
2011-09-16 8:57 ` Mark Brown
2011-09-16 9:25 ` Rajendra Nayak
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=20110915221912.GO3523@ponder.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=b-cousson@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=lrg@ti.com \
--cc=rnayak@ti.com \
--cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).