mmc: msm_sdcc: Check if voltages can be set or not on a regulator
Use regulator framework to figure out if voltage can be set or not on a
regulator by software or if the regulator would be at a fixed voltage.
Change-Id: I1f67dbd7c2d16f998190341db3124b44593b1127
Signed-off-by: Krishna Konda <kkonda@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-9615.c b/arch/arm/mach-msm/board-9615.c
index bce026d..1034b9b 100644
--- a/arch/arm/mach-msm/board-9615.c
+++ b/arch/arm/mach-msm/board-9615.c
@@ -301,7 +301,6 @@
* This is a gpio-regulator and does not support
* regulator_set_voltage and regulator_set_optimum_mode
*/
- .set_voltage_sup = false,
.high_vol_level = 2950000,
.low_vol_level = 2950000,
.hpm_uA = 600000, /* 600mA */
@@ -313,7 +312,6 @@
/* SDCC1 : External card slot connected */
[SDCC1] = {
.name = "sdc_vddp",
- .set_voltage_sup = true,
.high_vol_level = 2950000,
.low_vol_level = 1850000,
.always_on = true,
diff --git a/arch/arm/mach-msm/board-apq8064.c b/arch/arm/mach-msm/board-apq8064.c
index bc06870..d351268 100644
--- a/arch/arm/mach-msm/board-apq8064.c
+++ b/arch/arm/mach-msm/board-apq8064.c
@@ -228,7 +228,6 @@
/* SDCC1 : eMMC card connected */
[SDCC1] = {
.name = "sdc_vdd",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 2950000,
.always_on = 1,
@@ -239,7 +238,6 @@
/* SDCC3 : External card slot connected */
[SDCC3] = {
.name = "sdc_vdd",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 2950000,
.hpm_uA = 600000, /* 600mA */
@@ -251,7 +249,6 @@
/* SDCC1 : eMMC card connected */
[SDCC1] = {
.name = "sdc_vccq",
- .set_voltage_sup = 1,
.always_on = 1,
.high_vol_level = 1800000,
.low_vol_level = 1800000,
@@ -264,7 +261,6 @@
/* SDCC3 : External card slot connected */
[SDCC3] = {
.name = "sdc_vddp",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 1850000,
.always_on = 1,
diff --git a/arch/arm/mach-msm/board-msm8960.c b/arch/arm/mach-msm/board-msm8960.c
index 7403da9..9a88eb1 100644
--- a/arch/arm/mach-msm/board-msm8960.c
+++ b/arch/arm/mach-msm/board-msm8960.c
@@ -2840,7 +2840,6 @@
/* SDCC1 : eMMC card connected */
[SDCC1] = {
.name = "sdc_vdd",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 2950000,
.always_on = 1,
@@ -2851,7 +2850,6 @@
/* SDCC3 : External card slot connected */
[SDCC3] = {
.name = "sdc_vdd",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 2950000,
.hpm_uA = 600000, /* 600mA */
@@ -2863,7 +2861,6 @@
/* SDCC1 : eMMC card connected */
[SDCC1] = {
.name = "sdc_vccq",
- .set_voltage_sup = 1,
.always_on = 1,
.high_vol_level = 1800000,
.low_vol_level = 1800000,
@@ -2876,7 +2873,6 @@
/* SDCC3 : External card slot connected */
[SDCC3] = {
.name = "sdc_vddp",
- .set_voltage_sup = 1,
.high_vol_level = 2950000,
.low_vol_level = 1850000,
.always_on = 1,
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index e639815..b0ec0e8 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -1716,7 +1716,12 @@
rc = PTR_ERR(vreg->reg);
pr_err("%s: regulator_get(%s) failed. rc=%d\n",
__func__, vreg->name, rc);
+ goto out;
}
+
+ if (regulator_count_voltages(vreg->reg) > 0)
+ vreg->set_voltage_sup = 1;
+
out:
return rc;
}