mmc: sdhci: check voltage range only on regulators aware of voltage value
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 12 Feb 2013 08:01:36 +0000 (09:01 +0100)
committerChris Ball <cjb@laptop.org>
Sun, 24 Feb 2013 19:37:17 +0000 (14:37 -0500)
Some regulators don't report any voltage values, so checking supported
voltage range results in disabling all SDHCI_CAN_VDD_* flags and
registration failure. This patch finally provides a correct fix for the
registration of SDHCI driver with all possible voltage regulators:
dummy, fixed and regulated without using regulator_count_voltages()
hacks.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/sdhci.c

index ba586ae9925268cd263e0101c5155aeb1841a6e8..735526bf8d589fe6561fc9aba6f9bc15ded9433e 100644 (file)
@@ -2976,7 +2976,11 @@ int sdhci_add_host(struct sdhci_host *host)
        }
 
 #ifdef CONFIG_REGULATOR
-       if (host->vmmc) {
+       /*
+        * Voltage range check makes sense only if regulator reports
+        * any voltage value.
+        */
+       if (host->vmmc && regulator_get_voltage(host->vmmc) > 0) {
                ret = regulator_is_supported_voltage(host->vmmc, 2700000,
                        3600000);
                if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))