aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps6586x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/tps6586x.c')
-rw-r--r--drivers/mfd/tps6586x.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 353c34812120..380a3c886d31 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -25,6 +25,7 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/regmap.h> 26#include <linux/regmap.h>
27#include <linux/regulator/of_regulator.h> 27#include <linux/regulator/of_regulator.h>
28#include <linux/regulator/machine.h>
28 29
29#include <linux/mfd/core.h> 30#include <linux/mfd/core.h>
30#include <linux/mfd/tps6586x.h> 31#include <linux/mfd/tps6586x.h>
@@ -346,6 +347,7 @@ failed:
346 347
347#ifdef CONFIG_OF 348#ifdef CONFIG_OF
348static struct of_regulator_match tps6586x_matches[] = { 349static struct of_regulator_match tps6586x_matches[] = {
350 { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS },
349 { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 }, 351 { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 },
350 { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 }, 352 { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 },
351 { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 }, 353 { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 },
@@ -369,6 +371,7 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien
369 struct tps6586x_platform_data *pdata; 371 struct tps6586x_platform_data *pdata;
370 struct tps6586x_subdev_info *devs; 372 struct tps6586x_subdev_info *devs;
371 struct device_node *regs; 373 struct device_node *regs;
374 const char *sys_rail_name = NULL;
372 unsigned int count; 375 unsigned int count;
373 unsigned int i, j; 376 unsigned int i, j;
374 int err; 377 int err;
@@ -391,12 +394,22 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien
391 return NULL; 394 return NULL;
392 395
393 for (i = 0, j = 0; i < num && j < count; i++) { 396 for (i = 0, j = 0; i < num && j < count; i++) {
397 struct regulator_init_data *reg_idata;
398
394 if (!tps6586x_matches[i].init_data) 399 if (!tps6586x_matches[i].init_data)
395 continue; 400 continue;
396 401
402 reg_idata = tps6586x_matches[i].init_data;
397 devs[j].name = "tps6586x-regulator"; 403 devs[j].name = "tps6586x-regulator";
398 devs[j].platform_data = tps6586x_matches[i].init_data; 404 devs[j].platform_data = tps6586x_matches[i].init_data;
399 devs[j].id = (int)tps6586x_matches[i].driver_data; 405 devs[j].id = (int)tps6586x_matches[i].driver_data;
406 if (devs[j].id == TPS6586X_ID_SYS)
407 sys_rail_name = reg_idata->constraints.name;
408
409 if ((devs[j].id == TPS6586X_ID_LDO_5) ||
410 (devs[j].id == TPS6586X_ID_LDO_RTC))
411 reg_idata->supply_regulator = sys_rail_name;
412
400 devs[j].of_node = tps6586x_matches[i].of_node; 413 devs[j].of_node = tps6586x_matches[i].of_node;
401 j++; 414 j++;
402 } 415 }