regulator: palmas: set roof floor after registering regulator
Laxman Dewangan [Mon, 15 Apr 2013 11:55:30 +0000 (16:55 +0530)]
Initailize the roof floor of rails after registering regulators
to make sure the rails are configured properly as per regulator
init data.

bug 1267800
bug 1267804

Change-Id: Ia623030083cf1dda823873fe6ec7458899f2ff86
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/218881
Reviewed-by: Automatic_Commit_Validation_User

drivers/regulator/palmas-regulator.c

index b83b3bc..c55c279 100644 (file)
@@ -1345,6 +1345,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
        for (id = 0; id < PALMAS_REG_LDO1; id++) {
                bool ramp_delay_support = false;
 
+               reg_init = NULL;
                reg_data = pdata->reg_data[id];
 
                /*
@@ -1413,10 +1414,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
                pmic->desc[id].owner = THIS_MODULE;
 
                /* Initialise sleep/init values from platform data */
-               if (pdata && pdata->reg_init) {
+               if (pdata && reg_data && pdata->reg_init) {
                        reg_init = pdata->reg_init[id];
                        if (reg_init) {
-                               pmic->roof_floor[id] = reg_init->roof_floor;
                                ret = palmas_smps_init(palmas, id, reg_init);
                                if (ret)
                                        goto err_unregister_regulator;
@@ -1458,6 +1458,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
                        goto err_unregister_regulator;
                }
 
+               if (reg_init && reg_data)
+                       pmic->roof_floor[id] = reg_init->roof_floor;
+
                /* Save regulator for cleanup */
                pmic->rdev[id] = rdev;
        }
@@ -1503,7 +1506,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
                pmic->rdev[id] = rdev;
 
                /* Initialise sleep/init values from platform data */
-               if (pdata->reg_init) {
+               if (reg_data && pdata->reg_init) {
                        reg_init = pdata->reg_init[id];
                        if (reg_init) {
                                pmic->roof_floor[id] = reg_init->roof_floor;