|
@@ -221,7 +221,8 @@ static const struct of_device_id tps51632_of_match[] = {
|
|
|
MODULE_DEVICE_TABLE(of, tps51632_of_match);
|
|
|
|
|
|
static struct tps51632_regulator_platform_data *
|
|
|
- of_get_tps51632_platform_data(struct device *dev)
|
|
|
+ of_get_tps51632_platform_data(struct device *dev,
|
|
|
+ const struct regulator_desc *desc)
|
|
|
{
|
|
|
struct tps51632_regulator_platform_data *pdata;
|
|
|
struct device_node *np = dev->of_node;
|
|
@@ -230,7 +231,8 @@ static struct tps51632_regulator_platform_data *
|
|
|
if (!pdata)
|
|
|
return NULL;
|
|
|
|
|
|
- pdata->reg_init_data = of_get_regulator_init_data(dev, dev->of_node);
|
|
|
+ pdata->reg_init_data = of_get_regulator_init_data(dev, dev->of_node,
|
|
|
+ desc);
|
|
|
if (!pdata->reg_init_data) {
|
|
|
dev_err(dev, "Not able to get OF regulator init data\n");
|
|
|
return NULL;
|
|
@@ -248,7 +250,8 @@ static struct tps51632_regulator_platform_data *
|
|
|
}
|
|
|
#else
|
|
|
static struct tps51632_regulator_platform_data *
|
|
|
- of_get_tps51632_platform_data(struct device *dev)
|
|
|
+ of_get_tps51632_platform_data(struct device *dev,
|
|
|
+ const struct regulator_desc *desc)
|
|
|
{
|
|
|
return NULL;
|
|
|
}
|
|
@@ -273,9 +276,25 @@ static int tps51632_probe(struct i2c_client *client,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
|
|
|
+ if (!tps)
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
+ tps->dev = &client->dev;
|
|
|
+ tps->desc.name = client->name;
|
|
|
+ tps->desc.id = 0;
|
|
|
+ tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
|
|
|
+ tps->desc.min_uV = TPS51632_MIN_VOLTAGE;
|
|
|
+ tps->desc.uV_step = TPS51632_VOLTAGE_STEP_10mV;
|
|
|
+ tps->desc.linear_min_sel = TPS51632_MIN_VSEL;
|
|
|
+ tps->desc.n_voltages = TPS51632_MAX_VSEL + 1;
|
|
|
+ tps->desc.ops = &tps51632_dcdc_ops;
|
|
|
+ tps->desc.type = REGULATOR_VOLTAGE;
|
|
|
+ tps->desc.owner = THIS_MODULE;
|
|
|
+
|
|
|
pdata = dev_get_platdata(&client->dev);
|
|
|
if (!pdata && client->dev.of_node)
|
|
|
- pdata = of_get_tps51632_platform_data(&client->dev);
|
|
|
+ pdata = of_get_tps51632_platform_data(&client->dev, &tps->desc);
|
|
|
if (!pdata) {
|
|
|
dev_err(&client->dev, "No Platform data\n");
|
|
|
return -EINVAL;
|
|
@@ -296,22 +315,6 @@ static int tps51632_probe(struct i2c_client *client,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
|
|
|
- if (!tps)
|
|
|
- return -ENOMEM;
|
|
|
-
|
|
|
- tps->dev = &client->dev;
|
|
|
- tps->desc.name = client->name;
|
|
|
- tps->desc.id = 0;
|
|
|
- tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
|
|
|
- tps->desc.min_uV = TPS51632_MIN_VOLTAGE;
|
|
|
- tps->desc.uV_step = TPS51632_VOLTAGE_STEP_10mV;
|
|
|
- tps->desc.linear_min_sel = TPS51632_MIN_VSEL;
|
|
|
- tps->desc.n_voltages = TPS51632_MAX_VSEL + 1;
|
|
|
- tps->desc.ops = &tps51632_dcdc_ops;
|
|
|
- tps->desc.type = REGULATOR_VOLTAGE;
|
|
|
- tps->desc.owner = THIS_MODULE;
|
|
|
-
|
|
|
if (pdata->enable_pwm_dvfs)
|
|
|
tps->desc.vsel_reg = TPS51632_VOLTAGE_BASE_REG;
|
|
|
else
|