regulator: tps65090: align driver with mainline
Laxman Dewangan [Thu, 4 Jul 2013 12:50:24 +0000 (17:50 +0530)]
Aligning the tps65090 regulator driver with mainline driver
with keeping additional feature like setting of wait time of FETs.

bug 1242876

Resubmitting change http://git-master/r/243422 whic was reverted due
to sanity failure due to other change.

Change-Id: I90d974ad3fc862096f0748450c2ff6a94a3797c3
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/253253
Reviewed-by: Automatic_Commit_Validation_User

arch/arm/mach-tegra/board-dalmore-power.c
drivers/regulator/tps65090-regulator.c

index 2fb0e39..c5cc4ec 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/mfd/palmas.h>
 #include <linux/mfd/tps65090.h>
 #include <linux/regulator/max77663-regulator.h>
+#include <linux/regulator/tps51632-regulator.h>
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/regulator/userspace-consumer.h>
@@ -123,8 +124,7 @@ static struct regulator_consumer_supply tps65090_fet7_supply[] = {
        REGULATOR_SUPPLY("avdd", "bluedroid_pm.0"),
 };
 
-#define tps65090_rails(_name) "tps65090_"#_name
-
+#define tps65090_rails(id) "tps65090-"#id
 #define TPS65090_PDATA_INIT(_id, _name, _supply_reg,                   \
        _always_on, _boot_on, _apply_uV, _en_ext_ctrl, _gpio, _wait_to) \
 static struct regulator_init_data ri_data_##_name =                    \
@@ -166,27 +166,28 @@ TPS65090_PDATA_INIT(FET5, fet5, tps65090_rails(DCDC2), 0, 0, 0, false, -1, 0);
 TPS65090_PDATA_INIT(FET6, fet6, tps65090_rails(DCDC2), 0, 0, 0, false, -1, 0);
 TPS65090_PDATA_INIT(FET7, fet7, tps65090_rails(DCDC2), 0, 0, 0, false, -1, 0);
 
-#define ADD_TPS65090_REG(_name) (&tps65090_regulator_pdata_##_name)
 static struct tps65090_charger_data bcharger_pdata = {
        .irq_base = TPS65090_TEGRA_IRQ_BASE,
        .update_status = sbs_update,
 };
 
+#define ADD_TPS65090_REG(_name) (&tps65090_regulator_pdata_##_name)
 static struct tps65090_platform_data tps65090_pdata = {
        .irq_base = TPS65090_TEGRA_IRQ_BASE,
        .reg_pdata = {
-               ADD_TPS65090_REG(dcdc1),
-               ADD_TPS65090_REG(dcdc2),
-               ADD_TPS65090_REG(dcdc3),
-               ADD_TPS65090_REG(ldo1),
-               ADD_TPS65090_REG(ldo2),
-               ADD_TPS65090_REG(fet1),
-               ADD_TPS65090_REG(fet3),
-               ADD_TPS65090_REG(fet4),
-               ADD_TPS65090_REG(fet5),
-               ADD_TPS65090_REG(fet6),
-               ADD_TPS65090_REG(fet7),
-       },
+                       ADD_TPS65090_REG(dcdc1),
+                       ADD_TPS65090_REG(dcdc2),
+                       ADD_TPS65090_REG(dcdc3),
+                       ADD_TPS65090_REG(fet1),
+                       NULL,
+                       ADD_TPS65090_REG(fet3),
+                       ADD_TPS65090_REG(fet4),
+                       ADD_TPS65090_REG(fet5),
+                       ADD_TPS65090_REG(fet6),
+                       ADD_TPS65090_REG(fet7),
+                       ADD_TPS65090_REG(ldo1),
+                       ADD_TPS65090_REG(ldo2),
+               },
        .charger_pdata = &bcharger_pdata,
 };
 
index b971ada..8e43101 100644 (file)
@@ -41,6 +41,18 @@ static inline struct device *to_tps65090_dev(struct regulator_dev *rdev)
        return rdev_get_dev(rdev)->parent;
 }
 
+static inline bool is_dcdc(int id)
+{
+       switch (id) {
+       case TPS65090_REGULATOR_DCDC1:
+       case TPS65090_REGULATOR_DCDC2:
+       case TPS65090_REGULATOR_DCDC3:
+               return true;
+       default:
+               return false;
+       }
+}
+
 static int tps65090_reg_enable(struct regulator_dev *rdev)
 {
        struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
@@ -71,57 +83,6 @@ static int tps65090_reg_enable(struct regulator_dev *rdev)
        return regulator_enable_regmap(rdev);
 }
 
