Merge branch 'docs-move' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-4430sdp.c
index 93edd7f..73fa90b 100644 (file)
@@ -42,6 +42,7 @@
 #include "hsmmc.h"
 #include "timer-gp.h"
 #include "control.h"
+#include "common-board-devices.h"
 
 #define ETH_KS8851_IRQ                 34
 #define ETH_KS8851_POWER_ON            48
@@ -251,58 +252,22 @@ static struct spi_board_info sdp4430_spi_board_info[] __initdata = {
        },
 };
 
+static struct gpio sdp4430_eth_gpios[] __initdata = {
+       { ETH_KS8851_POWER_ON,  GPIOF_OUT_INIT_HIGH,    "eth_power"     },
+       { ETH_KS8851_QUART,     GPIOF_OUT_INIT_HIGH,    "quart"         },
+       { ETH_KS8851_IRQ,       GPIOF_IN,               "eth_irq"       },
+};
+
 static int omap_ethernet_init(void)
 {
        int status;
 
        /* Request of GPIO lines */
+       status = gpio_request_array(sdp4430_eth_gpios,
+                                   ARRAY_SIZE(sdp4430_eth_gpios));
+       if (status)
+               pr_err("Cannot request ETH GPIOs\n");
 
-       status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
-       if (status) {
-               pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
-               return status;
-       }
-
-       status = gpio_request(ETH_KS8851_QUART, "quart");
-       if (status) {
-               pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
-               goto error1;
-       }
-
-       status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
-       if (status) {
-               pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
-               goto error2;
-       }
-
-       /* Configuration of requested GPIO lines */
-
-       status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
-       if (status) {
-               pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
-               goto error3;
-       }
-
-       status = gpio_direction_output(ETH_KS8851_QUART, 1);
-       if (status) {
-               pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
-               goto error3;
-       }
-
-       status = gpio_direction_input(ETH_KS8851_IRQ);
-       if (status) {
-               pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
-               goto error3;
-       }
-
-       return 0;
-
-error3:
-       gpio_free(ETH_KS8851_IRQ);
-error2:
-       gpio_free(ETH_KS8851_QUART);
-error1:
-       gpio_free(ETH_KS8851_POWER_ON);
        return status;
 }
 
@@ -575,14 +540,6 @@ static struct twl4030_platform_data sdp4430_twldata = {
        .usb            = &omap4_usbphy_data
 };
 
-static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = {
-       {
-               I2C_BOARD_INFO("twl6030", 0x48),
-               .flags = I2C_CLIENT_WAKE,
-               .irq = OMAP44XX_IRQ_SYS_1N,
-               .platform_data = &sdp4430_twldata,
-       },
-};
 static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = {
        {
                I2C_BOARD_INFO("tmp105", 0x48),
@@ -598,12 +555,7 @@ static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = {
 };
 static int __init omap4_i2c_init(void)
 {
-       /*
-        * Phoenix Audio IC needs I2C1 to
-        * start with 400 KHz or less
-        */
-       omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo,
-                       ARRAY_SIZE(sdp4430_i2c_boardinfo));
+       omap4_pmic_init("twl6030", &sdp4430_twldata);
        omap_register_i2c_bus(2, 400, NULL, 0);
        omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
                                ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
@@ -614,21 +566,13 @@ static int __init omap4_i2c_init(void)
 
 static void __init omap_sfh7741prox_init(void)
 {
-       int  error;
+       int error;
 
-       error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
-       if (error < 0) {
+       error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
+                                GPIOF_OUT_INIT_LOW, "sfh7741");
+       if (error < 0)
                pr_err("%s:failed to request GPIO %d, error %d\n",
                        __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
-               return;
-       }
-
-       error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
-       if (error < 0) {
-               pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
-                        __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
-               gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
-       }
 }
 
 static void sdp4430_hdmi_mux_init(void)
@@ -645,27 +589,19 @@ static void sdp4430_hdmi_mux_init(void)
                        OMAP_PIN_INPUT_PULLUP);
 }
 
+static struct gpio sdp4430_hdmi_gpios[] = {
+       { HDMI_GPIO_HPD,        GPIOF_OUT_INIT_HIGH,    "hdmi_gpio_hpd"   },
+       { HDMI_GPIO_LS_OE,      GPIOF_OUT_INIT_HIGH,    "hdmi_gpio_ls_oe" },
+};
+
 static int sdp4430_panel_enable_hdmi(struct omap_dss_device *dssdev)
 {
        int status;
 
-       status = gpio_request_one(HDMI_GPIO_HPD, GPIOF_OUT_INIT_HIGH,
-                                                       "hdmi_gpio_hpd");
-       if (status) {
-               pr_err("Cannot request GPIO %d\n", HDMI_GPIO_HPD);
-               return status;
-       }
-       status = gpio_request_one(HDMI_GPIO_LS_OE, GPIOF_OUT_INIT_HIGH,
-                                                       "hdmi_gpio_ls_oe");
-       if (status) {
-               pr_err("Cannot request GPIO %d\n", HDMI_GPIO_LS_OE);
-               goto error1;
-       }
-
-       return 0;
-
-error1:
-       gpio_free(HDMI_GPIO_HPD);
+       status = gpio_request_array(sdp4430_hdmi_gpios,
+                                   ARRAY_SIZE(sdp4430_hdmi_gpios));
+       if (status)
+               pr_err("%s: Cannot request HDMI GPIOs\n", __func__);
 
        return status;
 }