omap3sdp: clean regulator supply mapping in board file
authorRajendra Nayak <rnayak@ti.com>
Thu, 3 Feb 2011 12:45:22 +0000 (12:45 +0000)
committerTony Lindgren <tony@atomide.com>
Tue, 22 Feb 2011 16:36:44 +0000 (08:36 -0800)
clean the regulator supply mapping data in the 3430sdp
board file (which is spread all over) by moving all
of them together.
Also use the REGULATOR_SUPPLY macro and remove instances
of mapping dev pointers at run time.
Additonally define all regulator_consumer_supply as
array's and use ARRAY_SIZE macro to define
num_consumer_supplies.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-3430sdp.c

index 7f8c7a7..a15f115 100644 (file)
@@ -315,11 +315,6 @@ static struct platform_device sdp3430_dss_device = {
        },
 };
 
-static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
-       .supply         = "vdda_dac",
-       .dev            = &sdp3430_dss_device.dev,
-};
-
 static struct platform_device *sdp3430_devices[] __initdata = {
        &sdp3430_dss_device,
 };
@@ -369,18 +364,6 @@ static struct omap2_hsmmc_info mmc[] = {
        {}      /* Terminator */
 };
 
-static struct regulator_consumer_supply sdp3430_vmmc1_supply = {
-       .supply                 = "vmmc",
-};
-
-static struct regulator_consumer_supply sdp3430_vsim_supply = {
-       .supply                 = "vmmc_aux",
-};
-
-static struct regulator_consumer_supply sdp3430_vmmc2_supply = {
-       .supply                 = "vmmc",
-};
-
 static int sdp3430_twl_gpio_setup(struct device *dev,
                unsigned gpio, unsigned ngpio)
 {
@@ -391,13 +374,6 @@ static int sdp3430_twl_gpio_setup(struct device *dev,
        mmc[1].gpio_cd = gpio + 1;
        omap2_hsmmc_init(mmc);
 
-       /* link regulators to MMC adapters ... we "know" the
-        * regulators will be set up only *after* we return.
-        */
-       sdp3430_vmmc1_supply.dev = mmc[0].dev;
-       sdp3430_vsim_supply.dev = mmc[0].dev;
-       sdp3430_vmmc2_supply.dev = mmc[1].dev;
-
        /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
        gpio_request(gpio + 7, "sub_lcd_en_bkl");
        gpio_direction_output(gpio + 7, 0);
@@ -426,11 +402,34 @@ static struct twl4030_madc_platform_data sdp3430_madc_data = {
        .irq_line       = 1,
 };
 
+/* regulator consumer mappings */
+
 /* ads7846 on SPI */
 static struct regulator_consumer_supply sdp3430_vaux3_supplies[] = {
        REGULATOR_SUPPLY("vcc", "spi1.0"),
 };
 
+static struct regulator_consumer_supply sdp3430_vdda_dac_supplies[] = {
+       REGULATOR_SUPPLY("vdda_dac", "omapdss"),
+};
+
+/* VPLL2 for digital video outputs */
+static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
+       REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+};
+
+static struct regulator_consumer_supply sdp3430_vmmc1_supplies[] = {
+       REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"),
+};
+
+static struct regulator_consumer_supply sdp3430_vsim_supplies[] = {
+       REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.0"),
+};
+
+static struct regulator_consumer_supply sdp3430_vmmc2_supplies[] = {
+       REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"),
+};
+
 /*
  * Apply all the fixed voltages since most versions of U-Boot
  * don't bother with that initialization.
@@ -501,8 +500,8 @@ static struct regulator_init_data sdp3430_vmmc1 = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &sdp3430_vmmc1_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(sdp3430_vmmc1_supplies),
+       .consumer_supplies      = sdp3430_vmmc1_supplies,
 };
 
 /* VMMC2 for MMC2 card */
@@ -516,8 +515,8 @@ static struct regulator_init_data sdp3430_vmmc2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &sdp3430_vmmc2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(sdp3430_vmmc2_supplies),
+       .consumer_supplies      = sdp3430_vmmc2_supplies,
 };
 
 /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */
@@ -531,8 +530,8 @@ static struct regulator_init_data sdp3430_vsim = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &sdp3430_vsim_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(sdp3430_vsim_supplies),
+       .consumer_supplies      = sdp3430_vsim_supplies,
 };
 
 /* VDAC for DSS driving S-Video */
@@ -546,16 +545,8 @@ static struct regulator_init_data sdp3430_vdac = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &sdp3430_vdda_dac_supply,
-};
-
-/* VPLL2 for digital video outputs */
-static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
-       {
-               .supply         = "vdds_dsi",
-               .dev            = &sdp3430_dss_device.dev,
-       }
+       .num_consumer_supplies  = ARRAY_SIZE(sdp3430_vdda_dac_supplies),
+       .consumer_supplies      = sdp3430_vdda_dac_supplies,
 };
 
 static struct regulator_init_data sdp3430_vpll2 = {