ARM: tegra: dalmore/pluto: fix palmas init
Pradeep Goudagunta [Fri, 12 Oct 2012 08:46:19 +0000 (13:46 +0530)]
Fix palmas platform data initialization.

Reviewed-on: http://git-master/r/144026
(cherry picked from commit df44ead1c39ca281f87f4242d10512cb39e14203)

Conflicts:

arch/arm/mach-tegra/board-dalmore-power.c

Change-Id: I9fecaab84dac6e90e3a159f5eca0b7dc5c13b6f8
Signed-off-by: Pradeep Goudagunta <pgoudagunta@nvidia.com>
Reviewed-on: http://git-master/r/145891
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>

Rebase-Id: R2e53a80148d346713dfc217caf68b454262f5450

arch/arm/mach-tegra/board-dalmore-power.c
arch/arm/mach-tegra/board-pluto-power.c

index 0c68fe0..bfceeff 100644 (file)
@@ -672,7 +672,7 @@ PALMAS_PDATA_INIT(ldousb, 3300,  3300, tps65090_rails(DCDC1), 0, 0, 1);
 
 #define PALMAS_REG_PDATA(_sname) &reg_idata_##_sname
 
-static struct regulator_init_data *dalmore_e1611_reg_data[] = {
+static struct regulator_init_data *dalmore_e1611_reg_data[PALMAS_NUM_REGS] = {
        PALMAS_REG_PDATA(smps12),
        NULL,
        PALMAS_REG_PDATA(smps3),
@@ -739,7 +739,7 @@ PALMAS_REG_INIT(sysen1, 0, 0, 0, 0, 0);
 PALMAS_REG_INIT(sysen2, 0, 0, 0, 0, 0);
 
 #define PALMAS_REG_INIT_DATA(_sname) &reg_init_data_##_sname
-static struct palmas_reg_init *dalmore_e1611_reg_init[] = {
+static struct palmas_reg_init *dalmore_e1611_reg_init[PALMAS_NUM_REGS] = {
        PALMAS_REG_INIT_DATA(smps12),
        PALMAS_REG_INIT_DATA(smps123),
        PALMAS_REG_INIT_DATA(smps3),
@@ -769,8 +769,6 @@ static struct palmas_reg_init *dalmore_e1611_reg_init[] = {
 };
 
 static struct palmas_pmic_platform_data pmic_platform = {
-       .reg_data = dalmore_e1611_reg_data,
-       .reg_init = dalmore_e1611_reg_init,
        .enable_ldo8_tracking = true,
 };
 
@@ -939,6 +937,7 @@ int __init dalmore_palmas_regulator_init(void)
 {
        void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
        u32 pmc_ctrl;
+       int i;
 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
        int ret;
 
@@ -955,6 +954,11 @@ int __init dalmore_palmas_regulator_init(void)
         */
        pmc_ctrl = readl(pmc + PMC_CTRL);
        writel(pmc_ctrl | PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);
+       for (i = 0; i < PALMAS_NUM_REGS ; i++) {
+               pmic_platform.reg_data[i] = dalmore_e1611_reg_data[i];
+               pmic_platform.reg_init[i] = dalmore_e1611_reg_init[i];
+       }
+
        i2c_register_board_info(4, palma_device,
                        ARRAY_SIZE(palma_device));
        return 0;
index 50d38c1..a2718fc 100644 (file)
@@ -243,7 +243,7 @@ PALMAS_PDATA_INIT(regen2, 4300,  4300, palmas_rails(smps8), 0, 0, 0);
 
 #define PALMAS_REG_PDATA(_sname) &reg_idata_##_sname
 
-static struct regulator_init_data *pluto_reg_data[] = {
+static struct regulator_init_data *pluto_reg_data[PALMAS_NUM_REGS] = {
        NULL,
        PALMAS_REG_PDATA(smps123),
        NULL,
@@ -305,7 +305,7 @@ PALMAS_REG_INIT(ldoln, 0, 0, 0, 0, 0);
 PALMAS_REG_INIT(ldousb, 0, 0, 0, 0, 0);
 
 #define PALMAS_REG_INIT_DATA(_sname) &reg_init_data_##_sname
-static struct palmas_reg_init *pluto_reg_init[] = {
+static struct palmas_reg_init *pluto_reg_init[PALMAS_NUM_REGS] = {
        PALMAS_REG_INIT_DATA(smps12),
        PALMAS_REG_INIT_DATA(smps123),
        PALMAS_REG_INIT_DATA(smps3),
@@ -529,8 +529,6 @@ static struct platform_device *pfixed_reg_devs[] = {
 };
 
 static struct palmas_pmic_platform_data pmic_platform = {
-       .reg_data = pluto_reg_data,
-       .reg_init = pluto_reg_init,
        .enable_ldo8_tracking = true,
 };
 
@@ -568,6 +566,7 @@ int __init pluto_regulator_init(void)
 {
        void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
        u32 pmc_ctrl;
+       int i;
 
        /* TPS65913: Normal state of INT request line is LOW.
         * configure the power management controller to trigger PMU
@@ -576,6 +575,11 @@ int __init pluto_regulator_init(void)
        pmc_ctrl = readl(pmc + PMC_CTRL);
        writel(pmc_ctrl & ~PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);
 
+       for (i = 0; i < PALMAS_NUM_REGS ; i++) {
+               pmic_platform.reg_data[i] = pluto_reg_data[i];
+               pmic_platform.reg_init[i] = pluto_reg_init[i];
+       }
+
        platform_device_register(&pluto_pda_power_device);
        i2c_register_board_info(4, palma_device,
                        ARRAY_SIZE(palma_device));