diff options
Diffstat (limited to 'drivers/regulator/tps51632-regulator.c')
-rw-r--r-- | drivers/regulator/tps51632-regulator.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c index f31f22e3e1bd..c213e37eb69e 100644 --- a/drivers/regulator/tps51632-regulator.c +++ b/drivers/regulator/tps51632-regulator.c | |||
@@ -221,7 +221,8 @@ static const struct of_device_id tps51632_of_match[] = { | |||
221 | MODULE_DEVICE_TABLE(of, tps51632_of_match); | 221 | MODULE_DEVICE_TABLE(of, tps51632_of_match); |
222 | 222 | ||
223 | static struct tps51632_regulator_platform_data * | 223 | static struct tps51632_regulator_platform_data * |
224 | of_get_tps51632_platform_data(struct device *dev) | 224 | of_get_tps51632_platform_data(struct device *dev, |
225 | const struct regulator_desc *desc) | ||
225 | { | 226 | { |
226 | struct tps51632_regulator_platform_data *pdata; | 227 | struct tps51632_regulator_platform_data *pdata; |
227 | struct device_node *np = dev->of_node; | 228 | struct device_node *np = dev->of_node; |
@@ -230,7 +231,8 @@ static struct tps51632_regulator_platform_data * | |||
230 | if (!pdata) | 231 | if (!pdata) |
231 | return NULL; | 232 | return NULL; |
232 | 233 | ||
233 | pdata->reg_init_data = of_get_regulator_init_data(dev, dev->of_node); | 234 | pdata->reg_init_data = of_get_regulator_init_data(dev, dev->of_node, |
235 | desc); | ||
234 | if (!pdata->reg_init_data) { | 236 | if (!pdata->reg_init_data) { |
235 | dev_err(dev, "Not able to get OF regulator init data\n"); | 237 | dev_err(dev, "Not able to get OF regulator init data\n"); |
236 | return NULL; | 238 | return NULL; |
@@ -248,7 +250,8 @@ static struct tps51632_regulator_platform_data * | |||
248 | } | 250 | } |
249 | #else | 251 | #else |
250 | static struct tps51632_regulator_platform_data * | 252 | static struct tps51632_regulator_platform_data * |
251 | of_get_tps51632_platform_data(struct device *dev) | 253 | of_get_tps51632_platform_data(struct device *dev, |
254 | const struct regulator_desc *desc) | ||
252 | { | 255 | { |
253 | return NULL; | 256 | return NULL; |
254 | } | 257 | } |
@@ -273,9 +276,25 @@ static int tps51632_probe(struct i2c_client *client, | |||
273 | } | 276 | } |
274 | } | 277 | } |
275 | 278 | ||
279 | tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); | ||
280 | if (!tps) | ||
281 | return -ENOMEM; | ||
282 | |||
283 | tps->dev = &client->dev; | ||
284 | tps->desc.name = client->name; | ||
285 | tps->desc.id = 0; | ||
286 | tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY; | ||
287 | tps->desc.min_uV = TPS51632_MIN_VOLTAGE; | ||
288 | tps->desc.uV_step = TPS51632_VOLTAGE_STEP_10mV; | ||
289 | tps->desc.linear_min_sel = TPS51632_MIN_VSEL; | ||
290 | tps->desc.n_voltages = TPS51632_MAX_VSEL + 1; | ||
291 | tps->desc.ops = &tps51632_dcdc_ops; | ||
292 | tps->desc.type = REGULATOR_VOLTAGE; | ||
293 | tps->desc.owner = THIS_MODULE; | ||
294 | |||
276 | pdata = dev_get_platdata(&client->dev); | 295 | pdata = dev_get_platdata(&client->dev); |
277 | if (!pdata && client->dev.of_node) | 296 | if (!pdata && client->dev.of_node) |
278 | pdata = of_get_tps51632_platform_data(&client->dev); | 297 | pdata = of_get_tps51632_platform_data(&client->dev, &tps->desc); |
279 | if (!pdata) { | 298 | if (!pdata) { |
280 | dev_err(&client->dev, "No Platform data\n"); | 299 | dev_err(&client->dev, "No Platform data\n"); |
281 | return -EINVAL; | 300 | return -EINVAL; |
@@ -296,22 +315,6 @@ static int tps51632_probe(struct i2c_client *client, | |||
296 | } | 315 | } |
297 | } | 316 | } |
298 | 317 | ||
299 | tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); | ||
300 | if (!tps) | ||
301 | return -ENOMEM; | ||
302 | |||
303 | tps->dev = &client->dev; | ||
304 | tps->desc.name = client->name; | ||
305 | tps->desc.id = 0; | ||
306 | tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY; | ||
307 | tps->desc.min_uV = TPS51632_MIN_VOLTAGE; | ||
308 | tps->desc.uV_step = TPS51632_VOLTAGE_STEP_10mV; | ||
309 | tps->desc.linear_min_sel = TPS51632_MIN_VSEL; | ||
310 | tps->desc.n_voltages = TPS51632_MAX_VSEL + 1; | ||
311 | tps->desc.ops = &tps51632_dcdc_ops; | ||
312 | tps->desc.type = REGULATOR_VOLTAGE; | ||
313 | tps->desc.owner = THIS_MODULE; | ||
314 | |||
315 | if (pdata->enable_pwm_dvfs) | 318 | if (pdata->enable_pwm_dvfs) |
316 | tps->desc.vsel_reg = TPS51632_VOLTAGE_BASE_REG; | 319 | tps->desc.vsel_reg = TPS51632_VOLTAGE_BASE_REG; |
317 | else | 320 | else |