regulator: tps6591x: Added LDO4 tracking support
Sumit Sharma [Mon, 10 Sep 2012 07:15:19 +0000 (12:15 +0530)]
Bug 1043041

Included LDO4 tracking support in tps6591x regulator
by adding config flag in LDO4 initialization

Change-Id: Ia549d566e8fdb3192d509c1a175d3021b0aba3ad
signed-off-by: Sumit Sharma <sumsharma@nvidia.com>
Reviewed-on: http://git-master/r/131003
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/regulator/tps6591x-regulator.c
include/linux/regulator/tps6591x-regulator.h

index 1b60b9c..9602e8a 100644 (file)
 #define TPS6591X_EN1_SMPS_ADD          0x46
 #define TPS6591X_EN2_LDO_ADD           0x47
 #define TPS6591X_EN2_SMPS_ADD          0x48
+#define TPS6591X_DCDCCTRL_ADD          0x3E
 #define TPS6591X_INVALID_ADD           0xFF
 
 #define EN1_EN2_OFFSET                 2
+#define LDO4_TRACK_VAL                 0x40
 
 struct tps6591x_register_info {
        unsigned char addr;
@@ -718,6 +720,18 @@ static inline int tps6591x_regulator_preinit(struct device *parent,
        if (!tps6591x_pdata->init_apply)
                return 0;
 
+       if (ri->desc.id == TPS6591X_ID_LDO_4 &&
+               (tps6591x_pdata->flags & LDO4_TRACKING_EN)) {
+               ret = tps6591x_read(parent, TPS6591X_DCDCCTRL_ADD,
+                                               &reg_val);
+               if (ret < 0)
+                       pr_err("Not able to configure tracking mode for"
+                       " %d err %d\n", ri->desc.id, ret);
+               else
+                       tps6591x_write(parent, TPS6591X_DCDCCTRL_ADD,
+                                       reg_val|LDO4_TRACK_VAL);
+       }
+
        if (tps6591x_pdata->init_uV >= 0) {
                switch (ri->desc.id) {
                case TPS6591X_ID_VIO:
@@ -818,7 +832,7 @@ static int __devinit tps6591x_regulator_probe(struct platform_device *pdev)
        int id = pdev->id;
        int err;
 
-       dev_dbg(&pdev->dev, "Probing reulator %d\n", id);
+       dev_dbg(&pdev->dev, "Probing regulator %d\n", id);
 
        ri = find_regulator_info(id);
        if (ri == NULL) {
index 7f7f647..b749bd7 100644 (file)
@@ -52,6 +52,7 @@ enum tps6591x_ext_control {
 
 enum tps6591x_config_flags {
        LDO_LOW_POWER_ON_SUSPEND = 0x1,
+       LDO4_TRACKING_EN = 0x2,
 };
 
 /*