regulator: Add support for tps62362 and tps62363 in tps62360-regulator driver
Axel Lin [Mon, 2 Apr 2012 10:19:28 +0000 (18:19 +0800)]
According to the datasheet[1], tps62360 is register compatible with tps62362.
tps62361B is register compatible with tps62363.
Thus this patch adds support for tps62362 and tps62363.

[1] http://www.ti.com/litv/pdf/slvsau9b

Change-Id: I62cdede0755d7decedeb7b1ef08e216a0dad3a12
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
(Cherry-picked from mainline commit d1cf4f6)

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Change-Id: Ib9c4a63f06182c0ed2c1f27d9bf63342aa8474bc
Reviewed-on: http://git-master/r/105827
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/regulator/tps62360-regulator.c

index a20a829..e8c883c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * tps62360.c -- TI tps62360
  *
- * Driver for processor core supply tps62360 and tps62361B
+ * Driver for processor core supply tps62360, tps62361B, tps62362 and tps62363.
  *
  * Copyright (c) 2012, NVIDIA Corporation.
  *
@@ -46,7 +46,7 @@
 #define REG_RAMPCTRL           6
 #define REG_CHIPID             8
 
-enum chips {TPS62360, TPS62361};
+enum chips {TPS62360, TPS62361, TPS62362, TPS62363};
 
 #define TPS62360_BASE_VOLTAGE  770
 #define TPS62360_N_VOLTAGES    64
@@ -296,14 +296,26 @@ static int __devinit tps62360_probe(struct i2c_client *client,
        tps->vsel0_gpio = pdata->vsel0_gpio;
        tps->vsel1_gpio = pdata->vsel1_gpio;
        tps->dev = &client->dev;
-       tps->voltage_base = (id->driver_data == TPS62360) ?
-                               TPS62360_BASE_VOLTAGE : TPS62361_BASE_VOLTAGE;
-       tps->voltage_reg_mask = (id->driver_data == TPS62360) ? 0x3F : 0x7F;
+
+       switch (id->driver_data) {
+       case TPS62360:
+       case TPS62362:
+               tps->voltage_base = TPS62360_BASE_VOLTAGE;
+               tps->voltage_reg_mask = 0x3F;
+               tps->desc.n_voltages = TPS62360_N_VOLTAGES;
+               break;
+       case TPS62361:
+       case TPS62363:
+               tps->voltage_base = TPS62361_BASE_VOLTAGE;
+               tps->voltage_reg_mask = 0x7F;
+               tps->desc.n_voltages = TPS62361_N_VOLTAGES;
+               break;
+       default:
+               return -ENODEV;
+       }
 
        tps->desc.name = id->name;
        tps->desc.id = 0;
-       tps->desc.n_voltages = (id->driver_data == TPS62360) ?
-                               TPS62360_N_VOLTAGES : TPS62361_N_VOLTAGES;
        tps->desc.ops = &tps62360_dcdc_ops;
        tps->desc.type = REGULATOR_VOLTAGE;
        tps->desc.owner = THIS_MODULE;
@@ -435,6 +447,8 @@ static void tps62360_shutdown(struct i2c_client *client)
 static const struct i2c_device_id tps62360_id[] = {
        {.name = "tps62360", .driver_data = TPS62360},
        {.name = "tps62361", .driver_data = TPS62361},
+       {.name = "tps62362", .driver_data = TPS62362},
+       {.name = "tps62363", .driver_data = TPS62363},
        {},
 };
 
@@ -464,5 +478,5 @@ static void __exit tps62360_cleanup(void)
 module_exit(tps62360_cleanup);
 
 MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
-MODULE_DESCRIPTION("TPS62360 voltage regulator driver");
+MODULE_DESCRIPTION("TPS6236x voltage regulator driver");
 MODULE_LICENSE("GPL v2");