]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/regulator/tps51632-regulator.c
Merge tag 'for-v3.8' of git://git.infradead.org/users/cbou/linux-pstore
[karo-tx-linux.git] / drivers / regulator / tps51632-regulator.c
index 7c4e8a6e1d5da1f6eb37c4fe8301099eadf46386..ab21133e6784dc43d5990de54427b4a64db9ca52 100644 (file)
@@ -151,7 +151,7 @@ static struct regulator_ops tps51632_dcdc_ops = {
        .set_ramp_delay         = tps51632_dcdc_set_ramp_delay,
 };
 
-static int __devinit tps51632_init_dcdc(struct tps51632_chip *tps,
+static int tps51632_init_dcdc(struct tps51632_chip *tps,
                struct tps51632_regulator_platform_data *pdata)
 {
        int ret;
@@ -221,7 +221,7 @@ static const struct regmap_config tps51632_regmap_config = {
        .cache_type             = REGCACHE_RBTREE,
 };
 
-static int __devinit tps51632_probe(struct i2c_client *client,
+static int tps51632_probe(struct i2c_client *client,
                                const struct i2c_device_id *id)
 {
        struct tps51632_regulator_platform_data *pdata;
@@ -236,6 +236,21 @@ static int __devinit tps51632_probe(struct i2c_client *client,
                return -EINVAL;
        }
 
+       if (pdata->enable_pwm_dvfs) {
+               if ((pdata->base_voltage_uV < TPS51632_MIN_VOLATGE) ||
+                   (pdata->base_voltage_uV > TPS51632_MAX_VOLATGE)) {
+                       dev_err(&client->dev, "Invalid base_voltage_uV setting\n");
+                       return -EINVAL;
+               }
+
+               if ((pdata->max_voltage_uV) &&
+                   ((pdata->max_voltage_uV < TPS51632_MIN_VOLATGE) ||
+                    (pdata->max_voltage_uV > TPS51632_MAX_VOLATGE))) {
+                       dev_err(&client->dev, "Invalid max_voltage_uV setting\n");
+                       return -EINVAL;
+               }
+       }
+
        tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
        if (!tps) {
                dev_err(&client->dev, "Memory allocation failed\n");
@@ -285,7 +300,7 @@ static int __devinit tps51632_probe(struct i2c_client *client,
        return 0;
 }
 
-static int __devexit tps51632_remove(struct i2c_client *client)
+static int tps51632_remove(struct i2c_client *client)
 {
        struct tps51632_chip *tps = i2c_get_clientdata(client);
 
@@ -306,7 +321,7 @@ static struct i2c_driver tps51632_i2c_driver = {
                .owner = THIS_MODULE,
        },
        .probe = tps51632_probe,
-       .remove = __devexit_p(tps51632_remove),
+       .remove = tps51632_remove,
        .id_table = tps51632_id,
 };