aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mmc-twl4030.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/mmc-twl4030.c')
-rw-r--r--arch/arm/mach-omap2/mmc-twl4030.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c
index 9756a878fd90..3c04c2f1b23f 100644
--- a/arch/arm/mach-omap2/mmc-twl4030.c
+++ b/arch/arm/mach-omap2/mmc-twl4030.c
@@ -119,6 +119,7 @@ static int twl_mmc_late_init(struct device *dev)
119 if (i != 0) 119 if (i != 0)
120 break; 120 break;
121 ret = PTR_ERR(reg); 121 ret = PTR_ERR(reg);
122 hsmmc[i].vcc = NULL;
122 goto err; 123 goto err;
123 } 124 }
124 hsmmc[i].vcc = reg; 125 hsmmc[i].vcc = reg;
@@ -165,8 +166,13 @@ done:
165static void twl_mmc_cleanup(struct device *dev) 166static void twl_mmc_cleanup(struct device *dev)
166{ 167{
167 struct omap_mmc_platform_data *mmc = dev->platform_data; 168 struct omap_mmc_platform_data *mmc = dev->platform_data;
169 int i;
168 170
169 gpio_free(mmc->slots[0].switch_pin); 171 gpio_free(mmc->slots[0].switch_pin);
172 for(i = 0; i < ARRAY_SIZE(hsmmc); i++) {
173 regulator_put(hsmmc[i].vcc);
174 regulator_put(hsmmc[i].vcc_aux);
175 }
170} 176}
171 177
172#ifdef CONFIG_PM 178#ifdef CONFIG_PM
@@ -263,8 +269,19 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,
263static int twl_mmc23_set_power(struct device *dev, int slot, int power_on, int vdd) 269static int twl_mmc23_set_power(struct device *dev, int slot, int power_on, int vdd)
264{ 270{
265 int ret = 0; 271 int ret = 0;
266 struct twl_mmc_controller *c = &hsmmc[1]; 272 struct twl_mmc_controller *c = NULL;
267 struct omap_mmc_platform_data *mmc = dev->platform_data; 273 struct omap_mmc_platform_data *mmc = dev->platform_data;
274 int i;
275
276 for (i = 1; i < ARRAY_SIZE(hsmmc); i++) {
277 if (mmc == hsmmc[i].mmc) {
278 c = &hsmmc[i];
279 break;
280 }
281 }
282
283 if (c == NULL)
284 return -ENODEV;
268 285
269 /* If we don't see a Vcc regulator, assume it's a fixed 286 /* If we don't see a Vcc regulator, assume it's a fixed
270 * voltage always-on regulator. 287 * voltage always-on regulator.