regulator: pbias: Fix broken pbias disable functionality
authorKishon Vijay Abraham I <kishon@ti.com>
Mon, 27 Jul 2015 11:24:10 +0000 (16:54 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 14 Aug 2015 18:01:58 +0000 (19:01 +0100)
regulator_disable of pbias always writes '0' to the enable_reg.
However actual disable value of pbias regulator is not always '0'.
Fix it by populating the disable_val in pbias_reg_info for the
various platforms and assign it to the disable_val of
pbias regulator descriptor. This will be used by
regulator_disable_regmap while disabling pbias regulator.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org>
drivers/regulator/pbias-regulator.c

index bd2b75c0d1d1201663cc29fd2b26100de3671459..4fa7bcaf454e85e9c4d239c5b6214e340f873c19 100644 (file)
@@ -30,6 +30,7 @@
 struct pbias_reg_info {
        u32 enable;
        u32 enable_mask;
+       u32 disable_val;
        u32 vmode;
        unsigned int enable_time;
        char *name;
@@ -62,6 +63,7 @@ static const struct pbias_reg_info pbias_mmc_omap2430 = {
        .enable = BIT(1),
        .enable_mask = BIT(1),
        .vmode = BIT(0),
+       .disable_val = 0,
        .enable_time = 100,
        .name = "pbias_mmc_omap2430"
 };
@@ -77,6 +79,7 @@ static const struct pbias_reg_info pbias_sim_omap3 = {
 static const struct pbias_reg_info pbias_mmc_omap4 = {
        .enable = BIT(26) | BIT(22),
        .enable_mask = BIT(26) | BIT(25) | BIT(22),
+       .disable_val = BIT(25),
        .vmode = BIT(21),
        .enable_time = 100,
        .name = "pbias_mmc_omap4"
@@ -85,6 +88,7 @@ static const struct pbias_reg_info pbias_mmc_omap4 = {
 static const struct pbias_reg_info pbias_mmc_omap5 = {
        .enable = BIT(27) | BIT(26),
        .enable_mask = BIT(27) | BIT(25) | BIT(26),
+       .disable_val = BIT(25),
        .vmode = BIT(21),
        .enable_time = 100,
        .name = "pbias_mmc_omap5"
@@ -159,6 +163,7 @@ static int pbias_regulator_probe(struct platform_device *pdev)
                drvdata[data_idx].desc.enable_reg = res->start;
                drvdata[data_idx].desc.enable_mask = info->enable_mask;
                drvdata[data_idx].desc.enable_val = info->enable;
+               drvdata[data_idx].desc.disable_val = info->disable_val;
 
                cfg.init_data = pbias_matches[idx].init_data;
                cfg.driver_data = &drvdata[data_idx];