Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-4430sdp.c
index 933b25b..c7cef44 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/i2c/twl.h>
 #include <linux/gpio_keys.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 #include <linux/leds.h>
 #include <linux/leds_pwm.h>
 
@@ -37,6 +38,7 @@
 #include <plat/mmc.h>
 #include <plat/omap4-keypad.h>
 #include <video/omapdss.h>
+#include <linux/wl12xx.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -51,6 +53,9 @@
 #define HDMI_GPIO_HPD 60 /* Hot plug pin for HDMI */
 #define HDMI_GPIO_LS_OE 41 /* Level shifter for HDMI */
 
+#define GPIO_WIFI_PMENA                54
+#define GPIO_WIFI_IRQ          53
+
 static const int sdp4430_keymap[] = {
        KEY(0, 0, KEY_E),
        KEY(0, 1, KEY_R),
@@ -124,6 +129,64 @@ static const int sdp4430_keymap[] = {
        KEY(7, 6, KEY_OK),
        KEY(7, 7, KEY_DOWN),
 };
+static struct omap_device_pad keypad_pads[] __initdata = {
+       {       .name   = "kpd_col1.kpd_col1",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_col1.kpd_col1",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_col2.kpd_col2",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_col3.kpd_col3",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_col4.kpd_col4",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_col5.kpd_col5",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "gpmc_a23.kpd_col7",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "gpmc_a22.kpd_col6",
+               .enable = OMAP_WAKEUP_EN | OMAP_MUX_MODE1,
+       },
+       {       .name   = "kpd_row0.kpd_row0",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "kpd_row1.kpd_row1",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "kpd_row2.kpd_row2",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "kpd_row3.kpd_row3",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "kpd_row4.kpd_row4",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "kpd_row5.kpd_row5",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "gpmc_a18.kpd_row6",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+       {       .name   = "gpmc_a19.kpd_row7",
+               .enable = OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_WAKEUP_EN |
+                       OMAP_MUX_MODE1 | OMAP_INPUT_EN,
+       },
+};
 
 static struct matrix_keymap_data sdp4430_keymap_data = {
        .keymap                 = sdp4430_keymap,
@@ -135,6 +198,13 @@ static struct omap4_keypad_platform_data sdp4430_keypad_data = {
        .rows                   = 8,
        .cols                   = 8,
 };
+
+static struct omap_board_data keypad_data = {
+       .id                     = 1,
+       .pads                   = keypad_pads,
+       .pads_cnt               = ARRAY_SIZE(keypad_pads),
+};
+
 static struct gpio_led sdp4430_gpio_leds[] = {
        {
                .name   = "omap4:green:debug0",
@@ -275,11 +345,40 @@ static struct platform_device sdp4430_lcd_device = {
        .id             = -1,
 };
 
+static struct regulator_consumer_supply sdp4430_vbat_supply[] = {
+       REGULATOR_SUPPLY("vddvibl", "twl6040-vibra"),
+       REGULATOR_SUPPLY("vddvibr", "twl6040-vibra"),
+};
+
+static struct regulator_init_data sdp4430_vbat_data = {
+       .constraints = {
+               .always_on      = 1,
+       },
+       .num_consumer_supplies  = ARRAY_SIZE(sdp4430_vbat_supply),
+       .consumer_supplies      = sdp4430_vbat_supply,
+};
+
+static struct fixed_voltage_config sdp4430_vbat_pdata = {
+       .supply_name    = "VBAT",
+       .microvolts     = 3750000,
+       .init_data      = &sdp4430_vbat_data,
+       .gpio           = -EINVAL,
+};
+
+static struct platform_device sdp4430_vbat = {
+       .name           = "reg-fixed-voltage",
+       .id             = -1,
+       .dev = {
+               .platform_data = &sdp4430_vbat_pdata,
+       },
+};
+
 static struct platform_device *sdp4430_devices[] __initdata = {
        &sdp4430_lcd_device,
        &sdp4430_gpio_keys_device,
        &sdp4430_leds_gpio,
        &sdp4430_leds_pwm,
+       &sdp4430_vbat,
 };
 
 static struct omap_lcd_config sdp4430_lcd_config __initdata = {
@@ -315,7 +414,16 @@ static struct omap2_hsmmc_info mmc[] = {
        {
                .mmc            = 1,
                .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+               .gpio_cd        = -EINVAL,
+               .gpio_wp        = -EINVAL,
+       },
+       {
+               .mmc            = 5,
+               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
+               .gpio_cd        = -EINVAL,
                .gpio_wp        = -EINVAL,
+               .ocr_mask       = MMC_VDD_165_195,
+               .nonremovable   = true,
        },
        {}      /* Terminator */
 };
@@ -324,6 +432,37 @@ static struct regulator_consumer_supply sdp4430_vaux_supply[] = {
        REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
 };
 
+static struct regulator_consumer_supply omap4_sdp4430_vmmc5_supply = {
+       .supply = "vmmc",
+       .dev_name = "omap_hsmmc.4",
+};
+
+static struct regulator_init_data sdp4430_vmmc5 = {
+       .constraints = {
+               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+       },
+       .num_consumer_supplies = 1,
+       .consumer_supplies = &omap4_sdp4430_vmmc5_supply,
+};
+
+static struct fixed_voltage_config sdp4430_vwlan = {
+       .supply_name            = "vwl1271",
+       .microvolts             = 1800000, /* 1.8V */
+       .gpio                   = GPIO_WIFI_PMENA,
+       .startup_delay          = 70000, /* 70msec */
+       .enable_high            = 1,
+       .enabled_at_boot        = 0,
+       .init_data              = &sdp4430_vmmc5,
+};
+
+static struct platform_device omap_vwlan_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 1,
+       .dev = {
+               .platform_data = &sdp4430_vwlan,
+       },
+};
+
 static int omap4_twl6030_hsmmc_late_init(struct device *dev)
 {
        int ret = 0;
@@ -395,7 +534,33 @@ static struct regulator_init_data sdp4430_vusim = {
        },
 };
 
+static struct twl4030_codec_data twl6040_codec = {
+       /* single-step ramp for headset and handsfree */
+       .hs_left_step   = 0x0f,
+       .hs_right_step  = 0x0f,
+       .hf_left_step   = 0x1d,
+       .hf_right_step  = 0x1d,
+};
+
+static struct twl4030_vibra_data twl6040_vibra = {
+       .vibldrv_res = 8,
+       .vibrdrv_res = 3,
+       .viblmotor_res = 10,
+       .vibrmotor_res = 10,
+       .vddvibl_uV = 0,        /* fixed volt supply - VBAT */
+       .vddvibr_uV = 0,        /* fixed volt supply - VBAT */
+};
+
+static struct twl4030_audio_data twl6040_audio = {
+       .codec          = &twl6040_codec,
+       .vibra          = &twl6040_vibra,
+       .audpwron_gpio  = 127,
+       .naudint_irq    = OMAP44XX_IRQ_SYS_2N,
+       .irq_base       = TWL6040_CODEC_IRQ_BASE,
+};
+
 static struct twl4030_platform_data sdp4430_twldata = {
+       .audio          = &twl6040_audio,
        /* Regulators */
        .vusim          = &sdp4430_vusim,
        .vaux1          = &sdp4430_vaux1,
@@ -593,6 +758,41 @@ static inline void board_serial_init(void)
 }
  #endif
 
+static void omap4_sdp4430_wifi_mux_init(void)
+{
+       omap_mux_init_gpio(GPIO_WIFI_IRQ, OMAP_PIN_INPUT |
+                               OMAP_PIN_OFF_WAKEUPENABLE);
+       omap_mux_init_gpio(GPIO_WIFI_PMENA, OMAP_PIN_OUTPUT);
+
+       omap_mux_init_signal("sdmmc5_cmd.sdmmc5_cmd",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_signal("sdmmc5_clk.sdmmc5_clk",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_signal("sdmmc5_dat0.sdmmc5_dat0",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_signal("sdmmc5_dat1.sdmmc5_dat1",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_signal("sdmmc5_dat2.sdmmc5_dat2",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_signal("sdmmc5_dat3.sdmmc5_dat3",
+                               OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP);
+
+}
+
+static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
+       .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
+       .board_ref_clock = WL12XX_REFCLOCK_26,
+       .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
+};
+
+static void omap4_sdp4430_wifi_init(void)
+{
+       omap4_sdp4430_wifi_mux_init();
+       if (wl12xx_set_platform_data(&omap4_sdp4430_wlan_data))
+               pr_err("Error setting wl12xx data\n");
+       platform_device_register(&omap_vwlan_device);
+}
+
 static void __init omap_4430sdp_init(void)
 {
        int status;
@@ -609,6 +809,7 @@ static void __init omap_4430sdp_init(void)
        omap_sfh7741prox_init();
        platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
        board_serial_init();
+       omap4_sdp4430_wifi_init();
        omap4_twl6030_hsmmc_init(mmc);
 
        usb_musb_init(&musb_board_data);
@@ -622,7 +823,7 @@ static void __init omap_4430sdp_init(void)
                                ARRAY_SIZE(sdp4430_spi_board_info));
        }
 
-       status = omap4_keyboard_init(&sdp4430_keypad_data);
+       status = omap4_keyboard_init(&sdp4430_keypad_data, &keypad_data);
        if (status)
                pr_err("Keypad initialization failed: %d\n", status);