* [PATCH] regulator: Add option for machine drivers to enable the dummy regulator
@ 2010-10-06 2:18 Mark Brown
2010-10-06 4:09 ` Marek Vasut
2010-10-10 10:14 ` Liam Girdwood
0 siblings, 2 replies; 4+ messages in thread
From: Mark Brown @ 2010-10-06 2:18 UTC (permalink / raw)
To: Liam Girdwood
Cc: linux-kernel, Marek Vasut, Igor Grinberg, Dmitry Torokhov,
Alan Cox, Linus Walleij, Mark Brown
Allow machine drivers to explicitly enable the use of the dummy regulator,
enabling simpler support for systems with only a few specific supplies
visible to software.
It is strongly recommended that this is not used on systems with
substantial software control over their PMICs, for maximum functionality
constrints should be as fully specified as possible.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/regulator/Makefile | 3 +--
drivers/regulator/core.c | 22 ++++++++++++++++++++++
include/linux/regulator/machine.h | 5 +++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index 8285fd8..f58bfdb 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -3,14 +3,13 @@
#
-obj-$(CONFIG_REGULATOR) += core.o
+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_REGULATOR_AD5398) += ad5398.o
obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
-obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 422a709..bf82d01 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -33,6 +33,7 @@ static DEFINE_MUTEX(regulator_list_mutex);
static LIST_HEAD(regulator_list);
static LIST_HEAD(regulator_map_list);
static int has_full_constraints;
+static bool board_wants_dummy_regulator;
/*
* struct regulator_map
@@ -1108,6 +1109,11 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
}
}
+ if (board_wants_dummy_regulator) {
+ rdev = dummy_regulator_rdev;
+ goto found;
+ }
+
#ifdef CONFIG_REGULATOR_DUMMY
if (!devname)
devname = "deviceless";
@@ -2461,6 +2467,22 @@ void regulator_has_full_constraints(void)
EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
/**
+ * regulator_use_dummy_regulator - Provide a dummy regulator when none is found
+ *
+ * Calling this function will cause the regulator API to provide a
+ * dummy regulator to consumers if no physical regulator is found,
+ * allowing most consumers to proceed as though a regulator were
+ * configured. This allows systems such as those with software
+ * controllable regulators for the CPU core only to be brought up more
+ * readily.
+ */
+void regulator_use_dummy_regulator(void)
+{
+ board_wants_dummy_regulator = true;
+}
+EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
+
+/**
* rdev_get_drvdata - get rdev regulator driver data
* @rdev: regulator
*
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index e298028..761c745 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -189,10 +189,15 @@ int regulator_suspend_prepare(suspend_state_t state);
#ifdef CONFIG_REGULATOR
void regulator_has_full_constraints(void);
+void regulator_use_dummy_regulator(void);
#else
static inline void regulator_has_full_constraints(void)
{
}
+
+static inline void regulator_use_dummy_regulator(void)
+{
+}
#endif
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] regulator: Add option for machine drivers to enable the dummy regulator
2010-10-06 2:18 [PATCH] regulator: Add option for machine drivers to enable the dummy regulator Mark Brown
@ 2010-10-06 4:09 ` Marek Vasut
2010-10-06 5:08 ` Mark Brown
2010-10-10 10:14 ` Liam Girdwood
1 sibling, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2010-10-06 4:09 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, linux-kernel, Igor Grinberg, Dmitry Torokhov,
Alan Cox, Linus Walleij
Dne St 6. října 2010 04:18:32 Mark Brown napsal(a):
> Allow machine drivers to explicitly enable the use of the dummy regulator,
> enabling simpler support for systems with only a few specific supplies
> visible to software.
>
> It is strongly recommended that this is not used on systems with
> substantial software control over their PMICs, for maximum functionality
> constrints should be as fully specified as possible.
This still solves nothing ... This leaves boards broken and the granularity is
too big. Consider there are boards that use regulator for MMC, but not for
ADS7846 for example.
Cheers
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/regulator/Makefile | 3 +--
> drivers/regulator/core.c | 22 ++++++++++++++++++++++
> include/linux/regulator/machine.h | 5 +++++
> 3 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
> index 8285fd8..f58bfdb 100644
> --- a/drivers/regulator/Makefile
> +++ b/drivers/regulator/Makefile
> @@ -3,14 +3,13 @@
> #
>
>
> -obj-$(CONFIG_REGULATOR) += core.o
> +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_REGULATOR_AD5398) += ad5398.o
> obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o
> -obj-$(CONFIG_REGULATOR_DUMMY) += dummy.o
> obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o
> obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o
> obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
> diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
> index 422a709..bf82d01 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -33,6 +33,7 @@ static DEFINE_MUTEX(regulator_list_mutex);
> static LIST_HEAD(regulator_list);
> static LIST_HEAD(regulator_map_list);
> static int has_full_constraints;
> +static bool board_wants_dummy_regulator;
>
> /*
> * struct regulator_map
> @@ -1108,6 +1109,11 @@ static struct regulator *_regulator_get(struct
> device *dev, const char *id, }
> }
>
> + if (board_wants_dummy_regulator) {
> + rdev = dummy_regulator_rdev;
> + goto found;
> + }
> +
> #ifdef CONFIG_REGULATOR_DUMMY
> if (!devname)
> devname = "deviceless";
> @@ -2461,6 +2467,22 @@ void regulator_has_full_constraints(void)
> EXPORT_SYMBOL_GPL(regulator_has_full_constraints);
>
> /**
> + * regulator_use_dummy_regulator - Provide a dummy regulator when none is
> found + *
> + * Calling this function will cause the regulator API to provide a
> + * dummy regulator to consumers if no physical regulator is found,
> + * allowing most consumers to proceed as though a regulator were
> + * configured. This allows systems such as those with software
> + * controllable regulators for the CPU core only to be brought up more
> + * readily.
> + */
> +void regulator_use_dummy_regulator(void)
> +{
> + board_wants_dummy_regulator = true;
> +}
> +EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator);
> +
> +/**
> * rdev_get_drvdata - get rdev regulator driver data
> * @rdev: regulator
> *
> diff --git a/include/linux/regulator/machine.h
> b/include/linux/regulator/machine.h index e298028..761c745 100644
> --- a/include/linux/regulator/machine.h
> +++ b/include/linux/regulator/machine.h
> @@ -189,10 +189,15 @@ int regulator_suspend_prepare(suspend_state_t state);
>
> #ifdef CONFIG_REGULATOR
> void regulator_has_full_constraints(void);
> +void regulator_use_dummy_regulator(void);
> #else
> static inline void regulator_has_full_constraints(void)
> {
> }
> +
> +static inline void regulator_use_dummy_regulator(void)
> +{
> +}
> #endif
>
> #endif
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] regulator: Add option for machine drivers to enable the dummy regulator
2010-10-06 4:09 ` Marek Vasut
@ 2010-10-06 5:08 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2010-10-06 5:08 UTC (permalink / raw)
To: Marek Vasut
Cc: Liam Girdwood, linux-kernel, Igor Grinberg, Dmitry Torokhov,
Alan Cox, Linus Walleij
On Wed, Oct 06, 2010 at 06:09:17AM +0200, Marek Vasut wrote:
> This still solves nothing ... This leaves boards broken and the granularity is
We've already got a compatibility option which allows this to be enabled
with a config change, and the actual code update required has been
reduced to a single line. This does not seem terribly onerous.
> too big. Consider there are boards that use regulator for MMC, but not for
> ADS7846 for example.
You can't have it both ways. Either drivers just ignore missing
regulators and just run as though everything is fine (which is what
you've been requesting enthusiastically) or they trust that they can get
accurate information about what is and isn't mapped. All this is doing
is providing a way to enable the former behaviour in the core.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] regulator: Add option for machine drivers to enable the dummy regulator
2010-10-06 2:18 [PATCH] regulator: Add option for machine drivers to enable the dummy regulator Mark Brown
2010-10-06 4:09 ` Marek Vasut
@ 2010-10-10 10:14 ` Liam Girdwood
1 sibling, 0 replies; 4+ messages in thread
From: Liam Girdwood @ 2010-10-10 10:14 UTC (permalink / raw)
To: Mark Brown
Cc: linux-kernel, Marek Vasut, Igor Grinberg, Dmitry Torokhov,
Alan Cox, Linus Walleij
On Tue, 2010-10-05 at 19:18 -0700, Mark Brown wrote:
> Allow machine drivers to explicitly enable the use of the dummy regulator,
> enabling simpler support for systems with only a few specific supplies
> visible to software.
>
> It is strongly recommended that this is not used on systems with
> substantial software control over their PMICs, for maximum functionality
> constrints should be as fully specified as possible.
>
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Applied.
Thanks
Liam
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-10 10:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 2:18 [PATCH] regulator: Add option for machine drivers to enable the dummy regulator Mark Brown
2010-10-06 4:09 ` Marek Vasut
2010-10-06 5:08 ` Mark Brown
2010-10-10 10:14 ` Liam Girdwood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox