aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps6586x.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:04:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 15:04:35 -0500
commit8b0cab14951fbf8126795ab301835a8f8126a988 (patch)
tree2bf23662944ac9bfcd34d13ef81a6e331266ebf9 /drivers/mfd/tps6586x.c
parentfd62c5450324af7f6cc12897b09b77285cd48a92 (diff)
parent4ffc45c3604dd8e283884ce006faf0e955cbd9e6 (diff)
Merge tag 'regulator-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "A fairly quiet release again, a couple of relatively small new features and a bunch of driver specific work including yet more code elimination and fixes from Axel Lin. - Addidion of linear_min_sel for offsetting linear selectors in the helpers. - Support for continuous voltage ranges for regulators with extremely high resolution. - Drivers for AS3711, DA9055, MAX9873, TPS51632, TPS80031 and ARM vexpress." Fix up trivial conflict (due to typo fix) in palmas-regulator.c * tag 'regulator-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (80 commits) regulator: core: Fix logic to determinate if regulator can change voltage regulator: s5m8767: Fix to work even if no DVS gpio present regulator: s5m8767: Fix to read the first DVS register. regulator: s5m8767: Fix to work when platform registers less regulators regulator: gpio-regulator: gpio_set_value should use cansleep regulator: gpio-regulator: Fix logical error in for() loop regulator: anatop: Use regulator_[get|set]_voltage_sel_regmap regulator: anatop: Use linear_min_sel with linear mapping regulator: max1586: Implement get_voltage_sel callback regulator: lp8788-buck: Kill _gpio_request function regulator: tps80031: Convert tps80031_ldo_ops to linear_min_sel and list_voltage_linear regulator: lp8788-ldo: Remove val array in lp8788_config_ldo_enable_mode regulator: gpio-regulator: Add ifdef CONFIG_OF guard for regulator_gpio_of_match regulator: palmas: Convert palmas_ops_smps to regulator_[get|set]_voltage_sel_regmap regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_sel regulators: add regulator_can_change_voltage() function regulator: tps51632: Ensure [base|max]_voltage_uV pdata settings are valid regulator: wm831x-dcdc: Add MODULE_ALIAS for wm831x-boostp regulator: wm831x-dcdc: Ensure selected voltage falls within requested range regulator: tps51632: Use linear_min_sel and regulator_[map|list]_voltage_linear ...
Diffstat (limited to 'drivers/mfd/tps6586x.c')
-rw-r--r--drivers/mfd/tps6586x.c76
1 files changed, 8 insertions, 68 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 9f92c3b22093..87ba7ada3bbc 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -24,8 +24,6 @@
24#include <linux/err.h> 24#include <linux/err.h>
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>
28#include <linux/regulator/machine.h>
29 27
30#include <linux/mfd/core.h> 28#include <linux/mfd/core.h>
31#include <linux/mfd/tps6586x.h> 29#include <linux/mfd/tps6586x.h>
@@ -99,6 +97,9 @@ static struct mfd_cell tps6586x_cell[] = {
99 .name = "tps6586x-gpio", 97 .name = "tps6586x-gpio",
100 }, 98 },
101 { 99 {
100 .name = "tps6586x-pmic",
101 },
102 {
102 .name = "tps6586x-rtc", 103 .name = "tps6586x-rtc",
103 }, 104 },
104 { 105 {
@@ -350,80 +351,19 @@ failed:
350} 351}
351 352
352#ifdef CONFIG_OF 353#ifdef CONFIG_OF
353static struct of_regulator_match tps6586x_matches[] = {
354 { .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS },
355 { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 },
356 { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 },
357 { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 },
358 { .name = "ldo0", .driver_data = (void *)TPS6586X_ID_LDO_0 },
359 { .name = "ldo1", .driver_data = (void *)TPS6586X_ID_LDO_1 },
360 { .name = "ldo2", .driver_data = (void *)TPS6586X_ID_LDO_2 },
361 { .name = "ldo3", .driver_data = (void *)TPS6586X_ID_LDO_3 },
362 { .name = "ldo4", .driver_data = (void *)TPS6586X_ID_LDO_4 },
363 { .name = "ldo5", .driver_data = (void *)TPS6586X_ID_LDO_5 },
364 { .name = "ldo6", .driver_data = (void *)TPS6586X_ID_LDO_6 },
365 { .name = "ldo7", .driver_data = (void *)TPS6586X_ID_LDO_7 },
366 { .name = "ldo8", .driver_data = (void *)TPS6586X_ID_LDO_8 },
367 { .name = "ldo9", .driver_data = (void *)TPS6586X_ID_LDO_9 },
368 { .name = "ldo_rtc", .driver_data = (void *)TPS6586X_ID_LDO_RTC },
369};
370
371static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client) 354static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client)
372{ 355{
373 const unsigned int num = ARRAY_SIZE(tps6586x_matches);
374 struct device_node *np = client->dev.of_node; 356 struct device_node *np = client->dev.of_node;
375 struct tps6586x_platform_data *pdata; 357 struct tps6586x_platform_data *pdata;
376 struct tps6586x_subdev_info *devs;
377 struct device_node *regs;
378 const char *sys_rail_name = NULL;
379 unsigned int count;
380 unsigned int i, j;
381 int err;
382
383 regs = of_find_node_by_name(np, "regulators");
384 if (!regs)
385 return NULL;
386
387 err = of_regulator_match(&client->dev, regs, tps6586x_matches, num);
388 if (err < 0) {
389 of_node_put(regs);
390 return NULL;
391 }
392
393 of_node_put(regs);
394 count = err;
395
396 devs = devm_kzalloc(&client->dev, count * sizeof(*devs), GFP_KERNEL);
397 if (!devs)
398 return NULL;
399
400 for (i = 0, j = 0; i < num && j < count; i++) {
401 struct regulator_init_data *reg_idata;
402
403 if (!tps6586x_matches[i].init_data)
404 continue;
405
406 reg_idata = tps6586x_matches[i].init_data;
407 devs[j].name = "tps6586x-regulator";
408 devs[j].platform_data = tps6586x_matches[i].init_data;
409 devs[j].id = (int)tps6586x_matches[i].driver_data;
410 if (devs[j].id == TPS6586X_ID_SYS)
411 sys_rail_name = reg_idata->constraints.name;
412
413 if ((devs[j].id == TPS6586X_ID_LDO_5) ||
414 (devs[j].id == TPS6586X_ID_LDO_RTC))
415 reg_idata->supply_regulator = sys_rail_name;
416
417 devs[j].of_node = tps6586x_matches[i].of_node;
418 j++;
419 }
420 358
421 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); 359 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
422 if (!pdata) 360 if (!pdata) {
361 dev_err(&client->dev, "Memory allocation failed\n");
423 return NULL; 362 return NULL;
363 }
424 364
425 pdata->num_subdevs = count; 365 pdata->num_subdevs = 0;
426 pdata->subdevs = devs; 366 pdata->subdevs = NULL;
427 pdata->gpio_base = -1; 367 pdata->gpio_base = -1;
428 pdata->irq_base = -1; 368 pdata->irq_base = -1;
429 pdata->pm_off = of_property_read_bool(np, "ti,system-power-controller"); 369 pdata->pm_off = of_property_read_bool(np, "ti,system-power-controller");