regulator: max77620: read property disable on shutdown from machine constraints
Laxman Dewangan [Tue, 7 Apr 2015 12:57:02 +0000 (17:57 +0530)]
Get the regulator property of disabling rail on shutdown from
machine constraints instead of parsing the similar property
inside driver.

bug 1624701

Change-Id: I2bfebcdb8a9d9995ee85019306b8f0ddf9f4d7fd
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit db11b2b41ed3ac520dcd75a00e797e2f227a8212)
Reviewed-on: http://git-master/r/729541

Documentation/devicetree/bindings/mfd/max77620.txt
drivers/regulator/max77620-regulator.c

index bf5ddfa..2cb9953 100644 (file)
@@ -149,7 +149,6 @@ Following are properties of regulator subnode.
                        remote sense on suspend and re-enable on resume.
                        If this property is not there then no change on
                        configuration.
-               maxim,disable-on-shutdown: boolean, Disable rail on shutdown.
 
 Backup Battery:
 ==============
index 3587726..96af82b 100644 (file)
@@ -62,7 +62,6 @@ struct max77620_regulator_pdata {
        bool en2_ctrl_sd0;
        bool sd_fsrade_disable;
        bool disable_remote_sense_on_suspend;
-       bool disable_on_shutdown;
        struct regulator_init_data *reg_idata;
        int fps_src;
        int fps_pd_period;
@@ -751,9 +750,6 @@ static int max77620_get_regulator_dt_data(struct platform_device *pdev,
                                of_property_read_bool(reg_node,
                                "maxim,disable-remote-sense-on-suspend");
 
-               reg_pdata->disable_on_shutdown = of_property_read_bool(reg_node,
-                                               "maxim,disable-on-shutdown");
-
                ret = of_property_read_u32(reg_node, "maxim,fps-source", &prop);
                if (!ret)
                        reg_pdata->fps_src = prop;
@@ -833,11 +829,13 @@ static int max77620_regulator_probe(struct platform_device *pdev)
 static void max77620_regulator_shutdown(struct platform_device *pdev)
 {
        struct max77620_regulator *pmic = platform_get_drvdata(pdev);
+       struct regulator_init_data *ridata;
        int id;
        int ret;
 
        for (id = 0; id < MAX77620_NUM_REGS; ++id) {
-               if (pmic->reg_pdata[id].disable_on_shutdown &&
+               ridata = pmic->reg_pdata[id].reg_idata;
+               if (ridata->constraints.disable_on_shutdown &&
                        max77620_regulator_is_enabled(pmic->rdev[id])) {
                        dev_info(&pdev->dev, "Disabling Regulator %d\n", id);
                        ret = max77620_regulator_disable(pmic->rdev[id]);