Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-rx51-peripherals.c
index 17e5685..5a886cd 100644 (file)
@@ -39,6 +39,7 @@
 #include <sound/tpa6130a2-plat.h>
 #include <media/radio-si4713.h>
 #include <media/si4713.h>
+#include <linux/leds-lp5523.h>
 
 #include <../drivers/staging/iio/light/tsl2563.h>
 
@@ -53,6 +54,7 @@
 #define RX51_WL1251_IRQ_GPIO           42
 #define RX51_FMTX_RESET_GPIO           163
 #define RX51_FMTX_IRQ                  53
+#define RX51_LP5523_CHIP_EN_GPIO       41
 
 #define RX51_USB_TRANSCEIVER_RST_GPIO  67
 
@@ -71,6 +73,64 @@ static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
 };
 #endif
 
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+static struct lp5523_led_config rx51_lp5523_led_config[] = {
+       {
+               .chan_nr        = 0,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 1,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 2,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 3,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 4,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 5,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 6,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 7,
+               .led_current    = 50,
+       }, {
+               .chan_nr        = 8,
+               .led_current    = 50,
+       }
+};
+
+static int rx51_lp5523_setup(void)
+{
+       return gpio_request_one(RX51_LP5523_CHIP_EN_GPIO, GPIOF_DIR_OUT,
+                       "lp5523_enable");
+}
+
+static void rx51_lp5523_release(void)
+{
+       gpio_free(RX51_LP5523_CHIP_EN_GPIO);
+}
+
+static void rx51_lp5523_enable(bool state)
+{
+       gpio_set_value(RX51_LP5523_CHIP_EN_GPIO, !!state);
+}
+
+static struct lp5523_platform_data rx51_lp5523_platform_data = {
+       .led_config             = rx51_lp5523_led_config,
+       .num_channels           = ARRAY_SIZE(rx51_lp5523_led_config),
+       .clock_mode             = LP5523_CLOCK_AUTO,
+       .setup_resources        = rx51_lp5523_setup,
+       .release_resources      = rx51_lp5523_release,
+       .enable                 = rx51_lp5523_enable,
+};
+#endif
+
 static struct omap2_mcspi_device_config wl1251_mcspi_config = {
        .turbo_mode     = 0,
        .single_channel = 1,
@@ -288,10 +348,6 @@ static struct twl4030_keypad_data rx51_kp_data = {
        .rep            = 1,
 };
 
-static struct twl4030_madc_platform_data rx51_madc_data = {
-       .irq_line               = 1,
-};
-
 /* Enable input logic and pull all lines up when eMMC is on. */
 static struct omap_board_mux rx51_mmc2_on_mux[] = {
        OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0),
@@ -358,17 +414,21 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
        {}      /* Terminator */
 };
 
-static struct regulator_consumer_supply rx51_vmmc1_supply =
-       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
+static struct regulator_consumer_supply rx51_vmmc1_supply[] = {
+       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
+};
 
-static struct regulator_consumer_supply rx51_vaux2_supply =
-       REGULATOR_SUPPLY("vdds_csib", "omap3isp");
+static struct regulator_consumer_supply rx51_vaux2_supply[] = {
+       REGULATOR_SUPPLY("vdds_csib", "omap3isp"),
+};
 
-static struct regulator_consumer_supply rx51_vaux3_supply =
-       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
+static struct regulator_consumer_supply rx51_vaux3_supply[] = {
+       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"),
+};
 
-static struct regulator_consumer_supply rx51_vsim_supply =
-       REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
+static struct regulator_consumer_supply rx51_vsim_supply[] = {
+       REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"),
+};
 
 static struct regulator_consumer_supply rx51_vmmc2_supplies[] = {
        /* tlv320aic3x analog supplies */
@@ -398,10 +458,6 @@ static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
        REGULATOR_SUPPLY("vdd", "2-0063"),
 };
 
-static struct regulator_consumer_supply rx51_vdac_supply[] = {
-       REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
-};
-
 static struct regulator_init_data rx51_vaux1 = {
        .constraints = {
                .name                   = "V28",
@@ -427,8 +483,8 @@ static struct regulator_init_data rx51_vaux2 = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vaux2_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux2_supply),
+       .consumer_supplies      = rx51_vaux2_supply,
 };
 
 /* VAUX3 - adds more power to VIO_18 rail */
