Skip to contentSkip to conversation

mmc: core: Quieten "could not set regulator OCR" error.

PATCH In review Chris Ball 3 participants 6 messages Aug 27, 2012 – Aug 30, 2012 MMC, SD and SDIO

lore
Share & tools
lore

Chris Ball

author
#0 lore raw

PATCH 1/1 mmc: core: Quieten "could not set regulator OCR" error.

Some distributions build with CONFIG_REGULATOR_DUMMY=y -- this makes regulator setup succeed harmlessly, but then trying to set the voltage on the dummy regulator will fail as below:

[ 6.413866] sdhci-pci 0000:03:00.0: SDHCI controller found [1180:e822]
(rev 0)
[ 6.414081] _regulator_get: 0000:03:00.0 supply vmmc not found, using
dummy regulator
[ 6.415252] mmc0: SDHCI controller on PCI [0000:03:00.0] using DMA
[ 6.415294] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.444241] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.473648] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)

[..]

Since this isn't an error in this case, move the error to pr_debug().
Reference: https://bugs.archlinux.org/task/29008

---
 drivers/mmc/core/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +3 -2
index 835c9f0..30d9357 100644
@@ -1017,8 +1017,9 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
 	}
 
 	if (result)
-		dev_err(mmc_dev(mmc),
-			"could not set regulator OCR (%d)\n", result);
+		pr_debug("%s: could not set regulator OCR (%d)\n",
+			 mmc_hostname(mmc), result);
+
 	return result;
 }
 EXPORT_SYMBOL_GPL(mmc_regulator_set_ocr);
Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#1 lore raw

Hi Chris,

Quoted 27 lines · Chris Ball

Some distributions build with CONFIG_REGULATOR_DUMMY=y -- this makes regulator setup succeed harmlessly, but then trying to set the voltage on the dummy regulator will fail as below:

[ 6.413866] sdhci-pci 0000:03:00.0: SDHCI controller found [1180:e822]
(rev 0)
[ 6.414081] _regulator_get: 0000:03:00.0 supply vmmc not found, using
dummy regulator
[ 6.415252] mmc0: SDHCI controller on PCI [0000:03:00.0] using DMA
[ 6.415294] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.444241] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.473648] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)

[..]

Since this isn't an error in this case, move the error to pr_debug().
Reference: https://bugs.archlinux.org/task/29008

---
 drivers/mmc/core/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +0 -0
index 835c9f0..30d9357 100644

drivers/mmc/core/core.c int mmc_regulator_set_ocr(struct mmc_host *mmc, · line 1022

Quoted 8 lines
drivers/mmc/core/core.c +3 -2
@@ -1017,8 +1017,9 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
        }
 
        if (result)
-               dev_err(mmc_dev(mmc),
-                       "could not set regulator OCR (%d)\n", result);
+               pr_debug("%s: could not set regulator OCR (%d)\n",
+                        mmc_hostname(mmc), result);
+

I am not sure this is the correct solution. Would it be possible prevent sdhci-* from calling mmc_regulator_set_ocr when it has gotten a "dummy" regulator some how?

In the other scenarios were we use a real regulator, I would interpret this error as critical, since the power to the card could not be set according to the vdd bit.
Of course an option could be to leave the error printing to the caller of mmc_regulator_set_ocr.. :-)

Quoted 10 lines
drivers/mmc/core/core.c +0 -1
        return result;
 }
 EXPORT_SYMBOL_GPL(mmc_regulator_set_ocr);
--

Chris Ball <[email protected]> <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Kind regards
Ulf Hansson

author
#2 lore raw

Hi, adding Mark and Liam,

Quoted 30 lines · Ulf Hansson
Quoted 29 lines · Chris Ball

Some distributions build with CONFIG_REGULATOR_DUMMY=y -- this makes regulator setup succeed harmlessly, but then trying to set the voltage on the dummy regulator will fail as below:

[ 6.413866] sdhci-pci 0000:03:00.0: SDHCI controller found [1180:e822]
(rev 0)
[ 6.414081] _regulator_get: 0000:03:00.0 supply vmmc not found, using
dummy regulator
[ 6.415252] mmc0: SDHCI controller on PCI [0000:03:00.0] using DMA
[ 6.415294] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.444241] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.473648] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)

[..]

Since this isn't an error in this case, move the error to pr_debug().
Reference: https://bugs.archlinux.org/task/29008

---
 drivers/mmc/core/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/core/core.c +0 -0
index 835c9f0..30d9357 100644
@@ -1017,8 +1017,9 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
        }
 
Quoted 10 lines

