regulator: tps65090: Hardcode regulator enable bit
authorSean Paul <seanpaul@chromium.org>
Wed, 8 Aug 2012 00:00:16 +0000 (17:00 -0700)
committerGerrit <chrome-bot@google.com>
Wed, 8 Aug 2012 02:06:38 +0000 (19:06 -0700)
Hardcode the enable bit in the regulator control register instead of
using the offset in tps65090_regulator (since the bit is always the
same).

BUG=None
TEST=Tested on snow, verified regulator enable/disable worked

Change-Id: I2899019f02aae37a5ec03849db588e0839f6eeec
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29534
Reviewed-by: Olof Johansson <olofj@chromium.org>
drivers/regulator/tps65090-regulator.c

index 839539a..17d89e4 100644 (file)
 
 #define MAX_REGULATORS         10
 
+#define CTRL_EN_BIT            0 /* Regulator enable bit, active high */
+
 struct tps65090_regulator {
        /* Regulator register address.*/
        u32             reg_en_reg;
-       u32             en_bit;
 
        /* used by regulator core */
        struct regulator_desc   desc;
@@ -65,7 +66,7 @@ static int tps65090_reg_is_enabled(struct regulator_dev *rdev)
                        ri->reg_en_reg);
                return ret;
        }
-       return (((control >> ri->en_bit) & 1) == 1);
+       return (((control >> CTRL_EN_BIT) & 1) == 1);
 }
 
 static int tps65090_reg_enable(struct regulator_dev *rdev)
@@ -74,7 +75,7 @@ static int tps65090_reg_enable(struct regulator_dev *rdev)
        struct device *parent = to_tps65090_dev(rdev);
        int ret;
 
-       ret = tps65090_set_bits(parent, ri->reg_en_reg, ri->en_bit);
+       ret = tps65090_set_bits(parent, ri->reg_en_reg, CTRL_EN_BIT);
        if (ret < 0)
                dev_err(&rdev->dev, "Error in updating reg 0x%x\n",
                        ri->reg_en_reg);
@@ -87,7 +88,7 @@ static int tps65090_reg_disable(struct regulator_dev *rdev)
        struct device *parent = to_tps65090_dev(rdev);
        int ret;
 
-       ret = tps65090_clr_bits(parent, ri->reg_en_reg, ri->en_bit);
+       ret = tps65090_clr_bits(parent, ri->reg_en_reg, CTRL_EN_BIT);
        if (ret < 0)
                dev_err(&rdev->dev, "Error in updating reg 0x%x\n",
                        ri->reg_en_reg);