* [PATCH v3 0/4] Device tree support for regulators
@ 2011-10-27 7:56 Rajendra Nayak
[not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>
2011-10-27 9:08 ` [PATCH v3 0/4] Device tree support for regulators Mark Brown
0 siblings, 2 replies; 24+ messages in thread
From: Rajendra Nayak @ 2011-10-27 7:56 UTC (permalink / raw)
To: broonie, grant.likely
Cc: b-cousson, patches, tony, devicetree-discuss, Rajendra Nayak,
linux-kernel, shawn.guo, linux-omap, lrg, linux-arm-kernel
Hi Mark, Grant,
v3 is based on the latest devicetree/next and is tested
(with twl adaptaions, which will be posted seperately)
on the OMAP4 panda and OMAP4 sdp boards.
The patches can be found here:
git://gitorious.org/omap-pm/linux.git for-dt/regulator
major changes in v3:
-1- Dropped "regulator: twl: Remove hardcoded board constraints from driver"
from the series.
-2- Added of_node as an additional paramter to regulator_register()
mainly done in new patch added,
"regulator: pass additional of_node to regulator_register()"
-3- Dropped some of the generic regulator bindings to be revisted later.
Thanks to Shawn Guo for bringing out the issue with the previous
series which did not handle cases of regulator drivers implemented
with one virtual device modeling all regulators.
regards,
Rajendra
Rajendra Nayak (4):
regulator: helper routine to extract regulator_init_data
regulator: adapt fixed regulator driver to dt
regulator: pass additional of_node to regulator_register()
regulator: map consumer regulator based on device tree
.../bindings/regulator/fixed-regulator.txt | 25 ++++++
.../devicetree/bindings/regulator/regulator.txt | 32 ++++++++
drivers/regulator/88pm8607.c | 2 +-
drivers/regulator/Kconfig | 7 ++
drivers/regulator/Makefile | 1 +
drivers/regulator/aat2870-regulator.c | 2 +-
drivers/regulator/ab3100.c | 2 +-
drivers/regulator/ab8500.c | 2 +-
drivers/regulator/ad5398.c | 2 +-
drivers/regulator/bq24022.c | 2 +-
drivers/regulator/core.c | 82 ++++++++++++++++---
drivers/regulator/da903x.c | 2 +-
drivers/regulator/db8500-prcmu.c | 2 +-
drivers/regulator/dummy.c | 2 +-
drivers/regulator/fixed.c | 59 ++++++++++++++-
drivers/regulator/isl6271a-regulator.c | 2 +-
drivers/regulator/lp3971.c | 2 +-
drivers/regulator/lp3972.c | 2 +-
drivers/regulator/max1586.c | 2 +-
drivers/regulator/max8649.c | 2 +-
drivers/regulator/max8660.c | 2 +-
drivers/regulator/max8925-regulator.c | 2 +-
drivers/regulator/max8952.c | 2 +-
drivers/regulator/max8997.c | 2 +-
drivers/regulator/max8998.c | 2 +-
drivers/regulator/mc13783-regulator.c | 2 +-
drivers/regulator/mc13892-regulator.c | 2 +-
drivers/regulator/of_regulator.c | 66 ++++++++++++++++
drivers/regulator/pcap-regulator.c | 2 +-
drivers/regulator/pcf50633-regulator.c | 2 +-
drivers/regulator/tps6105x-regulator.c | 3 +-
drivers/regulator/tps65023-regulator.c | 2 +-
drivers/regulator/tps6507x-regulator.c | 2 +-
drivers/regulator/tps6524x-regulator.c | 2 +-
drivers/regulator/tps6586x-regulator.c | 2 +-
drivers/regulator/tps65910-regulator.c | 2 +-
drivers/regulator/tps65912-regulator.c | 2 +-
drivers/regulator/twl-regulator.c | 2 +-
drivers/regulator/wm831x-dcdc.c | 8 +-
drivers/regulator/wm831x-isink.c | 2 +-
drivers/regulator/wm831x-ldo.c | 6 +-
drivers/regulator/wm8350-regulator.c | 2 +-
drivers/regulator/wm8400-regulator.c | 2 +-
drivers/regulator/wm8994-regulator.c | 2 +-
include/linux/regulator/driver.h | 4 +-
include/linux/regulator/of_regulator.h | 20 +++++
sound/soc/codecs/sgtl5000.c | 2 +-
47 files changed, 325 insertions(+), 58 deletions(-)
create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt
create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt
create mode 100644 drivers/regulator/of_regulator.c
create mode 100644 include/linux/regulator/of_regulator.h
^ permalink raw reply [flat|nested] 24+ messages in thread[parent not found: <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>]
* [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data [not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> @ 2011-10-27 7:56 ` Rajendra Nayak 2011-10-27 8:09 ` Mark Brown 2011-10-27 7:56 ` [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt Rajendra Nayak ` (2 subsequent siblings) 3 siblings, 1 reply; 24+ messages in thread From: Rajendra Nayak @ 2011-10-27 7:56 UTC (permalink / raw) To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r The helper routine is meant to be used by the regulator drivers to extract the regulator_init_data structure from the data that is passed from device tree. 'consumer_supplies' which is part of regulator_init_data is not extracted as the regulator consumer mappings are passed through DT differently, implemented in subsequent patches. Similarly the regulator<-->parent/supply mapping is handled in subsequent patches. Also add documentation for regulator bindings to be used to pass regulator_init_data struct information from device tree. Some of the regulator properties which are linux and board specific, are left out since its not clear if they can be in someway embedded into the kernel or passed in from DT. They will be revisited later. Signed-off-by: Rajendra Nayak <rnayak-l0cyMroinI0@public.gmane.org> --- .../devicetree/bindings/regulator/regulator.txt | 32 ++++++++++ drivers/regulator/Kconfig | 7 ++ drivers/regulator/Makefile | 1 + drivers/regulator/of_regulator.c | 66 ++++++++++++++++++++ include/linux/regulator/of_regulator.h | 20 ++++++ 5 files changed, 126 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt create mode 100644 drivers/regulator/of_regulator.c create mode 100644 include/linux/regulator/of_regulator.h diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt new file mode 100644 index 0000000..5a2878d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/regulator.txt @@ -0,0 +1,32 @@ +Voltage/Current Regulators + +Optional properties: +- regulator-min-uV: smallest voltage consumers may set +- regulator-max-uV: largest voltage consumers may set +- regulator-uV-offset: Offset applied to voltages to compensate for voltage drops +- regulator-min-uA: smallest current consumers may set +- regulator-max-uA: largest current consumers may set +- regulator-always-on: boolean, regulator should never be disabled +- regulator-boot-on: bootloader/firmware enabled regulator +- <name>-supply: phandle to the parent supply/regulator node + +Example: + + xyzreg: regulator@0 { + regulator-min-uV = <1000000>; + regulator-max-uV = <2500000>; + regulator-always-on; + vin-supply = <&vin>; + }; + +The same binding used by a regulator to reference its +supply can be used by any consumer to reference its +regulator/supply + +Example of a device node referencing a regulator node, + + devicenode: node@0x0 { + ... + ... + <name>-supply = <&xyzreg>; + }; diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index c7fd2c0..8106958 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -64,6 +64,13 @@ config REGULATOR_USERSPACE_CONSUMER If unsure, say no. +config OF_REGULATOR + bool + depends on OF + help + OpenFirmware regulator framework helper routines that can + used by regulator drivers to extract data from device tree. + config REGULATOR_BQ24022 tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" help diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 040d5aa..e6bc009 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_REGULATOR) += core.o dummy.o obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o +obj-$(CONFIG_OF_REGULATOR) += of_regulator.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c new file mode 100644 index 0000000..ac9d219 --- /dev/null +++ b/drivers/regulator/of_regulator.c @@ -0,0 +1,66 @@ +/* + * OF helpers for regulator framework + * + * Copyright (C) 2011 Texas Instruments, Inc. + * Rajendra Nayak <rnayak-l0cyMroinI0@public.gmane.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include <linux/slab.h> +#include <linux/of.h> +#include <linux/regulator/machine.h> + +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; + + min_uV = of_get_property(np, "regulator-min-uV", NULL); + if (min_uV) + (*init_data)->constraints.min_uV = be32_to_cpu(*min_uV); + max_uV = of_get_property(np, "regulator-max-uV", NULL); + if (max_uV) + (*init_data)->constraints.max_uV = be32_to_cpu(*max_uV); + uV_offset = of_get_property(np, "regulator-uV-offset", NULL); + if (uV_offset) + (*init_data)->constraints.uV_offset = be32_to_cpu(*uV_offset); + min_uA = of_get_property(np, "regulator-min-uA", NULL); + if (min_uA) + (*init_data)->constraints.min_uA = be32_to_cpu(*min_uA); + max_uA = of_get_property(np, "regulator-max-uA", NULL); + if (max_uA) + (*init_data)->constraints.max_uA = be32_to_cpu(*max_uA); + + if (of_find_property(np, "regulator-always-on", NULL)) + (*init_data)->constraints.always_on = true; + if (of_find_property(np, "regulator-boot-on", NULL)) + (*init_data)->constraints.boot_on = true; +} + +/** + * of_get_regulator_init_data - extract regulator_init_data structure info + * @dev: device requesting for regulator_init_data + * + * Populates regulator_init_data structure by extracting data from device + * tree node, returns a pointer to the populated struture or NULL if memory + * alloc fails. + */ +struct regulator_init_data *of_get_regulator_init_data(struct device *dev) +{ + struct regulator_init_data *init_data; + + if (!dev->of_node) + return NULL; + + init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL); + if (!init_data) + return NULL; /* Out of memory? */ + + of_get_regulation_constraints(dev->of_node, &init_data); + return init_data; +} diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h new file mode 100644 index 0000000..621c071 --- /dev/null +++ b/include/linux/regulator/of_regulator.h @@ -0,0 +1,20 @@ +/* + * OpenFirmware regulator support routines + * + */ + +#ifndef __LINUX_OF_REG_H +#define __LINUX_OF_REG_H + +#if defined(CONFIG_OF_REGULATOR) +extern struct regulator_init_data + *of_get_regulator_init_data(struct device *dev); +#else +static inline struct regulator_init_data + *of_get_regulator_init_data(struct device *dev) +{ + return NULL; +} +#endif /* CONFIG_OF_REGULATOR */ + +#endif /* __LINUX_OF_REG_H */ -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data 2011-10-27 7:56 ` [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data Rajendra Nayak @ 2011-10-27 8:09 ` Mark Brown 2011-10-27 10:43 ` Nayak, Rajendra 0 siblings, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-10-27 8:09 UTC (permalink / raw) To: Rajendra Nayak Cc: b-cousson, patches, tony, devicetree-discuss, linux-kernel, grant.likely, shawn.guo, linux-omap, lrg, linux-arm-kernel On Thu, Oct 27, 2011 at 01:26:22PM +0530, Rajendra Nayak wrote: > + min_uV = of_get_property(np, "regulator-min-uV", NULL); > + if (min_uV) > + (*init_data)->constraints.min_uV = be32_to_cpu(*min_uV); > + max_uV = of_get_property(np, "regulator-max-uV", NULL); > + if (max_uV) > + (*init_data)->constraints.max_uV = be32_to_cpu(*max_uV); If we have min_uV and max_uV we should also set REGULATOR_CHANGE_VOLTAGE (and similarly for the currents). We should also have a way to enable status changes - since there's an always_on property (which does make sense) I'd suggest that as a first pass we should enable status changes if always_on is not set (these two things are a bit redundant in the existing constrints). This is slightly risky as you can get a situation where new device driver support for regulators starts unexpectedly turning off supplies but that's always going to be a risk with constraints disassociated from the kernel. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data 2011-10-27 8:09 ` Mark Brown @ 2011-10-27 10:43 ` Nayak, Rajendra 2011-10-27 11:49 ` Mark Brown 0 siblings, 1 reply; 24+ messages in thread From: Nayak, Rajendra @ 2011-10-27 10:43 UTC (permalink / raw) To: Mark Brown Cc: grant.likely, devicetree-discuss, linux-omap, linux-arm-kernel, tony, lrg, b-cousson, patches, linux-kernel, shawn.guo > If we have min_uV and max_uV we should also set REGULATOR_CHANGE_VOLTAGE > (and similarly for the currents). > > We should also have a way to enable status changes - since there's an > always_on property (which does make sense) I'd suggest that as a first > pass we should enable status changes if always_on is not set (these two > things are a bit redundant in the existing constrints). This is > slightly risky as you can get a situation where new device driver > support for regulators starts unexpectedly turning off supplies but > that's always going to be a risk with constraints disassociated from the > kernel. okay, here's an updated patch which does that. I also added a binding to specify a descriptive name to the regulator outputs as you suggested in the other thread. From a350de42446606abdc711a4acba39ae39b8f07bc Mon Sep 17 00:00:00 2001 From: Rajendra Nayak <rnayak@ti.com> Date: Thu, 25 Aug 2011 20:31:49 +0530 Subject: [PATCH v4 1/4] regulator: helper routine to extract regulator_init_data The helper routine is meant to be used by the regulator drivers to extract the regulator_init_data structure from the data that is passed from device tree. 'consumer_supplies' which is part of regulator_init_data is not extracted as the regulator consumer mappings are passed through DT differently, implemented in subsequent patches. Similarly the regulator<-->parent/supply mapping is handled in subsequent patches. Also add documentation for regulator bindings to be used to pass regulator_init_data struct information from device tree. Some of the regulator properties which are linux and board specific, are left out since its not clear if they can be in someway embedded into the kernel or passed in from DT. They will be revisited later. Signed-off-by: Rajendra Nayak <rnayak@ti.com> --- .../devicetree/bindings/regulator/regulator.txt | 33 ++++++++ drivers/regulator/Kconfig | 7 ++ drivers/regulator/Makefile | 1 + drivers/regulator/of_regulator.c | 81 ++++++++++++++++++++ include/linux/regulator/of_regulator.h | 20 +++++ 5 files changed, 142 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/regulator.txt create mode 100644 drivers/regulator/of_regulator.c create mode 100644 include/linux/regulator/of_regulator.h diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt new file mode 100644 index 0000000..c488bf3 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/regulator.txt @@ -0,0 +1,33 @@ +Voltage/Current Regulators + +Optional properties: +- regulator-name: A string used as a descriptive name for regulator outputs +- regulator-min-uV: smallest voltage consumers may set +- regulator-max-uV: largest voltage consumers may set +- regulator-uV-offset: Offset applied to voltages to compensate for voltage drops +- regulator-min-uA: smallest current consumers may set +- regulator-max-uA: largest current consumers may set +- regulator-always-on: boolean, regulator should never be disabled +- regulator-boot-on: bootloader/firmware enabled regulator +- <name>-supply: phandle to the parent supply/regulator node + +Example: + + xyzreg: regulator@0 { + regulator-min-uV = <1000000>; + regulator-max-uV = <2500000>; + regulator-always-on; + vin-supply = <&vin>; + }; + +The same binding used by a regulator to reference its +supply can be used by any consumer to reference its +regulator/supply + +Example of a device node referencing a regulator node, + + devicenode: node@0x0 { + ... + ... + <name>-supply = <&xyzreg>; + }; diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index c7fd2c0..8106958 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -64,6 +64,13 @@ config REGULATOR_USERSPACE_CONSUMER If unsure, say no. +config OF_REGULATOR + bool + depends on OF + help + OpenFirmware regulator framework helper routines that can + used by regulator drivers to extract data from device tree. + config REGULATOR_BQ24022 tristate "TI bq24022 Dual Input 1-Cell Li-Ion Charger IC" help diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 040d5aa..e6bc009 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_REGULATOR) += core.o dummy.o obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o +obj-$(CONFIG_OF_REGULATOR) += of_regulator.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c new file mode 100644 index 0000000..798faaa --- /dev/null +++ b/drivers/regulator/of_regulator.c @@ -0,0 +1,81 @@ +/* + * OF helpers for regulator framework + * + * Copyright (C) 2011 Texas Instruments, Inc. + * Rajendra Nayak <rnayak@ti.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include <linux/slab.h> +#include <linux/of.h> +#include <linux/regulator/machine.h> + +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; + struct regulation_constraints *constraints = &(*init_data)->constraints; + + constraints->name = of_get_property(np, "regulator-name", NULL); + + min_uV = of_get_property(np, "regulator-min-uV", NULL); + if (min_uV) + constraints->min_uV = be32_to_cpu(*min_uV); + max_uV = of_get_property(np, "regulator-max-uV", NULL); + if (max_uV) + constraints->max_uV = be32_to_cpu(*max_uV); + + /* Voltage change possible? */ + if (constraints->min_uV != constraints->max_uV) + constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; + + uV_offset = of_get_property(np, "regulator-uV-offset", NULL); + if (uV_offset) + constraints->uV_offset = be32_to_cpu(*uV_offset); + min_uA = of_get_property(np, "regulator-min-uA", NULL); + if (min_uA) + constraints->min_uA = be32_to_cpu(*min_uA); + max_uA = of_get_property(np, "regulator-max-uA", NULL); + if (max_uA) + constraints->max_uA = be32_to_cpu(*max_uA); + + /* Current change possible? */ + if (constraints->min_uA != constraints->max_uA) + constraints->valid_ops_mask |= REGULATOR_CHANGE_CURRENT; + + if (of_find_property(np, "regulator-boot-on", NULL)) + constraints->boot_on = true; + + if (of_find_property(np, "regulator-always-on", NULL)) + constraints->always_on = true; + else /* status change should be possible if not always on. */ + constraints->valid_ops_mask |= REGULATOR_CHANGE_STATUS; +} + +/** + * of_get_regulator_init_data - extract regulator_init_data structure info + * @dev: device requesting for regulator_init_data + * + * Populates regulator_init_data structure by extracting data from device + * tree node, returns a pointer to the populated struture or NULL if memory + * alloc fails. + */ +struct regulator_init_data *of_get_regulator_init_data(struct device *dev) +{ + struct regulator_init_data *init_data; + + if (!dev->of_node) + return NULL; + + init_data = devm_kzalloc(dev, sizeof(*init_data), GFP_KERNEL); + if (!init_data) + return NULL; /* Out of memory? */ + + of_get_regulation_constraints(dev->of_node, &init_data); + return init_data; +} diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h new file mode 100644 index 0000000..621c071 --- /dev/null +++ b/include/linux/regulator/of_regulator.h @@ -0,0 +1,20 @@ +/* + * OpenFirmware regulator support routines + * + */ + +#ifndef __LINUX_OF_REG_H +#define __LINUX_OF_REG_H + +#if defined(CONFIG_OF_REGULATOR) +extern struct regulator_init_data + *of_get_regulator_init_data(struct device *dev); +#else +static inline struct regulator_init_data + *of_get_regulator_init_data(struct device *dev) +{ + return NULL; +} +#endif /* CONFIG_OF_REGULATOR */ + +#endif /* __LINUX_OF_REG_H */ -- 1.7.1 > -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data 2011-10-27 10:43 ` Nayak, Rajendra @ 2011-10-27 11:49 ` Mark Brown 2011-10-27 13:27 ` Rajendra Nayak 0 siblings, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-10-27 11:49 UTC (permalink / raw) To: Nayak, Rajendra Cc: grant.likely, devicetree-discuss, linux-omap, linux-arm-kernel, tony, lrg, b-cousson, patches, linux-kernel, shawn.guo On Thu, Oct 27, 2011 at 04:13:08PM +0530, Nayak, Rajendra wrote: > okay, here's an updated patch which does that. I also added a binding to > specify a descriptive name to the regulator outputs as you suggested in > the other thread. Looks good! I guess we may run into issues with the status change thing but I think we need to gather some experience to figure that out and since it's implicit hopefully that won't have any compatibility issues if it does happen. Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> I guess it might be useful to resend without this bit at the top to make it easier for Liam to apply. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data 2011-10-27 11:49 ` Mark Brown @ 2011-10-27 13:27 ` Rajendra Nayak 0 siblings, 0 replies; 24+ messages in thread From: Rajendra Nayak @ 2011-10-27 13:27 UTC (permalink / raw) To: Mark Brown Cc: b-cousson, patches, tony, devicetree-discuss, linux-kernel, grant.likely, shawn.guo, linux-omap, lrg, linux-arm-kernel On Thursday 27 October 2011 05:19 PM, Mark Brown wrote: > On Thu, Oct 27, 2011 at 04:13:08PM +0530, Nayak, Rajendra wrote: > >> okay, here's an updated patch which does that. I also added a binding to >> specify a descriptive name to the regulator outputs as you suggested in >> the other thread. > > Looks good! I guess we may run into issues with the status change thing > but I think we need to gather some experience to figure that out and > since it's implicit hopefully that won't have any compatibility issues > if it does happen. > > Acked-by: Mark Brown<broonie@opensource.wolfsonmicro.com> > > I guess it might be useful to resend without this bit at the top to make > it easier for Liam to apply. Thanks Mark, just resent the patch with your Ack included. ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt [not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> 2011-10-27 7:56 ` [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data Rajendra Nayak @ 2011-10-27 7:56 ` Rajendra Nayak [not found] ` <1319702185-16108-3-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> 2011-11-04 20:34 ` Olof Johansson 2011-10-27 7:56 ` [PATCH v3 3/4] regulator: pass additional of_node to regulator_register() Rajendra Nayak 2011-10-27 7:56 ` [PATCH v3 4/4] regulator: map consumer regulator based on device tree Rajendra Nayak 3 siblings, 2 replies; 24+ messages in thread From: Rajendra Nayak @ 2011-10-27 7:56 UTC (permalink / raw) To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r The fixed regulator driver uses of_get_fixed_voltage_config() to extract fixed_voltage_config structure contents from device tree. Also add documenation for additional bindings for fixed regulators that can be passed through dt. Signed-off-by: Rajendra Nayak <rnayak-l0cyMroinI0@public.gmane.org> --- .../bindings/regulator/fixed-regulator.txt | 25 +++++++++ drivers/regulator/fixed.c | 57 ++++++++++++++++++++ 2 files changed, 82 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.txt b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt new file mode 100644 index 0000000..049df3d --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt @@ -0,0 +1,25 @@ +Fixed Voltage regulators + +Required properties: +- compatible: Must be "regulator-fixed"; + +Optional properties: +- regulator-fixed-supply: Name of the regulator supply +- regulator-fixed-microvolts: Output voltage of regulator +- regulator-fixed-gpio: gpio to use for enable control +- regulator-fixed-startup-delay: startup time in microseconds +- regulator-fixed-enable-high: Polarity of enable GPIO, + 1 = Active High, 0 = Active low +- regulator-fixed-enabled-at-boot: 1 = yes, 0 = no + +Example: + + abc: fixedregulator@0 { + compatible = "regulator-fixed"; + regulator-fixed-supply = "fixed-supply"; + regulator-fixed-microvolts = <1800000>; + regulator-fixed-gpio = <43>; + regulator-fixed-startup-delay = <70000>; + regulator-fixed-enable-high; + regulator-fixed-enabled-at-boot; + }; diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 2fe9d99..9851b42 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -26,6 +26,9 @@ #include <linux/gpio.h> #include <linux/delay.h> #include <linux/slab.h> +#include <linux/of.h> +#include <linux/regulator/of_regulator.h> +#include <linux/regulator/machine.h> struct fixed_voltage_data { struct regulator_desc desc; @@ -37,6 +40,46 @@ struct fixed_voltage_data { bool is_enabled; }; + +/** + * of_get_fixed_voltage_config - extract fixed_voltage_config structure info + * @dev: device requesting for fixed_voltage_config + * + * 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 *dev) +{ + struct fixed_voltage_config *config; + struct device_node *np = dev->of_node; + const __be32 *microvolts, *gpio, *delay; + + config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config), GFP_KERNEL); + if (!config) + return NULL; + + config->supply_name = of_get_property(np, "regulator-fixed-supply", NULL); + microvolts = of_get_property(np, "regulator-fixed-microvolts", NULL); + if (microvolts) + config->microvolts = be32_to_cpu(*microvolts); + gpio = of_get_property(np, "regulator-fixed-gpio", NULL); + if (gpio) + config->gpio = be32_to_cpu(*gpio); + delay = of_get_property(np, "regulator-fixed-startup-delay", NULL); + if (delay) + config->startup_delay = be32_to_cpu(*delay); + + if (of_find_property(np, "regulator-fixed-enable-high", NULL)) + config->enable_high = true; + if (of_find_property(np, "regulator-fixed-enabled-at-boot", NULL)) + config->enabled_at_boot = true; + + config->init_data = of_get_regulator_init_data(dev); + + return config; +} + static int fixed_voltage_is_enabled(struct regulator_dev *dev) { struct fixed_voltage_data *data = rdev_get_drvdata(dev); @@ -108,6 +151,9 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) struct fixed_voltage_data *drvdata; int ret; + if (pdev->dev.of_node) + config = of_get_fixed_voltage_config(&pdev->dev); + drvdata = kzalloc(sizeof(struct fixed_voltage_data), GFP_KERNEL); if (drvdata == NULL) { dev_err(&pdev->dev, "Failed to allocate device data\n"); @@ -216,12 +262,23 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) return 0; } +#if defined(CONFIG_OF) +static const struct of_device_id fixed_of_match[] __devinitconst = { + { .compatible = "regulator-fixed", }, + {}, +}; +MODULE_DEVICE_TABLE(of, fixed_of_match); +#else +#define fixed_of_match NULL +#endif + static struct platform_driver regulator_fixed_voltage_driver = { .probe = reg_fixed_voltage_probe, .remove = __devexit_p(reg_fixed_voltage_remove), .driver = { .name = "reg-fixed-voltage", .owner = THIS_MODULE, + .of_match_table = fixed_of_match, }, }; -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1319702185-16108-3-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt [not found] ` <1319702185-16108-3-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> @ 2011-10-27 12:18 ` Mark Brown 0 siblings, 0 replies; 24+ messages in thread From: Mark Brown @ 2011-10-27 12:18 UTC (permalink / raw) To: Rajendra Nayak Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Thu, Oct 27, 2011 at 01:26:23PM +0530, Rajendra Nayak wrote: > The fixed regulator driver uses of_get_fixed_voltage_config() > to extract fixed_voltage_config structure contents from device tree. > > Also add documenation for additional bindings for fixed > regulators that can be passed through dt. Acked-by: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-10-27 7:56 ` [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt Rajendra Nayak [not found] ` <1319702185-16108-3-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> @ 2011-11-04 20:34 ` Olof Johansson 2011-11-04 21:01 ` Mark Brown [not found] ` <20111104203422.GB3918-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org> 1 sibling, 2 replies; 24+ messages in thread From: Olof Johansson @ 2011-11-04 20:34 UTC (permalink / raw) To: Rajendra Nayak Cc: broonie, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Thu, Oct 27, 2011 at 01:26:23PM +0530, Rajendra Nayak wrote: > The fixed regulator driver uses of_get_fixed_voltage_config() > to extract fixed_voltage_config structure contents from device tree. > > Also add documenation for additional bindings for fixed > regulators that can be passed through dt. > > Signed-off-by: Rajendra Nayak <rnayak@ti.com> Shouldn't a fixed regulator just be a subset of a fixed one? If so, should the binding be merged with that one? > --- > .../bindings/regulator/fixed-regulator.txt | 25 +++++++++ > drivers/regulator/fixed.c | 57 ++++++++++++++++++++ > 2 files changed, 82 insertions(+), 0 deletions(-) > create mode 100644 Documentation/devicetree/bindings/regulator/fixed-regulator.txt > > diff --git a/Documentation/devicetree/bindings/regulator/fixed-regulator.txt b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt > new file mode 100644 > index 0000000..049df3d > --- /dev/null > +++ b/Documentation/devicetree/bindings/regulator/fixed-regulator.txt > @@ -0,0 +1,25 @@ > +Fixed Voltage regulators > + > +Required properties: > +- compatible: Must be "regulator-fixed"; > + > +Optional properties: > +- regulator-fixed-supply: Name of the regulator supply > +- regulator-fixed-microvolts: Output voltage of regulator Other regulator binding usese uV, here it's microvolts. Pick one, microvolts has the benefit of not needing caps. :) > +- regulator-fixed-gpio: gpio to use for enable control > +- regulator-fixed-startup-delay: startup time in microseconds startup-delay-ms ? > +- regulator-fixed-enable-high: Polarity of enable GPIO, > + 1 = Active High, 0 = Active low Some gpio specifiers allow you to specify active high or low flags, but either way something like "enable-active-low" as a property (with active high as default if property is missing) is a more devicetreey convention. > +- regulator-fixed-enabled-at-boot: 1 = yes, 0 = no Same here, you can drop the prefix. Also, the regular regulators use "regulator-name" for the supply name, it would make sense to reuse the same naming here, right? > + > +Example: > + > + abc: fixedregulator@0 { > + compatible = "regulator-fixed"; > + regulator-fixed-supply = "fixed-supply"; > + regulator-fixed-microvolts = <1800000>; > + regulator-fixed-gpio = <43>; This is not a valid gpio specifier. > + regulator-fixed-startup-delay = <70000>; > + regulator-fixed-enable-high; > + regulator-fixed-enabled-at-boot; > + }; > diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c > index 2fe9d99..9851b42 100644 > --- a/drivers/regulator/fixed.c > +++ b/drivers/regulator/fixed.c > @@ -26,6 +26,9 @@ > #include <linux/gpio.h> > #include <linux/delay.h> > #include <linux/slab.h> > +#include <linux/of.h> > +#include <linux/regulator/of_regulator.h> > +#include <linux/regulator/machine.h> > > struct fixed_voltage_data { > struct regulator_desc desc; > @@ -37,6 +40,46 @@ struct fixed_voltage_data { > bool is_enabled; > }; > > + > +/** > + * of_get_fixed_voltage_config - extract fixed_voltage_config structure info > + * @dev: device requesting for fixed_voltage_config > + * > + * 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 *dev) > +{ > + struct fixed_voltage_config *config; > + struct device_node *np = dev->of_node; > + const __be32 *microvolts, *gpio, *delay; > + > + config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config), GFP_KERNEL); > + if (!config) > + return NULL; > + > + config->supply_name = of_get_property(np, "regulator-fixed-supply", NULL); > + microvolts = of_get_property(np, "regulator-fixed-microvolts", NULL); > + if (microvolts) > + config->microvolts = be32_to_cpu(*microvolts); > + gpio = of_get_property(np, "regulator-fixed-gpio", NULL); > + if (gpio) > + config->gpio = be32_to_cpu(*gpio); This needs to be fixed to parse a gpio properly instead. -Olof ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 20:34 ` Olof Johansson @ 2011-11-04 21:01 ` Mark Brown 2011-11-04 21:18 ` Olof Johansson [not found] ` <20111104203422.GB3918-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org> 1 sibling, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-11-04 21:01 UTC (permalink / raw) To: Olof Johansson Cc: Rajendra Nayak, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Fri, Nov 04, 2011 at 01:34:22PM -0700, Olof Johansson wrote: > Shouldn't a fixed regulator just be a subset of a fixed one? If so, should the > binding be merged with that one? No, the fixed voltage regultor is a superset of a general regulator - it has additional information like the voltage it supplies and the optional enable GPIO. > > +- regulator-fixed-enabled-at-boot: 1 = yes, 0 = no > Same here, you can drop the prefix. Also, the regular regulators use > "regulator-name" for the supply name, it would make sense to reuse the same > naming here, right? I'm having a hard time associating your second comment with the property being discussed - could you clarify please? ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 21:01 ` Mark Brown @ 2011-11-04 21:18 ` Olof Johansson 2011-11-04 21:25 ` Mark Brown 0 siblings, 1 reply; 24+ messages in thread From: Olof Johansson @ 2011-11-04 21:18 UTC (permalink / raw) To: Mark Brown Cc: patches, tony, devicetree-discuss, Rajendra Nayak, linux-kernel, grant.likely, linux-omap, lrg, linux-arm-kernel On Fri, Nov 04, 2011 at 09:01:52PM +0000, Mark Brown wrote: > On Fri, Nov 04, 2011 at 01:34:22PM -0700, Olof Johansson wrote: > > > Shouldn't a fixed regulator just be a subset of a fixed one? If so, should the > > binding be merged with that one? > > No, the fixed voltage regultor is a superset of a general regulator - it > has additional information like the voltage it supplies and the optional > enable GPIO. Still, seems like it could be merged into one regulator binding. > > > +- regulator-fixed-enabled-at-boot: 1 = yes, 0 = no > > > Same here, you can drop the prefix. Also, the regular regulators use > > "regulator-name" for the supply name, it would make sense to reuse the same > > naming here, right? > > I'm having a hard time associating your second comment with the property > being discussed - could you clarify please? It was the first comment I wrote on the whole block and later interspersed other comments above, so I don't blame you for not understanding. The second comment was related to the "regulator-fixed-supply" property at the top of the block. -Olof ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 21:18 ` Olof Johansson @ 2011-11-04 21:25 ` Mark Brown 2011-11-04 21:47 ` Olof Johansson 0 siblings, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-11-04 21:25 UTC (permalink / raw) To: Olof Johansson Cc: Rajendra Nayak, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Fri, Nov 04, 2011 at 02:18:24PM -0700, Olof Johansson wrote: > On Fri, Nov 04, 2011 at 09:01:52PM +0000, Mark Brown wrote: > > No, the fixed voltage regultor is a superset of a general regulator - it > > has additional information like the voltage it supplies and the optional > > enable GPIO. > Still, seems like it could be merged into one regulator binding. I don't see how you can usefully do that, the task of plumbing a regulator into a board is largely orthogonal to the specific feature set of a given regulator. The specific bindings for a fixed voltage regulator would be useful or unhelpful for most regultors controlled via I2C. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 21:25 ` Mark Brown @ 2011-11-04 21:47 ` Olof Johansson 2011-11-04 21:57 ` Mark Brown 0 siblings, 1 reply; 24+ messages in thread From: Olof Johansson @ 2011-11-04 21:47 UTC (permalink / raw) To: Mark Brown Cc: Rajendra Nayak, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Fri, Nov 4, 2011 at 2:25 PM, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Fri, Nov 04, 2011 at 02:18:24PM -0700, Olof Johansson wrote: >> On Fri, Nov 04, 2011 at 09:01:52PM +0000, Mark Brown wrote: > >> > No, the fixed voltage regultor is a superset of a general regulator - it >> > has additional information like the voltage it supplies and the optional >> > enable GPIO. > >> Still, seems like it could be merged into one regulator binding. > > I don't see how you can usefully do that, the task of plumbing a > regulator into a board is largely orthogonal to the specific feature set > of a given regulator. The specific bindings for a fixed voltage > regulator would be useful or unhelpful for most regultors controlled via > I2C. I meant more that the fixed regulators should reuse as much as possible from the generic regulator bindings, instead of completely forking them. Then, depending on how they are controlled, there will be more specific bindings. So the case of a gpio-controlled fixed regulator would have a binding where the format of the properties to find the gpio, etc, would be described. But things like voltage (without a range, obviously) would be using the same bindings as the other regulators. Does that make more sense? -Olof -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 21:47 ` Olof Johansson @ 2011-11-04 21:57 ` Mark Brown 2011-11-04 22:09 ` Olof Johansson 0 siblings, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-11-04 21:57 UTC (permalink / raw) To: Olof Johansson Cc: patches, tony, devicetree-discuss, Rajendra Nayak, linux-kernel, grant.likely, linux-omap, lrg, linux-arm-kernel On Fri, Nov 04, 2011 at 02:47:05PM -0700, Olof Johansson wrote: > On Fri, Nov 4, 2011 at 2:25 PM, Mark Brown > > I don't see how you can usefully do that, the task of plumbing a > > regulator into a board is largely orthogonal to the specific feature set > > of a given regulator. The specific bindings for a fixed voltage > > regulator would be useful or unhelpful for most regultors controlled via > > I2C. > I meant more that the fixed regulators should reuse as much as > possible from the generic regulator bindings, instead of completely > forking them. That appears to be what's going on? The fixed voltage regulator includes by reference the core regulator binding, all of the properties it defines with the possible exception of the supply name are not covered in the core binding. > Then, depending on how they are controlled, there will be more > specific bindings. So the case of a gpio-controlled fixed regulator > would have a binding where the format of the properties to find the > gpio, etc, would be described. But things like voltage (without a > range, obviously) would be using the same bindings as the other > regulators. The only overlap I'm seeing is the voltage? The intended semantic for the voltage is rather different. The core binding for the voltage specifies the range of voltages it is possible to set a regulator to on a given board and is used to give permission to the system to reconfigure the regulator. The binding here tells the system what voltage a fixed voltage regulator is running at. We could have the fixed voltage regulator read the same binding - though there's some risk of mild confusion it shouldn't be too bad. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 21:57 ` Mark Brown @ 2011-11-04 22:09 ` Olof Johansson 2011-11-04 22:23 ` Mark Brown 0 siblings, 1 reply; 24+ messages in thread From: Olof Johansson @ 2011-11-04 22:09 UTC (permalink / raw) To: Mark Brown Cc: Rajendra Nayak, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Fri, Nov 4, 2011 at 2:57 PM, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Fri, Nov 04, 2011 at 02:47:05PM -0700, Olof Johansson wrote: >> On Fri, Nov 4, 2011 at 2:25 PM, Mark Brown > >> > I don't see how you can usefully do that, the task of plumbing a >> > regulator into a board is largely orthogonal to the specific feature set >> > of a given regulator. The specific bindings for a fixed voltage >> > regulator would be useful or unhelpful for most regultors controlled via >> > I2C. > >> I meant more that the fixed regulators should reuse as much as >> possible from the generic regulator bindings, instead of completely >> forking them. > > That appears to be what's going on? The fixed voltage regulator > includes by reference the core regulator binding, all of the properties > it defines with the possible exception of the supply name are not > covered in the core binding. The fixed-regulator binding makes no reference to the generic binding, and the example includes no properties that are defined in that one. So I definitely did not make that conclusion based on what I saw. >> Then, depending on how they are controlled, there will be more >> specific bindings. So the case of a gpio-controlled fixed regulator >> would have a binding where the format of the properties to find the >> gpio, etc, would be described. But things like voltage (without a >> range, obviously) would be using the same bindings as the other >> regulators. > > The only overlap I'm seeing is the voltage? > > The intended semantic for the voltage is rather different. The core > binding for the voltage specifies the range of voltages it is possible > to set a regulator to on a given board and is used to give permission to > the system to reconfigure the regulator. The binding here tells the > system what voltage a fixed voltage regulator is running at. We could > have the fixed voltage regulator read the same binding - though there's > some risk of mild confusion it shouldn't be too bad. Yeah, voltage is the obvious one where fixed would have a max and min that is the same when you have a fixed regulator. But even things like allowing (optional) attributes such as startup-delay on non-fixed regulators could make sense. Keep in mind that the device tree should focus on describing the hardware, not just what the linux driver needs from it. So maybe instead of startup-delay, specifying ramp-up speed instead of time needed until power is good could be the way to go there. -Olof ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt 2011-11-04 22:09 ` Olof Johansson @ 2011-11-04 22:23 ` Mark Brown 0 siblings, 0 replies; 24+ messages in thread From: Mark Brown @ 2011-11-04 22:23 UTC (permalink / raw) To: Olof Johansson Cc: Rajendra Nayak, grant.likely, patches, tony, devicetree-discuss, linux-kernel, linux-omap, lrg, linux-arm-kernel On Fri, Nov 04, 2011 at 03:09:32PM -0700, Olof Johansson wrote: > But even things like allowing (optional) attributes such as > startup-delay on non-fixed regulators could make sense. Keep in mind > that the device tree should focus on describing the hardware, not just > what the linux driver needs from it. So maybe instead of > startup-delay, specifying ramp-up speed instead of time needed until > power is good could be the way to go there. This is in general something that a driver should know as a result of knowing which regulator it's dealing with - in many cases these are properties which can be varied at runtime on hardware which has register control. Replicating this into the device tree would make things more error prone. ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <20111104203422.GB3918-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org>]
* Re: [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt [not found] ` <20111104203422.GB3918-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org> @ 2011-11-07 6:27 ` Rajendra Nayak 0 siblings, 0 replies; 24+ messages in thread From: Rajendra Nayak @ 2011-11-07 6:27 UTC (permalink / raw) To: Olof Johansson Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r > >> +- regulator-fixed-gpio: gpio to use for enable control >> +- regulator-fixed-startup-delay: startup time in microseconds > > startup-delay-ms ? ok. > >> +- regulator-fixed-enable-high: Polarity of enable GPIO, >> + 1 = Active High, 0 = Active low > > Some gpio specifiers allow you to specify active high or low flags, but either > way something like "enable-active-low" as a property (with active high as > default if property is missing) is a more devicetreey convention. > >> +- regulator-fixed-enabled-at-boot: 1 = yes, 0 = no > > Same here, you can drop the prefix. Also, the regular regulators use > "regulator-name" for the supply name, it would make sense to reuse the same > naming here, right? yes, will do these changes. > >> + >> +Example: >> + >> + abc: fixedregulator@0 { >> + compatible = "regulator-fixed"; >> + regulator-fixed-supply = "fixed-supply"; >> + regulator-fixed-microvolts =<1800000>; >> + regulator-fixed-gpio =<43>; > > This is not a valid gpio specifier. right. will fix. > >> + regulator-fixed-startup-delay =<70000>; >> + regulator-fixed-enable-high; >> + regulator-fixed-enabled-at-boot; >> + }; >> diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c >> index 2fe9d99..9851b42 100644 >> --- a/drivers/regulator/fixed.c >> +++ b/drivers/regulator/fixed.c >> @@ -26,6 +26,9 @@ >> #include<linux/gpio.h> >> #include<linux/delay.h> >> #include<linux/slab.h> >> +#include<linux/of.h> >> +#include<linux/regulator/of_regulator.h> >> +#include<linux/regulator/machine.h> >> >> struct fixed_voltage_data { >> struct regulator_desc desc; >> @@ -37,6 +40,46 @@ struct fixed_voltage_data { >> bool is_enabled; >> }; >> >> + >> +/** >> + * of_get_fixed_voltage_config - extract fixed_voltage_config structure info >> + * @dev: device requesting for fixed_voltage_config >> + * >> + * 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 *dev) >> +{ >> + struct fixed_voltage_config *config; >> + struct device_node *np = dev->of_node; >> + const __be32 *microvolts, *gpio, *delay; >> + >> + config = devm_kzalloc(dev, sizeof(struct fixed_voltage_config), GFP_KERNEL); >> + if (!config) >> + return NULL; >> + >> + config->supply_name = of_get_property(np, "regulator-fixed-supply", NULL); >> + microvolts = of_get_property(np, "regulator-fixed-microvolts", NULL); >> + if (microvolts) >> + config->microvolts = be32_to_cpu(*microvolts); >> + gpio = of_get_property(np, "regulator-fixed-gpio", NULL); >> + if (gpio) >> + config->gpio = be32_to_cpu(*gpio); > > This needs to be fixed to parse a gpio properly instead. yes, will use of_get_gpio() here. > > > > -Olof ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 3/4] regulator: pass additional of_node to regulator_register() [not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> 2011-10-27 7:56 ` [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data Rajendra Nayak 2011-10-27 7:56 ` [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt Rajendra Nayak @ 2011-10-27 7:56 ` Rajendra Nayak [not found] ` <1319702185-16108-4-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> 2011-10-27 7:56 ` [PATCH v3 4/4] regulator: map consumer regulator based on device tree Rajendra Nayak 3 siblings, 1 reply; 24+ messages in thread From: Rajendra Nayak @ 2011-10-27 7:56 UTC (permalink / raw) To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: Dimitris Papastamos, Dan Carpenter, Michael Hennerich, patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ian Lartey, Takashi Iwai, Jaroslav Kysela, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Zeng Zhaoming With device tree support for regulators, its needed that the regulator_dev->dev device has the right of_node attached. To be able to do this add an additional parameter to the regulator_register() api, wherein the dt-adapted driver can then pass this additional info onto the regulator core. Signed-off-by: Rajendra Nayak <rnayak-l0cyMroinI0@public.gmane.org> Cc: Michael Hennerich <michael.hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org> Cc: Ian Lartey <ian-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> Cc: Dimitris Papastamos <dp-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> Cc: Jaroslav Kysela <perex-/Fr2/VpizcU@public.gmane.org> Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org> Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Cc: Zeng Zhaoming <b32542-KZfg59tc24xl57MIdRCFDg@public.gmane.org> Cc: Dan Carpenter <error27-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- drivers/regulator/88pm8607.c | 2 +- drivers/regulator/aat2870-regulator.c | 2 +- drivers/regulator/ab3100.c | 2 +- drivers/regulator/ab8500.c | 2 +- drivers/regulator/ad5398.c | 2 +- drivers/regulator/bq24022.c | 2 +- drivers/regulator/core.c | 3 ++- drivers/regulator/da903x.c | 2 +- drivers/regulator/db8500-prcmu.c | 2 +- drivers/regulator/dummy.c | 2 +- drivers/regulator/fixed.c | 2 +- drivers/regulator/isl6271a-regulator.c | 2 +- drivers/regulator/lp3971.c | 2 +- drivers/regulator/lp3972.c | 2 +- drivers/regulator/max1586.c | 2 +- drivers/regulator/max8649.c | 2 +- drivers/regulator/max8660.c | 2 +- drivers/regulator/max8925-regulator.c | 2 +- drivers/regulator/max8952.c | 2 +- drivers/regulator/max8997.c | 2 +- drivers/regulator/max8998.c | 2 +- drivers/regulator/mc13783-regulator.c | 2 +- drivers/regulator/mc13892-regulator.c | 2 +- drivers/regulator/pcap-regulator.c | 2 +- drivers/regulator/pcf50633-regulator.c | 2 +- drivers/regulator/tps6105x-regulator.c | 3 ++- drivers/regulator/tps65023-regulator.c | 2 +- drivers/regulator/tps6507x-regulator.c | 2 +- drivers/regulator/tps6524x-regulator.c | 2 +- drivers/regulator/tps6586x-regulator.c | 2 +- drivers/regulator/tps65910-regulator.c | 2 +- drivers/regulator/tps65912-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/wm831x-dcdc.c | 8 ++++---- drivers/regulator/wm831x-isink.c | 2 +- drivers/regulator/wm831x-ldo.c | 6 +++--- drivers/regulator/wm8350-regulator.c | 2 +- drivers/regulator/wm8400-regulator.c | 2 +- drivers/regulator/wm8994-regulator.c | 2 +- include/linux/regulator/driver.h | 2 +- sound/soc/codecs/sgtl5000.c | 2 +- 41 files changed, 48 insertions(+), 46 deletions(-) diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index d63fddb..443f2df 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c @@ -426,7 +426,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev) /* replace driver_data with info */ info->regulator = regulator_register(&info->desc, &pdev->dev, - pdata, info); + pdata, info, NULL); if (IS_ERR(info->regulator)) { dev_err(&pdev->dev, "failed to register regulator %s\n", info->desc.name); diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c index cd41045..5c49a7c 100644 --- a/drivers/regulator/aat2870-regulator.c +++ b/drivers/regulator/aat2870-regulator.c @@ -187,7 +187,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev) ri->pdev = pdev; rdev = regulator_register(&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri, NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "Failed to register regulator %s\n", ri->desc.name); diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c index 585e494..042271a 100644 --- a/drivers/regulator/ab3100.c +++ b/drivers/regulator/ab3100.c @@ -634,7 +634,7 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev) rdev = regulator_register(&ab3100_regulator_desc[i], &pdev->dev, &plfdata->reg_constraints[i], - reg); + reg, NULL); if (IS_ERR(rdev)) { err = PTR_ERR(rdev); diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 02f3c23..8b13b0e 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -821,7 +821,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) /* register regulator with framework */ info->regulator = regulator_register(&info->desc, &pdev->dev, - &pdata->regulator[i], info); + &pdata->regulator[i], info, NULL); if (IS_ERR(info->regulator)) { err = PTR_ERR(info->regulator); dev_err(&pdev->dev, "failed to register regulator %s\n", diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index a4be416..483c809 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c @@ -233,7 +233,7 @@ static int __devinit ad5398_probe(struct i2c_client *client, chip->current_mask = (chip->current_level - 1) << chip->current_offset; chip->rdev = regulator_register(&ad5398_reg, &client->dev, - init_data, chip); + init_data, chip, NULL); if (IS_ERR(chip->rdev)) { ret = PTR_ERR(chip->rdev); dev_err(&client->dev, "failed to register %s %s\n", diff --git a/drivers/regulator/bq24022.c b/drivers/regulator/bq24022.c index 068d488..dc4a8e6 100644 --- a/drivers/regulator/bq24022.c +++ b/drivers/regulator/bq24022.c @@ -106,7 +106,7 @@ static int __init bq24022_probe(struct platform_device *pdev) ret = gpio_direction_output(pdata->gpio_nce, 1); bq24022 = regulator_register(&bq24022_desc, &pdev->dev, - pdata->init_data, pdata); + pdata->init_data, pdata, NULL); if (IS_ERR(bq24022)) { dev_dbg(&pdev->dev, "couldn't register regulator\n"); ret = PTR_ERR(bq24022); diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d8e6a42..6edaaf0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2574,7 +2574,7 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) */ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, struct device *dev, const struct regulator_init_data *init_data, - void *driver_data) + void *driver_data, struct device_node *of_node) { static atomic_t regulator_no = ATOMIC_INIT(0); struct regulator_dev *rdev; @@ -2632,6 +2632,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, /* register with sysfs */ rdev->dev.class = ®ulator_class; + rdev->dev.of_node = of_node; rdev->dev.parent = dev; dev_set_name(&rdev->dev, "regulator.%d", atomic_inc_return(®ulator_no) - 1); diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index 362e082..f3064fe 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c @@ -536,7 +536,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev) ri->desc.ops = &da9030_regulator_ldo1_15_ops; rdev = regulator_register(&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri, NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register regulator %s\n", ri->desc.name); diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c index 2bb8f45..f88b13d 100644 --- a/drivers/regulator/db8500-prcmu.c +++ b/drivers/regulator/db8500-prcmu.c @@ -485,7 +485,7 @@ static int __devinit db8500_regulator_probe(struct platform_device *pdev) /* register with the regulator framework */ info->rdev = regulator_register(&info->desc, &pdev->dev, - init_data, info); + init_data, info, NULL); if (IS_ERR(info->rdev)) { err = PTR_ERR(info->rdev); dev_err(&pdev->dev, "failed to register %s: err %i\n", diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c index f6ef669..910583f 100644 --- a/drivers/regulator/dummy.c +++ b/drivers/regulator/dummy.c @@ -41,7 +41,7 @@ static int __devinit dummy_regulator_probe(struct platform_device *pdev) int ret; dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, - &dummy_initdata, NULL); + &dummy_initdata, NULL, NULL); if (IS_ERR(dummy_regulator_rdev)) { ret = PTR_ERR(dummy_regulator_rdev); pr_err("Failed to register regulator: %d\n", ret); diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 9851b42..bc78cc4 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -225,7 +225,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) } drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, - config->init_data, drvdata); + config->init_data, drvdata, NULL); if (IS_ERR(drvdata->dev)) { ret = PTR_ERR(drvdata->dev); dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index e4b3592..c1a456c 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c @@ -170,7 +170,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c, for (i = 0; i < 3; i++) { pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev, - init_data, pmic); + init_data, pmic, NULL); if (IS_ERR(pmic->rdev[i])) { dev_err(&i2c->dev, "failed to register %s\n", id->name); err = PTR_ERR(pmic->rdev[i]); diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index 0f22ef1..42b1a30 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -450,7 +450,7 @@ static int __devinit setup_regulators(struct lp3971 *lp3971, for (i = 0; i < pdata->num_regulators; i++) { struct lp3971_regulator_subdev *reg = &pdata->regulators[i]; lp3971->rdev[i] = regulator_register(®ulators[reg->id], - lp3971->dev, reg->initdata, lp3971); + lp3971->dev, reg->initdata, lp3971, NULL); if (IS_ERR(lp3971->rdev[i])) { err = PTR_ERR(lp3971->rdev[i]); diff --git a/drivers/regulator/lp3972.c b/drivers/regulator/lp3972.c index 6aa1b50..939e7f4 100644 --- a/drivers/regulator/lp3972.c +++ b/drivers/regulator/lp3972.c @@ -554,7 +554,7 @@ static int __devinit setup_regulators(struct lp3972 *lp3972, for (i = 0; i < pdata->num_regulators; i++) { struct lp3972_regulator_subdev *reg = &pdata->regulators[i]; lp3972->rdev[i] = regulator_register(®ulators[reg->id], - lp3972->dev, reg->initdata, lp3972); + lp3972->dev, reg->initdata, lp3972, NULL); if (IS_ERR(lp3972->rdev[i])) { err = PTR_ERR(lp3972->rdev[i]); diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 3f49512..40e7a4d 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c @@ -214,7 +214,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client, } rdev[i] = regulator_register(&max1586_reg[id], &client->dev, pdata->subdevs[i].platform_data, - max1586); + max1586, NULL); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); dev_err(&client->dev, "failed to register %s\n", diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 30eb9e5..14d6d28 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c @@ -347,7 +347,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, } info->regulator = regulator_register(&dcdc_desc, &client->dev, - pdata->regulator, info); + pdata->regulator, info, NULL); if (IS_ERR(info->regulator)) { dev_err(info->dev, "failed to register regulator %s\n", dcdc_desc.name); diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 33f5d9a..a838e66 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c @@ -449,7 +449,7 @@ static int __devinit max8660_probe(struct i2c_client *client, rdev[i] = regulator_register(&max8660_reg[id], &client->dev, pdata->subdevs[i].platform_data, - max8660); + max8660, NULL); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); dev_err(&client->dev, "failed to register %s\n", diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index e4dbd66..dd5fae9 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c @@ -265,7 +265,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ri->chip = chip; rdev = regulator_register(&ri->desc, &pdev->dev, - pdata->regulator[pdev->id], ri); + pdata->regulator[pdev->id], ri, NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register regulator %s\n", ri->desc.name); diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 486ed81..c4bfd4d 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -211,7 +211,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client, mutex_init(&max8952->mutex); max8952->rdev = regulator_register(®ulator, max8952->dev, - &pdata->reg_data, max8952); + &pdata->reg_data, max8952, NULL); if (IS_ERR(max8952->rdev)) { ret = PTR_ERR(max8952->rdev); diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index ad6628c..f701ca5 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c @@ -1145,7 +1145,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) regulators[id].n_voltages = 16; rdev[i] = regulator_register(®ulators[id], max8997->dev, - pdata->regulators[i].initdata, max8997); + pdata->regulators[i].initdata, max8997, NULL); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); dev_err(max8997->dev, "regulator init failed for %d\n", diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 41a1495..2d38c24 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c @@ -847,7 +847,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) regulators[index].n_voltages = count; } rdev[i] = regulator_register(®ulators[index], max8998->dev, - pdata->regulators[i].initdata, max8998); + pdata->regulators[i].initdata, max8998, NULL); if (IS_ERR(rdev[i])) { ret = PTR_ERR(rdev[i]); dev_err(max8998->dev, "regulator init failed\n"); diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index 730f43a..8d5822b 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c @@ -356,7 +356,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev) init_data = &pdata->regulators[i]; priv->regulators[i] = regulator_register( &mc13783_regulators[init_data->id].desc, - &pdev->dev, init_data->init_data, priv); + &pdev->dev, init_data->init_data, priv, NULL); if (IS_ERR(priv->regulators[i])) { dev_err(&pdev->dev, "failed to register regulator %s\n", diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 3285d41..9d82b5c 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c @@ -572,7 +572,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) init_data = &pdata->regulators[i]; priv->regulators[i] = regulator_register( &mc13892_regulators[init_data->id].desc, - &pdev->dev, init_data->init_data, priv); + &pdev->dev, init_data->init_data, priv, NULL); if (IS_ERR(priv->regulators[i])) { dev_err(&pdev->dev, "failed to register regulator %s\n", diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c index 31f6e11..a5aab1b 100644 --- a/drivers/regulator/pcap-regulator.c +++ b/drivers/regulator/pcap-regulator.c @@ -277,7 +277,7 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev) void *pcap = dev_get_drvdata(pdev->dev.parent); rdev = regulator_register(&pcap_regulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, pcap); + pdev->dev.platform_data, pcap, NULL); if (IS_ERR(rdev)) return PTR_ERR(rdev); diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 69a11d9..1d1c310 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c @@ -320,7 +320,7 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) pcf = dev_to_pcf50633(pdev->dev.parent); rdev = regulator_register(®ulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, pcf); + pdev->dev.platform_data, pcf, NULL); if (IS_ERR(rdev)) return PTR_ERR(rdev); diff --git a/drivers/regulator/tps6105x-regulator.c b/drivers/regulator/tps6105x-regulator.c index 1011873..d9278da 100644 --- a/drivers/regulator/tps6105x-regulator.c +++ b/drivers/regulator/tps6105x-regulator.c @@ -151,7 +151,8 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev) /* Register regulator with framework */ tps6105x->regulator = regulator_register(&tps6105x_regulator_desc, &tps6105x->client->dev, - pdata->regulator_data, tps6105x); + pdata->regulator_data, tps6105x, + NULL); if (IS_ERR(tps6105x->regulator)) { ret = PTR_ERR(tps6105x->regulator); dev_err(&tps6105x->client->dev, diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index 701a590..a7a1910 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c @@ -461,7 +461,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client, /* Register the regulators */ rdev = regulator_register(&tps->desc[i], &client->dev, - init_data, tps); + init_data, tps, NULL); if (IS_ERR(rdev)) { dev_err(&client->dev, "failed to register %s\n", id->name); diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c index bfffabc..0f86e56 100644 --- a/drivers/regulator/tps6507x-regulator.c +++ b/drivers/regulator/tps6507x-regulator.c @@ -605,7 +605,7 @@ int tps6507x_pmic_probe(struct platform_device *pdev) tps->desc[i].owner = THIS_MODULE; rdev = regulator_register(&tps->desc[i], - tps6507x_dev->dev, init_data, tps); + tps6507x_dev->dev, init_data, tps, NULL); if (IS_ERR(rdev)) { dev_err(tps6507x_dev->dev, "failed to register %s regulator\n", diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index 9166aa0..70b7b1f 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c @@ -651,7 +651,7 @@ static int __devinit pmic_probe(struct spi_device *spi) hw->desc[i].n_voltages = 1; hw->rdev[i] = regulator_register(&hw->desc[i], dev, - init_data, hw); + init_data, hw, NULL); if (IS_ERR(hw->rdev[i])) { ret = PTR_ERR(hw->rdev[i]); hw->rdev[i] = NULL; diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index bb04a75..6a35c3a 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c @@ -365,7 +365,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev) return err; rdev = regulator_register(&ri->desc, &pdev->dev, - pdev->dev.platform_data, ri); + pdev->dev.platform_data, ri, NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register regulator %s\n", ri->desc.name); diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 66d2d60..eaea9b4 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c @@ -963,7 +963,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev) pmic->desc[i].owner = THIS_MODULE; rdev = regulator_register(&pmic->desc[i], - tps65910->dev, reg_data, pmic); + tps65910->dev, reg_data, pmic, NULL); if (IS_ERR(rdev)) { dev_err(tps65910->dev, "failed to register %s regulator\n", diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c index 3a9313e..0318f4b 100644 --- a/drivers/regulator/tps65912-regulator.c +++ b/drivers/regulator/tps65912-regulator.c @@ -729,7 +729,7 @@ static __devinit int tps65912_probe(struct platform_device *pdev) pmic->desc[i].owner = THIS_MODULE; range = tps65912_get_range(pmic, i); rdev = regulator_register(&pmic->desc[i], - tps65912->dev, reg_data, pmic); + tps65912->dev, reg_data, pmic, NULL); if (IS_ERR(rdev)) { dev_err(tps65912->dev, "failed to register %s regulator\n", diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index ee8747f..9a2e07a 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -1070,7 +1070,7 @@ static int __devinit twlreg_probe(struct platform_device *pdev) break; } - rdev = regulator_register(&info->desc, &pdev->dev, initdata, info); + rdev = regulator_register(&info->desc, &pdev->dev, initdata, info, NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "can't register %s, %ld\n", info->desc.name, PTR_ERR(rdev)); diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index bd3531d..7558a96 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -553,7 +553,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc, NULL); if (IS_ERR(dcdc->regulator)) { ret = PTR_ERR(dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", @@ -747,7 +747,7 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) dcdc->desc.owner = THIS_MODULE; dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc, NULL); if (IS_ERR(dcdc->regulator)) { ret = PTR_ERR(dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", @@ -874,7 +874,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) dcdc->desc.owner = THIS_MODULE; dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, - pdata->dcdc[id], dcdc); + pdata->dcdc[id], dcdc, NULL); if (IS_ERR(dcdc->regulator)) { ret = PTR_ERR(dcdc->regulator); dev_err(wm831x->dev, "Failed to register DCDC%d: %d\n", @@ -973,7 +973,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev) dcdc->desc.owner = THIS_MODULE; dcdc->regulator = regulator_register(&dcdc->desc, &pdev->dev, - pdata->epe[id], dcdc); + pdata->epe[id], dcdc, NULL); if (IS_ERR(dcdc->regulator)) { ret = PTR_ERR(dcdc->regulator); dev_err(wm831x->dev, "Failed to register EPE%d: %d\n", diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index 01f27c7..d3ad3f5 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c @@ -189,7 +189,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev) isink->desc.owner = THIS_MODULE; isink->regulator = regulator_register(&isink->desc, &pdev->dev, - pdata->isink[id], isink); + pdata->isink[id], isink, NULL); if (IS_ERR(isink->regulator)) { ret = PTR_ERR(isink->regulator); dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n", diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 6709710..5e96a23 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -351,7 +351,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) ldo->desc.owner = THIS_MODULE; ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo, NULL); if (IS_ERR(ldo->regulator)) { ret = PTR_ERR(ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", @@ -621,7 +621,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) ldo->desc.owner = THIS_MODULE; ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo, NULL); if (IS_ERR(ldo->regulator)) { ret = PTR_ERR(ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", @@ -818,7 +818,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev) ldo->desc.owner = THIS_MODULE; ldo->regulator = regulator_register(&ldo->desc, &pdev->dev, - pdata->ldo[id], ldo); + pdata->ldo[id], ldo, NULL); if (IS_ERR(ldo->regulator)) { ret = PTR_ERR(ldo->regulator); dev_err(wm831x->dev, "Failed to register LDO%d: %d\n", diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 1bcb22c..6894009 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c @@ -1428,7 +1428,7 @@ static int wm8350_regulator_probe(struct platform_device *pdev) /* register regulator */ rdev = regulator_register(&wm8350_reg[pdev->id], &pdev->dev, pdev->dev.platform_data, - dev_get_drvdata(&pdev->dev)); + dev_get_drvdata(&pdev->dev), NULL); if (IS_ERR(rdev)) { dev_err(&pdev->dev, "failed to register %s\n", wm8350_reg[pdev->id].name); diff --git a/drivers/regulator/wm8400-regulator.c b/drivers/regulator/wm8400-regulator.c index 0f12c70..f468f8a 100644 --- a/drivers/regulator/wm8400-regulator.c +++ b/drivers/regulator/wm8400-regulator.c @@ -325,7 +325,7 @@ static int __devinit wm8400_regulator_probe(struct platform_device *pdev) struct regulator_dev *rdev; rdev = regulator_register(®ulators[pdev->id], &pdev->dev, - pdev->dev.platform_data, wm8400); + pdev->dev.platform_data, wm8400, NULL); if (IS_ERR(rdev)) return PTR_ERR(rdev); diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 1a6a690..8ee546f 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -256,7 +256,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev) ldo->is_enabled = true; ldo->regulator = regulator_register(&wm8994_ldo_desc[id], &pdev->dev, - pdata->ldo[id].init_data, ldo); + pdata->ldo[id].init_data, ldo, NULL); if (IS_ERR(ldo->regulator)) { ret = PTR_ERR(ldo->regulator); dev_err(wm8994->dev, "Failed to register LDO%d: %d\n", diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 1a80bc7..461eb90 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -208,7 +208,7 @@ struct regulator_dev { struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, struct device *dev, const struct regulator_init_data *init_data, - void *driver_data); + void *driver_data, struct device_node *of_node); void regulator_unregister(struct regulator_dev *rdev); int regulator_notifier_call_chain(struct regulator_dev *rdev, diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 7e4066e..62fd409 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -832,7 +832,7 @@ static int ldo_regulator_register(struct snd_soc_codec *codec, ldo->voltage = voltage; ldo->dev = regulator_register(&ldo->desc, codec->dev, - init_data, ldo); + init_data, ldo, NULL); if (IS_ERR(ldo->dev)) { int ret = PTR_ERR(ldo->dev); -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
[parent not found: <1319702185-16108-4-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH v3 3/4] regulator: pass additional of_node to regulator_register() [not found] ` <1319702185-16108-4-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> @ 2011-10-27 12:20 ` Mark Brown 0 siblings, 0 replies; 24+ messages in thread From: Mark Brown @ 2011-10-27 12:20 UTC (permalink / raw) To: Rajendra Nayak Cc: Dimitris Papastamos, Dan Carpenter, Michael Hennerich, patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ian Lartey, Takashi Iwai, Jaroslav Kysela, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Zeng Zhaoming On Thu, Oct 27, 2011 at 01:26:24PM +0530, Rajendra Nayak wrote: > With device tree support for regulators, its needed that the > regulator_dev->dev device has the right of_node attached. > To be able to do this add an additional parameter to the > regulator_register() api, wherein the dt-adapted driver can > then pass this additional info onto the regulator core. Acked-by: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH v3 4/4] regulator: map consumer regulator based on device tree [not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> ` (2 preceding siblings ...) 2011-10-27 7:56 ` [PATCH v3 3/4] regulator: pass additional of_node to regulator_register() Rajendra Nayak @ 2011-10-27 7:56 ` Rajendra Nayak 2011-10-27 12:20 ` Mark Brown 3 siblings, 1 reply; 24+ messages in thread From: Rajendra Nayak @ 2011-10-27 7:56 UTC (permalink / raw) To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Device nodes in DT can associate themselves with one or more regulators/supply by providing a list of phandles (to regulator nodes) and corresponding supply names. For Example: devicenode: node@0x0 { ... ... vmmc-supply = <®ulator1>; vpll-supply = <®ulator2>; }; The driver would then do a regulator_get(dev, "vmmc"); to get regulator1 and do a regulator_get(dev, "vpll"); to get regulator2. of_get_regulator() extracts the regulator node for a given device, based on the supply name. Use it to look up the regulator for a given consumer from device tree, during a regulator_get(). If not found fallback and lookup through the regulator_map_list instead. Also, since the regulator dt nodes can use the same binding to associate with a parent regulator/supply, allow the drivers to specify a supply_name, which can then be used to lookup dt to find the parent phandle. Signed-off-by: Rajendra Nayak <rnayak-l0cyMroinI0@public.gmane.org> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> --- drivers/regulator/core.c | 79 ++++++++++++++++++++++++++++++++------ include/linux/regulator/driver.h | 2 + 2 files changed, 69 insertions(+), 12 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 6edaaf0..36fc0b0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -25,9 +25,11 @@ #include <linux/mutex.h> #include <linux/suspend.h> #include <linux/delay.h> +#include <linux/of.h> #include <linux/regulator/consumer.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> #define CREATE_TRACE_POINTS #include <trace/events/regulator.h> @@ -131,6 +133,33 @@ static struct regulator *get_device_regulator(struct device *dev) return NULL; } +/** + * of_get_regulator - get a regulator device node based on supply name + * @dev: Device pointer for the consumer (of regulator) device + * @supply: regulator supply name + * + * Extract the regulator device node corresponding to the supply name. + * retruns the device node corresponding to the regulator if found, else + * returns NULL. + */ +static struct device_node *of_get_regulator(struct device *dev, const char *supply) +{ + struct device_node *regnode = NULL; + char prop_name[32]; /* 32 is max size of property name */ + + dev_dbg(dev, "Looking up %s-supply from device tree\n", supply); + + snprintf(prop_name, 32, "%s-supply", supply); + regnode = of_parse_phandle(dev->of_node, prop_name, 0); + + if (!regnode) { + dev_warn(dev, "%s property in node %s references invalid phandle", + prop_name, dev->of_node->full_name); + return NULL; + } + return regnode; +} + /* Platform voltage constraint check */ static int regulator_check_voltage(struct regulator_dev *rdev, int *min_uV, int *max_uV) @@ -1147,6 +1176,30 @@ static int _regulator_get_enable_time(struct regulator_dev *rdev) return rdev->desc->ops->enable_time(rdev); } +static struct regulator_dev *regulator_dev_lookup(struct device *dev, + const char *supply) +{ + struct regulator_dev *r; + struct device_node *node; + + /* first do a dt based lookup */ + if (dev && dev->of_node) { + node = of_get_regulator(dev, supply); + if (node) + list_for_each_entry(r, ®ulator_list, list) + if (r->dev.parent && + node == r->dev.of_node) + return r; + } + + /* if not found, try doing it non-dt way */ + list_for_each_entry(r, ®ulator_list, list) + if (strcmp(rdev_get_name(r), supply) == 0) + return r; + + return NULL; +} + /* Internal regulator request function */ static struct regulator *_regulator_get(struct device *dev, const char *id, int exclusive) @@ -1167,6 +1220,10 @@ static struct regulator *_regulator_get(struct device *dev, const char *id, mutex_lock(®ulator_list_mutex); + rdev = regulator_dev_lookup(dev, id); + if (rdev) + goto found; + list_for_each_entry(map, ®ulator_map_list, list) { /* If the mapping has a device set up it must match */ if (map->dev_name && @@ -2579,6 +2636,7 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, static atomic_t regulator_no = ATOMIC_INIT(0); struct regulator_dev *rdev; int ret, i; + const char *supply; if (regulator_desc == NULL) return ERR_PTR(-EINVAL); @@ -2654,21 +2712,18 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc, if (ret < 0) goto scrub; - if (init_data->supply_regulator) { + if (init_data->supply_regulator) + supply = init_data->supply_regulator; + else if (regulator_desc->supply_name) + supply = regulator_desc->supply_name; + + if (supply) { struct regulator_dev *r; - int found = 0; - list_for_each_entry(r, ®ulator_list, list) { - if (strcmp(rdev_get_name(r), - init_data->supply_regulator) == 0) { - found = 1; - break; - } - } + r = regulator_dev_lookup(dev, supply); - if (!found) { - dev_err(dev, "Failed to find supply %s\n", - init_data->supply_regulator); + if (!r) { + dev_err(dev, "Failed to find supply %s\n", supply); ret = -ENODEV; goto scrub; } diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 461eb90..87a121c 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -153,6 +153,7 @@ enum regulator_type { * this type. * * @name: Identifying name for the regulator. + * @supply_name: Identifying the regulator supply * @id: Numerical identifier for the regulator. * @n_voltages: Number of selectors available for ops.list_voltage(). * @ops: Regulator operations table. @@ -162,6 +163,7 @@ enum regulator_type { */ struct regulator_desc { const char *name; + const char *supply_name; int id; unsigned n_voltages; struct regulator_ops *ops; -- 1.7.1 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH v3 4/4] regulator: map consumer regulator based on device tree 2011-10-27 7:56 ` [PATCH v3 4/4] regulator: map consumer regulator based on device tree Rajendra Nayak @ 2011-10-27 12:20 ` Mark Brown 0 siblings, 0 replies; 24+ messages in thread From: Mark Brown @ 2011-10-27 12:20 UTC (permalink / raw) To: Rajendra Nayak Cc: b-cousson, patches, tony, devicetree-discuss, linux-kernel, grant.likely, shawn.guo, linux-omap, lrg, linux-arm-kernel On Thu, Oct 27, 2011 at 01:26:25PM +0530, Rajendra Nayak wrote: > Device nodes in DT can associate themselves with one or more > regulators/supply by providing a list of phandles (to regulator nodes) > and corresponding supply names. Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 0/4] Device tree support for regulators 2011-10-27 7:56 [PATCH v3 0/4] Device tree support for regulators Rajendra Nayak [not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org> @ 2011-10-27 9:08 ` Mark Brown 2011-11-04 20:21 ` Olof Johansson 1 sibling, 1 reply; 24+ messages in thread From: Mark Brown @ 2011-10-27 9:08 UTC (permalink / raw) To: Rajendra Nayak Cc: b-cousson, patches, tony, devicetree-discuss, linux-kernel, grant.likely, shawn.guo, linux-omap, lrg, linux-arm-kernel On Thu, Oct 27, 2011 at 01:26:21PM +0530, Rajendra Nayak wrote: > v3 is based on the latest devicetree/next and is tested > (with twl adaptaions, which will be posted seperately) > on the OMAP4 panda and OMAP4 sdp boards. Looking at the device bindings I notice that these bindings loose the ability to assign a descriptive name to regulator outputs. This is really useful for making it easy to tie the code and the schematics together - you can make the runing system use the same name as the schematic. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH v3 0/4] Device tree support for regulators 2011-10-27 9:08 ` [PATCH v3 0/4] Device tree support for regulators Mark Brown @ 2011-11-04 20:21 ` Olof Johansson [not found] ` <CAOesGMii8v3DOCjWpuF3=+EVu+-HYGys=7RRgpk+9U=FxTHwOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 24+ messages in thread From: Olof Johansson @ 2011-11-04 20:21 UTC (permalink / raw) To: Mark Brown Cc: patches, tony, devicetree-discuss, Rajendra Nayak, linux-kernel, linux-omap, lrg, linux-arm-kernel On Thu, Oct 27, 2011 at 2:08 AM, Mark Brown <broonie@opensource.wolfsonmicro.com> wrote: > On Thu, Oct 27, 2011 at 01:26:21PM +0530, Rajendra Nayak wrote: > >> v3 is based on the latest devicetree/next and is tested >> (with twl adaptaions, which will be posted seperately) >> on the OMAP4 panda and OMAP4 sdp boards. > > Looking at the device bindings I notice that these bindings loose the > ability to assign a descriptive name to regulator outputs. This is > really useful for making it easy to tie the code and the schematics > together - you can make the runing system use the same name as the > schematic. That can easily be added by having a output-name property in the regulator device node. -Olof ^ permalink raw reply [flat|nested] 24+ messages in thread
[parent not found: <CAOesGMii8v3DOCjWpuF3=+EVu+-HYGys=7RRgpk+9U=FxTHwOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH v3 0/4] Device tree support for regulators [not found] ` <CAOesGMii8v3DOCjWpuF3=+EVu+-HYGys=7RRgpk+9U=FxTHwOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-11-04 21:02 ` Mark Brown 0 siblings, 0 replies; 24+ messages in thread From: Mark Brown @ 2011-11-04 21:02 UTC (permalink / raw) To: Olof Johansson Cc: patches-QSEj5FYQhm4dnm+yROfE0A, tony-4v6yS6AI5VpBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, lrg-l0cyMroinI0, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On Fri, Nov 04, 2011 at 01:21:26PM -0700, Olof Johansson wrote: > On Thu, Oct 27, 2011 at 2:08 AM, Mark Brown > > Looking at the device bindings I notice that these bindings loose the > > ability to assign a descriptive name to regulator outputs. This is > > really useful for making it easy to tie the code and the schematics > > together - you can make the runing system use the same name as the > > schematic. > That can easily be added by having a output-name property in the > regulator device node. Which is pretty much what Rajendra's updated version in response to my above comment did FWIW. ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2011-11-07 6:27 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-27 7:56 [PATCH v3 0/4] Device tree support for regulators Rajendra Nayak
[not found] ` <1319702185-16108-1-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>
2011-10-27 7:56 ` [PATCH v3 1/4] regulator: helper routine to extract regulator_init_data Rajendra Nayak
2011-10-27 8:09 ` Mark Brown
2011-10-27 10:43 ` Nayak, Rajendra
2011-10-27 11:49 ` Mark Brown
2011-10-27 13:27 ` Rajendra Nayak
2011-10-27 7:56 ` [PATCH v3 2/4] regulator: adapt fixed regulator driver to dt Rajendra Nayak
[not found] ` <1319702185-16108-3-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>
2011-10-27 12:18 ` Mark Brown
2011-11-04 20:34 ` Olof Johansson
2011-11-04 21:01 ` Mark Brown
2011-11-04 21:18 ` Olof Johansson
2011-11-04 21:25 ` Mark Brown
2011-11-04 21:47 ` Olof Johansson
2011-11-04 21:57 ` Mark Brown
2011-11-04 22:09 ` Olof Johansson
2011-11-04 22:23 ` Mark Brown
[not found] ` <20111104203422.GB3918-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org>
2011-11-07 6:27 ` Rajendra Nayak
2011-10-27 7:56 ` [PATCH v3 3/4] regulator: pass additional of_node to regulator_register() Rajendra Nayak
[not found] ` <1319702185-16108-4-git-send-email-rnayak-l0cyMroinI0@public.gmane.org>
2011-10-27 12:20 ` Mark Brown
2011-10-27 7:56 ` [PATCH v3 4/4] regulator: map consumer regulator based on device tree Rajendra Nayak
2011-10-27 12:20 ` Mark Brown
2011-10-27 9:08 ` [PATCH v3 0/4] Device tree support for regulators Mark Brown
2011-11-04 20:21 ` Olof Johansson
[not found] ` <CAOesGMii8v3DOCjWpuF3=+EVu+-HYGys=7RRgpk+9U=FxTHwOA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-11-04 21:02 ` Mark Brown
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).