pandora: add internal 5v and expansion supplies
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 22 May 2016 22:08:53 +0000 (01:08 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 3 Jul 2016 00:23:25 +0000 (03:23 +0300)
Those used to be always-on and not managed by the kernel,
now they will be.

arch/arm/mach-omap2/board-omap3pandora.c

index 6d22101..b9ac6b7 100644 (file)
@@ -429,12 +429,18 @@ static struct regulator_consumer_supply pandora_vdds_supplies[] = {
 
 static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
        REGULATOR_SUPPLY("vcc", "display0"),
+       /* on non-CC units only, must be last */
+       REGULATOR_SUPPLY("vdd", "display0"),
 };
 
 static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
        REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
 };
 
+static struct regulator_consumer_supply pandora_exp_supply[] = {
+       REGULATOR_SUPPLY("exp", NULL),
+};
+
 /* ads7846 on SPI and 2 nub controllers on I2C */
 static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
        REGULATOR_SUPPLY("vcc", "spi1.0"),
@@ -447,6 +453,13 @@ static struct regulator_consumer_supply pandora_adac_supply[] = {
        REGULATOR_SUPPLY("lidsw", NULL),
 };
 
+static struct regulator_consumer_supply pandora_5v_supplies[] = {
+       REGULATOR_SUPPLY("v5v_force", NULL),
+       REGULATOR_SUPPLY("vdd_amp", "soc-audio"),
+       REGULATOR_SUPPLY("hsusb1_vbus", "ehci-omap.0"),
+       REGULATOR_SUPPLY("vdd", "display0"), /* on CC units, must be last */
+};
+
 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
 static struct regulator_init_data pandora_vmmc1 = {
        .constraints = {
@@ -507,6 +520,21 @@ static struct regulator_init_data pandora_vaux2 = {
        .consumer_supplies      = pandora_usb_phy_supply,
 };
 
+/* VAUX3 goes to the expansion port */
+static struct regulator_init_data pandora_vaux3 = {
+       .constraints = {
+               .min_uV                 = 1500000,
+               .max_uV                 = 3000000,
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
+                                       | REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+       .num_consumer_supplies  = ARRAY_SIZE(pandora_exp_supply),
+       .consumer_supplies      = pandora_exp_supply,
+};
+
 /* VAUX4 for ads7846 and nubs */
 static struct regulator_init_data pandora_vaux4 = {
        .constraints = {
@@ -537,6 +565,40 @@ static struct regulator_init_data pandora_vsim = {
        .consumer_supplies      = pandora_adac_supply,
 };
 
+/* REGEN enables the 5V supply */
+static struct regulator_init_data pandora_regen = {
+       .constraints = {
+               .valid_modes_mask       = REGULATOR_MODE_NORMAL
+                                       | REGULATOR_MODE_STANDBY,
+               .valid_ops_mask         = REGULATOR_CHANGE_MODE
+                                       | REGULATOR_CHANGE_STATUS,
+       },
+};
+
+/* 5V supply that feeds EHCI VBUS, audio amp, and (on CC only) the LCD */
+static struct regulator_init_data pandora_v5v_data = {
+       .supply_regulator       = "REGEN",
+       .num_consumer_supplies  = ARRAY_SIZE(pandora_5v_supplies),
+       .consumer_supplies      = pandora_5v_supplies,
+};
+
+static struct fixed_voltage_config pandora_v5v = {
+       .supply_name            = "v5v",
+       .microvolts             = 5000000,
+       .gpio                   = -EINVAL,
+       .startup_delay          = 5000, /* just a guess */
+       .enabled_at_boot        = 1,
+       .init_data              = &pandora_v5v_data,
+};
+
+static struct platform_device pandora_v5v_device = {
+       .name           = "reg-fixed-voltage",
+       .id             = 0,
+       .dev = {
+               .platform_data = &pandora_v5v,
+       },
+};
+
 /* Fixed regulator internal to Wifi module */
 static struct regulator_init_data pandora_vmmc3 = {
        .constraints = {
@@ -624,11 +686,15 @@ static struct twl4030_platform_data omap3pandora_twldata = {
        .vmmc2          = &pandora_vmmc2,
        .vaux1          = &pandora_vaux1,
        .vaux2          = &pandora_vaux2,
+       .vaux3          = &pandora_vaux3,
        .vaux4          = &pandora_vaux4,
        .vsim           = &pandora_vsim,
+       .regen          = &pandora_regen,
        .keypad         = &pandora_kp_data,
        .bci            = &pandora_bci_data,
        .power          = &pandora_power_data,
+
+       .dep_device     = &pandora_v5v_device,
 };
 
 static struct vsense_platform_data omap3pandora_nub1_data = {
@@ -669,6 +735,12 @@ static int __init omap3pandora_i2c_init(void)
                                        ARRAY_SIZE(pandora_vdds_supplies);
        omap3pandora_twldata.vpll2->consumer_supplies = pandora_vdds_supplies;
 
+       /* LCD vdd is connected differently on CC */
+       if (cpu_is_omap3630() || omap_rev() >= OMAP3430_REV_ES3_0)
+               pandora_v5v_data.num_consumer_supplies--;
+       else
+               pandora_vaux1.num_consumer_supplies--;
+
        omap3_pmic_init("tps65950", &omap3pandora_twldata);
        /* i2c2 pins are not connected */
        omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,