* [PATCH 1/2] regulator: add regulator_is_dummy function
@ 2013-01-07 5:38 Kevin Liu
2013-01-07 5:38 ` [PATCH 2/2] mmc: sdhci: fix dummy regulator issue Kevin Liu
2013-01-07 11:25 ` [PATCH 1/2] regulator: add regulator_is_dummy function Mark Brown
0 siblings, 2 replies; 7+ messages in thread
From: Kevin Liu @ 2013-01-07 5:38 UTC (permalink / raw)
To: linux-pm, Mark Brown, linux-mmc, Chris Ball
Cc: Marek Szyprowski, Rainer Kaluscha, Rainer Kaluscha, Philip Rakity,
Zhangfei Gao, Haojian Zhuang, Chao Xie, Kevin Liu, Kevin Liu
Introduce a regulator_is_dummy function to check whether the
regulator is dummy.
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
drivers/regulator/core.c | 17 +++++++++++++++++
include/linux/regulator/consumer.h | 6 ++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e872c8b..d2a8bdb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1826,6 +1826,23 @@ int regulator_disable_regmap(struct regulator_dev *rdev)
}
EXPORT_SYMBOL_GPL(regulator_disable_regmap);
+/**
+ * regulator_is_dummy - check if regulator is dummy
+ * @regulator: regulator source
+ *
+ * Returns positive if the regulator is dummy, zero if it's not.
+ */
+int regulator_is_dummy(struct regulator *regulator)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+
+ if (!strcmp(rdev_get_name(rdev), "regulator-dummy"))
+ return 1;
+ else
+ return 0;
+}
+EXPORT_SYMBOL_GPL(regulator_is_dummy);
+
static int _regulator_is_enabled(struct regulator_dev *rdev)
{
/* A GPIO control always takes precedence */
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index c43cd35..fe549d0 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -164,6 +164,7 @@ int regulator_count_voltages(struct regulator *regulator);
int regulator_list_voltage(struct regulator *regulator, unsigned selector);
int regulator_is_supported_voltage(struct regulator *regulator,
int min_uV, int max_uV);
+int regulator_is_dummy(struct regulator *regulator);
int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
int regulator_set_voltage_time(struct regulator *regulator,
int old_uV, int new_uV);
@@ -249,6 +250,11 @@ static inline int regulator_is_enabled(struct regulator *regulator)
return 1;
}
+static inline int regulator_is_dummy(struct regulator *regulator)
+{
+ return 0;
+}
+
static inline int regulator_bulk_get(struct device *dev,
int num_consumers,
struct regulator_bulk_data *consumers)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] mmc: sdhci: fix dummy regulator issue
2013-01-07 5:38 [PATCH 1/2] regulator: add regulator_is_dummy function Kevin Liu
@ 2013-01-07 5:38 ` Kevin Liu
2013-01-07 11:25 ` [PATCH 1/2] regulator: add regulator_is_dummy function Mark Brown
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Liu @ 2013-01-07 5:38 UTC (permalink / raw)
To: linux-pm, Mark Brown, linux-mmc, Chris Ball
Cc: Marek Szyprowski, Rainer Kaluscha, Rainer Kaluscha, Philip Rakity,
Zhangfei Gao, Haojian Zhuang, Chao Xie, Kevin Liu, Kevin Liu
Should consider the case that dummy regulator is used for host->vmmc
and host->vqmmc and skip the regulator voltage check.
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
drivers/mmc/host/sdhci.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c13415c..561d126 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2897,8 +2897,8 @@ int sdhci_add_host(struct sdhci_host *host)
}
} else {
regulator_enable(host->vqmmc);
- if (!regulator_is_supported_voltage(host->vqmmc, 1700000,
- 1950000))
+ if ((regulator_is_supported_voltage(host->vqmmc, 1700000,
+ 1950000) <= 0) && !regulator_is_dummy(host->vqmmc))
caps[1] &= ~(SDHCI_SUPPORT_SDR104 |
SDHCI_SUPPORT_SDR50 |
SDHCI_SUPPORT_DDR50);
@@ -2965,7 +2965,7 @@ int sdhci_add_host(struct sdhci_host *host)
}
#ifdef CONFIG_REGULATOR
- if (host->vmmc) {
+ if (host->vmmc && !regulator_is_dummy(host->vmmc)) {
ret = regulator_is_supported_voltage(host->vmmc, 2700000,
3600000);
if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] regulator: add regulator_is_dummy function
2013-01-07 5:38 [PATCH 1/2] regulator: add regulator_is_dummy function Kevin Liu
2013-01-07 5:38 ` [PATCH 2/2] mmc: sdhci: fix dummy regulator issue Kevin Liu
@ 2013-01-07 11:25 ` Mark Brown
2013-01-07 11:36 ` Kevin Liu
2013-01-07 12:30 ` Dr. Rainer Kaluscha
1 sibling, 2 replies; 7+ messages in thread
From: Mark Brown @ 2013-01-07 11:25 UTC (permalink / raw)
To: Kevin Liu
Cc: linux-pm, linux-mmc, Chris Ball, Marek Szyprowski,
Rainer Kaluscha, Rainer Kaluscha, Philip Rakity, Zhangfei Gao,
Haojian Zhuang, Chao Xie, Kevin Liu
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
On Mon, Jan 07, 2013 at 01:38:50PM +0800, Kevin Liu wrote:
> Introduce a regulator_is_dummy function to check whether the
> regulator is dummy.
No, we've been through this repeatedly. Whatever problem you're trying
to bodge around is going to be a problem with some real physical
regulators too.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] regulator: add regulator_is_dummy function
2013-01-07 11:25 ` [PATCH 1/2] regulator: add regulator_is_dummy function Mark Brown
@ 2013-01-07 11:36 ` Kevin Liu
2013-01-07 13:18 ` Mark Brown
2013-01-07 12:30 ` Dr. Rainer Kaluscha
1 sibling, 1 reply; 7+ messages in thread
From: Kevin Liu @ 2013-01-07 11:36 UTC (permalink / raw)
To: Mark Brown
Cc: Kevin Liu, linux-pm, linux-mmc, Chris Ball, Marek Szyprowski,
Rainer Kaluscha, Rainer Kaluscha, Philip Rakity, Zhangfei Gao,
Haojian Zhuang, Chao Xie
2013/1/7 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Mon, Jan 07, 2013 at 01:38:50PM +0800, Kevin Liu wrote:
>> Introduce a regulator_is_dummy function to check whether the
>> regulator is dummy.
>
> No, we've been through this repeatedly. Whatever problem you're trying
> to bodge around is going to be a problem with some real physical
> regulators too.
Then the only way is MUST define the regulator rather than let dummy
regulator handle it, right?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] regulator: add regulator_is_dummy function
2013-01-07 11:36 ` Kevin Liu
@ 2013-01-07 13:18 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2013-01-07 13:18 UTC (permalink / raw)
To: Kevin Liu
Cc: Kevin Liu, linux-pm, linux-mmc, Chris Ball, Marek Szyprowski,
Rainer Kaluscha, Rainer Kaluscha, Philip Rakity, Zhangfei Gao,
Haojian Zhuang, Chao Xie
[-- Attachment #1: Type: text/plain, Size: 576 bytes --]
On Mon, Jan 07, 2013 at 06:36:36AM -0500, Kevin Liu wrote:
> 2013/1/7 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> > No, we've been through this repeatedly. Whatever problem you're trying
> > to bodge around is going to be a problem with some real physical
> > regulators too.
> Then the only way is MUST define the regulator rather than let dummy
> regulator handle it, right?
To repeat once again, dummy regulators should never be used in
production. They are purely a crutch to help get boot going - it is
expected that things like this and cpufreq might fail.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] regulator: add regulator_is_dummy function
2013-01-07 11:25 ` [PATCH 1/2] regulator: add regulator_is_dummy function Mark Brown
2013-01-07 11:36 ` Kevin Liu
@ 2013-01-07 12:30 ` Dr. Rainer Kaluscha
2013-01-07 13:22 ` Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Dr. Rainer Kaluscha @ 2013-01-07 12:30 UTC (permalink / raw)
To: Mark Brown
Cc: Kevin Liu, linux-pm, linux-mmc, Chris Ball, Marek Szyprowski,
Rainer Kaluscha, Philip Rakity, Zhangfei Gao, Haojian Zhuang,
Chao Xie, Kevin Liu
Am 07.01.2013 12:25, schrieb Mark Brown:
> On Mon, Jan 07, 2013 at 01:38:50PM +0800, Kevin Liu wrote:
>> Introduce a regulator_is_dummy function to check whether the
>> regulator is dummy.
>
> No, we've been through this repeatedly. Whatever problem you're trying
> to bodge around is going to be a problem with some real physical
> regulators too.
Though I don't know the previous discussion, this seems a different case to me.
The problem is that *only* a dummy regulator is available which refuses to do any regulation at
all.
So sdhci/mmc should better behave as no regulator was available at all.
This may happen if e.g. in a precompiled kernel of some linux distro regulator support
(including dummy) is enabled but the machine running that kernel doesn't have a known hardware
regulator. This results in sdhci/mmc failing to enable the SD card reader though it would work
well without regulator support in the kernel.
Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] regulator: add regulator_is_dummy function
2013-01-07 12:30 ` Dr. Rainer Kaluscha
@ 2013-01-07 13:22 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2013-01-07 13:22 UTC (permalink / raw)
To: Dr. Rainer Kaluscha
Cc: Kevin Liu, linux-pm, linux-mmc, Chris Ball, Marek Szyprowski,
Rainer Kaluscha, Philip Rakity, Zhangfei Gao, Haojian Zhuang,
Chao Xie, Kevin Liu
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]
On Mon, Jan 07, 2013 at 01:30:54PM +0100, Dr. Rainer Kaluscha wrote:
> The problem is that *only* a dummy regulator is available which
> refuses to do any regulation at all.
> So sdhci/mmc should better behave as no regulator was available at all.
> This may happen if e.g. in a precompiled kernel of some linux distro
> regulator support (including dummy) is enabled but the machine
> running that kernel doesn't have a known hardware regulator. This
> results in sdhci/mmc failing to enable the SD card reader though it
> would work well without regulator support in the kernel.
Production systems should not enable the dummy regulators, it's that
simple. They're a crutch to get things booting but they're going to
cause problems in production.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-01-07 13:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-07 5:38 [PATCH 1/2] regulator: add regulator_is_dummy function Kevin Liu
2013-01-07 5:38 ` [PATCH 2/2] mmc: sdhci: fix dummy regulator issue Kevin Liu
2013-01-07 11:25 ` [PATCH 1/2] regulator: add regulator_is_dummy function Mark Brown
2013-01-07 11:36 ` Kevin Liu
2013-01-07 13:18 ` Mark Brown
2013-01-07 12:30 ` Dr. Rainer Kaluscha
2013-01-07 13:22 ` 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).