@@ -457,8 +513,8 @@ static struct regulator_init_data rx51_vaux3_mmc = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vaux3_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vaux3_supply),
+       .consumer_supplies      = rx51_vaux3_supply,
 };
 
 static struct regulator_init_data rx51_vaux4 = {
@@ -484,8 +540,8 @@ static struct regulator_init_data rx51_vmmc1 = {
                                        | REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vmmc1_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vmmc1_supply),
+       .consumer_supplies      = rx51_vmmc1_supply,
 };
 
 static struct regulator_init_data rx51_vmmc2 = {
@@ -505,24 +561,35 @@ static struct regulator_init_data rx51_vmmc2 = {
        .consumer_supplies      = rx51_vmmc2_supplies,
 };
 
-static struct regulator_init_data rx51_vsim = {
+static struct regulator_init_data rx51_vpll1 = {
        .constraints = {
-               .name                   = "VMMC2_IO_18",
+               .name                   = "VPLL",
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
                .apply_uV               = true,
+               .always_on              = true,
                .valid_modes_mask       = REGULATOR_MODE_NORMAL
                                        | REGULATOR_MODE_STANDBY,
-               .valid_ops_mask         = REGULATOR_CHANGE_MODE
-                                       | REGULATOR_CHANGE_STATUS,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = &rx51_vsim_supply,
 };
 
-static struct regulator_init_data rx51_vdac = {
+static struct regulator_init_data rx51_vpll2 = {
        .constraints = {
-               .name                   = "VDAC",
+               .name                   = "VSDI_CSI",
+               .min_uV                 = 1800000,
+               .max_uV                 = 1800000,
+               .apply_uV               = true,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vsim = {
+       .constraints = {
+               .name                   = "VMMC2_IO_18",
                .min_uV                 = 1800000,
                .max_uV                 = 1800000,
                .apply_uV               = true,
@@ -531,8 +598,8 @@ static struct regulator_init_data rx51_vdac = {
                .valid_ops_mask         = REGULATOR_CHANGE_MODE
                                        | REGULATOR_CHANGE_STATUS,
        },
-       .num_consumer_supplies  = 1,
-       .consumer_supplies      = rx51_vdac_supply,
+       .num_consumer_supplies  = ARRAY_SIZE(rx51_vsim_supply),
+       .consumer_supplies      = rx51_vsim_supply,
 };
 
 static struct regulator_init_data rx51_vio = {
@@ -549,6 +616,43 @@ static struct regulator_init_data rx51_vio = {
        .consumer_supplies      = rx51_vio_supplies,
 };
 
+static struct regulator_init_data rx51_vintana1 = {
+       .constraints = {
+               .name                   = "VINTANA1",
+               .min_uV                 = 1500000,
+               .max_uV                 = 1500000,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vintana2 = {
+       .constraints = {
+               .name                   = "VINTANA2",
+               .min_uV                 = 2750000,
+               .max_uV                 = 2750000,
+               .apply_uV               = true,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
+static struct regulator_init_data rx51_vintdig = {
+       .constraints = {
+               .name                   = "VINTDIG",
+               .min_uV                 = 1500000,
+               .max_uV                 = 1500000,
+               .always_on              = true,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE,
+       },
+};
+
 static struct si4713_platform_data rx51_si4713_i2c_data __initdata_or_module = {
        .gpio_reset     = RX51_FMTX_RESET_GPIO,
 };
@@ -605,10 +709,6 @@ static struct twl4030_gpio_platform_data rx51_gpio_data = {
        .setup                  = rx51_twlgpio_setup,
 };
 
-static struct twl4030_usb_data rx51_usb_data = {
-       .usb_mode               = T2_USB_MODE_ULPI,
-};
-
 static struct twl4030_ins sleep_on_seq[] __initdata = {
 /*
  * Turn off everything
@@ -770,33 +870,32 @@ static struct twl4030_power_data rx51_t2scripts_data __initdata = {
        .resource_config = twl4030_rconfig,
 };
 
-struct twl4030_codec_vibra_data rx51_vibra_data __initdata = {
+struct twl4030_vibra_data rx51_vibra_data __initdata = {
        .coexist        = 0,
 };
 
-struct twl4030_codec_data rx51_codec_data __initdata = {
+struct twl4030_audio_data rx51_audio_data __initdata = {
        .audio_mclk     = 26000000,
        .vibra          = &rx51_vibra_data,
 };
 
 static struct twl4030_platform_data rx51_twldata __initdata = {
-       .irq_base               = TWL4030_IRQ_BASE,
-       .irq_end                = TWL4030_IRQ_END,
-
        /* platform_data for children goes here */
        .gpio                   = &rx51_gpio_data,
        .keypad                 = &rx51_kp_data,
-       .madc                   = &rx51_madc_data,
-       .usb                    = &rx51_usb_data,
        .power                  = &rx51_t2scripts_data,
-       .codec                  = &rx51_codec_data,
+       .audio                  = &rx51_audio_data,
 
        .vaux1                  = &rx51_vaux1,
        .vaux2                  = &rx51_vaux2,
        .vaux4                  = &rx51_vaux4,
        .vmmc1                  = &rx51_vmmc1,
+       .vpll1                  = &rx51_vpll1,
+       .vpll2                  = &rx51_vpll2,
        .vsim                   = &rx51_vsim,
-       .vdac                   = &rx51_vdac,
+       .vintana1               = &rx51_vintana1,
+       .vintana2               = &rx51_vintana2,
+       .vintdig                = &rx51_vintdig,
        .vio                    = &rx51_vio,
 };
 
@@ -834,6 +933,12 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
                I2C_BOARD_INFO("tsl2563", 0x29),
                .platform_data = &rx51_tsl2563_platform_data,
        },
+#endif
+#if defined(CONFIG_LEDS_LP5523) || defined(CONFIG_LEDS_LP5523_MODULE)
+       {
+               I2C_BOARD_INFO("lp5523", 0x32),
+               .platform_data  = &rx51_lp5523_platform_data,
+       },
 #endif
        {
                I2C_BOARD_INFO("tpa6130a2", 0x60),
@@ -852,6 +957,13 @@ static int __init rx51_i2c_init(void)
                rx51_twldata.vaux3 = &rx51_vaux3_cam;
        }
        rx51_twldata.vmmc2 = &rx51_vmmc2;
+       omap3_pmic_get_config(&rx51_twldata,
+                       TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC,
+                       TWL_COMMON_REGULATOR_VDAC);
+
+       rx51_twldata.vdac->constraints.apply_uV = true;
+       rx51_twldata.vdac->constraints.name = "VDAC";
+
        omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
        omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
                              ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
@@ -978,6 +1090,7 @@ error:
 void __init rx51_peripherals_init(void)
 {
        rx51_i2c_init();
+       regulator_has_full_constraints();
        gpmc_onenand_init(board_onenand_data);
        board_smc91x_init();
        rx51_add_gpio_keys();