-static struct regulator_ops tps65090_ext_control_ops = {
-};
-
-static struct regulator_ops tps65090_reg_contol_ops = {
-       .enable         = tps65090_reg_enable,
-       .disable        = regulator_disable_regmap,
-       .is_enabled     = regulator_is_enabled_regmap,
-};
-
-static struct regulator_ops tps65090_ldo_ops = {
-};
-
-#define tps65090_REG_DESC(_id, _sname, _en_reg, _ops)  \
-{                                                      \
-       .name = "TPS65090_RAILS"#_id,                   \
-       .supply_name = _sname,                          \
-       .id = TPS65090_REGULATOR_##_id,                 \
-       .ops = &_ops,                                   \
-       .enable_reg = _en_reg,                          \
-       .enable_mask = BIT(0),                          \
-       .type = REGULATOR_VOLTAGE,                      \
-       .owner = THIS_MODULE,                           \
-}
-
-static struct regulator_desc tps65090_regulator_desc[] = {
-       tps65090_REG_DESC(DCDC1, "vsys1",   0x0C, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(DCDC2, "vsys2",   0x0D, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(DCDC3, "vsys3",   0x0E, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET1,  "infet1",  0x0F, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET2,  "infet2",  0x10, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET3,  "infet3",  0x11, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET4,  "infet4",  0x12, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET5,  "infet5",  0x13, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET6,  "infet6",  0x14, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(FET7,  "infet7",  0x15, tps65090_reg_contol_ops),
-       tps65090_REG_DESC(LDO1,  "vsys-l1", 0,    tps65090_ldo_ops),
-       tps65090_REG_DESC(LDO2,  "vsys-l2", 0,    tps65090_ldo_ops),
-};
-
-static inline bool is_dcdc(int id)
-{
-       switch (id) {
-       case TPS65090_REGULATOR_DCDC1:
-       case TPS65090_REGULATOR_DCDC2:
-       case TPS65090_REGULATOR_DCDC3:
-               return true;
-       default:
-               return false;
-       }
-}
-
 static int tps65090_config_ext_control(
        struct tps65090_regulator *ri, bool enable)
 {
@@ -142,7 +103,7 @@ static int tps65090_regulator_disable_ext_control(
                struct tps65090_regulator *ri,
                struct tps65090_regulator_plat_data *tps_pdata)
 {
-       int ret = 0;
+       int ret;
        struct device *parent = ri->dev->parent;
        unsigned int reg_en_reg = ri->desc->enable_reg;
 
@@ -177,6 +138,45 @@ static void tps65090_configure_regulator_config(
        }
 }
 
+static struct regulator_ops tps65090_ext_control_ops = {
+};
+
+static struct regulator_ops tps65090_reg_contol_ops = {
+       .enable         = tps65090_reg_enable,
+       .disable        = regulator_disable_regmap,
+       .is_enabled     = regulator_is_enabled_regmap,
+};
+
+static struct regulator_ops tps65090_ldo_ops = {
+};
+
+#define tps65090_REG_DESC(_id, _sname, _en_reg, _ops)  \
+{                                                      \
+       .name = "TPS65090-RAILS-"#_id,                  \
+       .supply_name = _sname,                          \
+       .id = TPS65090_REGULATOR_##_id,                 \
+       .ops = &_ops,                                   \
+       .enable_reg = _en_reg,                          \
+       .enable_mask = BIT(0),                          \
+       .type = REGULATOR_VOLTAGE,                      \
+       .owner = THIS_MODULE,                           \
+}
+
+static struct regulator_desc tps65090_regulator_desc[] = {
+       tps65090_REG_DESC(DCDC1, "vsys1",   0x0C, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(DCDC2, "vsys2",   0x0D, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(DCDC3, "vsys3",   0x0E, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET1,  "infet1",  0x0F, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET2,  "infet2",  0x10, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET3,  "infet3",  0x11, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET4,  "infet4",  0x12, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET5,  "infet5",  0x13, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET6,  "infet6",  0x14, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(FET7,  "infet7",  0x15, tps65090_reg_contol_ops),
+       tps65090_REG_DESC(LDO1,  "vsys-l1", 0,    tps65090_ldo_ops),
+       tps65090_REG_DESC(LDO2,  "vsys-l2", 0,    tps65090_ldo_ops),
+};
+
 #ifdef CONFIG_OF
 static struct of_regulator_match tps65090_matches[] = {
        { .name = "dcdc1", },