regulator: Enable max8925 i2c sequence for control
authorHaojian Zhuang <haojian.zhuang@marvell.com>
Mon, 18 Apr 2011 14:04:09 +0000 (22:04 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 26 May 2011 17:45:33 +0000 (19:45 +0200)
Force to enable i2c as power up/down sequence. Otherwise, SD/LDO can't
be enabled or disabled via accessing i2c bus.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/regulator/max8925-regulator.c

index 8ae147549c6aabb2c65b9fd60f8aec8bb6f67a26..e4dbd667c043577b2cfe250df38fbbdcf3869eb1 100644 (file)
 #define SD1_DVM_SHIFT          5               /* SDCTL1 bit5 */
 #define SD1_DVM_EN             6               /* SDV1 bit 6 */
 
+/* bit definitions in SD & LDO control registers */
+#define OUT_ENABLE             0x1f            /* Power U/D sequence as I2C */
+#define OUT_DISABLE            0x1e            /* Power U/D sequence as I2C */
+
 struct max8925_regulator_info {
        struct regulator_desc   desc;
        struct regulator_dev    *regulator;
@@ -93,8 +97,8 @@ static int max8925_enable(struct regulator_dev *rdev)
        struct max8925_regulator_info *info = rdev_get_drvdata(rdev);
 
        return max8925_set_bits(info->i2c, info->enable_reg,
-                               1 << info->enable_bit,
-                               1 << info->enable_bit);
+                               OUT_ENABLE << info->enable_bit,
+                               OUT_ENABLE << info->enable_bit);
 }
 
 static int max8925_disable(struct regulator_dev *rdev)
@@ -102,7 +106,8 @@ static int max8925_disable(struct regulator_dev *rdev)
        struct max8925_regulator_info *info = rdev_get_drvdata(rdev);
 
        return max8925_set_bits(info->i2c, info->enable_reg,
-                               1 << info->enable_bit, 0);
+                               OUT_ENABLE << info->enable_bit,
+                               OUT_DISABLE << info->enable_bit);
 }
 
 static int max8925_is_enabled(struct regulator_dev *rdev)