drivers/mmc/core/core.c int mmc_regulator_set_ocr(struct mmc_host *mmc, · line 1022

Quoted 6 lines
drivers/mmc/core/core.c +3 -2
        if (result)
-               dev_err(mmc_dev(mmc),
-                       "could not set regulator OCR (%d)\n", result);
+               pr_debug("%s: could not set regulator OCR (%d)\n",
+                        mmc_hostname(mmc), result);
+

I am not sure this is the correct solution. Would it be possible prevent sdhci-* from calling mmc_regulator_set_ocr when it has gotten a "dummy" regulator some how?

Looks like regulator_desc->name should be "dummy", but I think it would be an API violation for us to start caring about that. Mark, would you be interested in offering an "regulator_is_dummy(supply)" function so that we can limit our error messages to non-dummy supplies?

Quoted 5 lines

In the other scenarios were we use a real regulator, I would interpret this error as critical, since the power to the card could not be set according to the vdd bit.
Of course an option could be to leave the error printing to the caller of mmc_regulator_set_ocr.. :-)

Makes sense. If we can't work out a compromise, we should just leave it as-is -- the error messages appear to be worrying some users, but they're not breaking any functionality.

Thanks for the review,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#3 lore raw
Quoted 22 lines · Chris Ball
Quoted 20 lines · Ulf Hansson
Quoted 18 lines · Chris Ball

Some distributions build with CONFIG_REGULATOR_DUMMY=y -- this makes regulator setup succeed harmlessly, but then trying to set the voltage on the dummy regulator will fail as below:

[ 6.413866] sdhci-pci 0000:03:00.0: SDHCI controller found [1180:e822]
(rev 0)
[ 6.414081] _regulator_get: 0000:03:00.0 supply vmmc not found, using
dummy regulator
[ 6.415252] mmc0: SDHCI controller on PCI [0000:03:00.0] using DMA
[ 6.415294] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.444241] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)
[ 6.473648] sdhci-pci 0000:03:00.0: could not set regulator OCR (-22)

[..]

Since this isn't an error in this case, move the error to pr_debug().
Reference: https://bugs.archlinux.org/task/29008

Quoted 8 lines
Quoted 3 lines

I am not sure this is the correct solution. Would it be possible prevent sdhci-* from calling mmc_regulator_set_ocr when it has gotten a "dummy" regulator some how?

Looks like regulator_desc->name should be "dummy", but I think it would be an API violation for us to start caring about that. Mark, would you be interested in offering an "regulator_is_dummy(supply)" function so that we can limit our error messages to non-dummy supplies?

No, that's a terrible idea as previously discussed.

The *sole* purpose of the dummy regulator driver is to provide a crutch to keep systems with broken configuraitons running, it's not indended to be used on production systems and is there solely as an aid for development. This is why it can only be enabled via Kconfig. If there is no software controllable regulator there the board should be providing fixed regulator.

Conversely there is nothing stopping other regulator drivers having similar properties to the dummy driver, or constraints stopping them implementing things. If the MMC framework wants to silently accept regulators that don't allow the voltage to be set then the MMC framework should enumerate the range of voltages which can be set using the regulator it has and then take appropriate action.

author
#4 lore raw

Hi,

Quoted 5 lines · Mark Brown
Quoted 4 lines

Looks like regulator_desc->name should be "dummy", but I think it would be an API violation for us to start caring about that. Mark, would you be interested in offering an "regulator_is_dummy(supply)" function so that we can limit our error messages to non-dummy supplies?

Quoted 8 lines

No, that's a terrible idea as previously discussed.

The *sole* purpose of the dummy regulator driver is to provide a crutch to keep systems with broken configuraitons running, it's not indended to be used on production systems and is there solely as an aid for development. This is why it can only be enabled via Kconfig. If there is no software controllable regulator there the board should be providing fixed regulator.

It's being used on production systems, else I wouldn't be responding to bug reports from distro users of x86 laptops. Turns out that distro kernel maintainers often like to answer "y" to new Kconfig options without reading/understanding them fully.

Quoted 6 lines

Conversely there is nothing stopping other regulator drivers having similar properties to the dummy driver, or constraints stopping them implementing things. If the MMC framework wants to silently accept regulators that don't allow the voltage to be set then the MMC framework should enumerate the range of voltages which can be set using the regulator it has and then take appropriate action.

I didn't do this because I don't want to silently accept real regulators with insufficient voltage ranges, because that would make it harder to debug real MMC failures.

Sounds like my response to the bug reports should be "persuade your distro kernel maintainers to turn off CONFIG_REGULATOR" -- I'll try doing that.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#5 lore raw
Quoted 9 lines · Chris Ball
Quoted 6 lines · Mark Brown

Conversely there is nothing stopping other regulator drivers having similar properties to the dummy driver, or constraints stopping them implementing things. If the MMC framework wants to silently accept regulators that don't allow the voltage to be set then the MMC framework should enumerate the range of voltages which can be set using the regulator it has and then take appropriate action.

Quoted 7 lines

I didn't do this because I don't want to silently accept real regulators with insufficient voltage ranges, because that would make it harder to debug real MMC failures.

Sounds like my response to the bug reports should be "persuade your distro kernel maintainers to turn off CONFIG_REGULATOR" -- I'll try doing that.

Or alternatively persuade someone to provide the appropriate fixed voltage regulators as part of instantiating the MMC device on these systems.