diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-18 17:38:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-18 17:38:20 -0400 |
commit | c592c761a36286ab83451daa37a21c8558ea99c0 (patch) | |
tree | 8abf57708fabf2a915320e9515b1ae2730ebf499 /drivers/regulator | |
parent | 63236f4038f7e14762114606d95769c32cf6cac1 (diff) | |
parent | 33499df88b711725ee473ab5478e17efd21de4b0 (diff) |
Merge remote-tracking branch 'regulator/topic/stub' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/Makefile | 2 | ||||
-rw-r--r-- | drivers/regulator/core.c | 2 | ||||
-rw-r--r-- | drivers/regulator/fixed-helper.c | 53 | ||||
-rw-r--r-- | drivers/regulator/max8649.c | 2 | ||||
-rw-r--r-- | drivers/regulator/of_regulator.c | 2 |
5 files changed, 58 insertions, 3 deletions
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index ab06474e5eb6..b5042c885d89 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | 5 | ||
6 | obj-$(CONFIG_REGULATOR) += core.o dummy.o | 6 | obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o |
7 | obj-$(CONFIG_OF) += of_regulator.o | 7 | obj-$(CONFIG_OF) += of_regulator.o |
8 | obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o | 8 | obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o |
9 | obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o | 9 | obj-$(CONFIG_REGULATOR_VIRTUAL_CONSUMER) += virtual.o |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index fc4ccf880cbc..8f11d0eb59a5 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2723,6 +2723,8 @@ static void rdev_init_debugfs(struct regulator_dev *rdev) | |||
2723 | * @dev: struct device for the regulator | 2723 | * @dev: struct device for the regulator |
2724 | * @init_data: platform provided init data, passed through by driver | 2724 | * @init_data: platform provided init data, passed through by driver |
2725 | * @driver_data: private regulator data | 2725 | * @driver_data: private regulator data |
2726 | * @of_node: OpenFirmware node to parse for device tree bindings (may be | ||
2727 | * NULL). | ||
2726 | * | 2728 | * |
2727 | * Called by regulator drivers to register a regulator. | 2729 | * Called by regulator drivers to register a regulator. |
2728 | * Returns 0 on success. | 2730 | * Returns 0 on success. |
diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c new file mode 100644 index 000000000000..30d0a15b8949 --- /dev/null +++ b/drivers/regulator/fixed-helper.c | |||
@@ -0,0 +1,53 @@ | |||
1 | #include <linux/slab.h> | ||
2 | #include <linux/platform_device.h> | ||
3 | #include <linux/regulator/machine.h> | ||
4 | #include <linux/regulator/fixed.h> | ||
5 | |||
6 | struct fixed_regulator_data { | ||
7 | struct fixed_voltage_config cfg; | ||
8 | struct regulator_init_data init_data; | ||
9 | struct platform_device pdev; | ||
10 | }; | ||
11 | |||
12 | static void regulator_fixed_release(struct device *dev) | ||
13 | { | ||
14 | struct fixed_regulator_data *data = container_of(dev, | ||
15 | struct fixed_regulator_data, pdev.dev); | ||
16 | kfree(data); | ||
17 | } | ||
18 | |||
19 | /** | ||
20 | * regulator_register_fixed - register a no-op fixed regulator | ||
21 | * @name: supply name | ||
22 | * @id: platform device id | ||
23 | * @supplies: consumers for this regulator | ||
24 | * @num_supplies: number of consumers | ||
25 | */ | ||
26 | struct platform_device *regulator_register_fixed(int id, | ||
27 | struct regulator_consumer_supply *supplies, int num_supplies) | ||
28 | { | ||
29 | struct fixed_regulator_data *data; | ||
30 | |||
31 | data = kzalloc(sizeof(*data), GFP_KERNEL); | ||
32 | if (!data) | ||
33 | return NULL; | ||
34 | |||
35 | data->cfg.supply_name = "dummy"; | ||
36 | data->cfg.microvolts = 0; | ||
37 | data->cfg.gpio = -EINVAL; | ||
38 | data->cfg.enabled_at_boot = 1; | ||
39 | data->cfg.init_data = &data->init_data; | ||
40 | |||
41 | data->init_data.constraints.always_on = 1; | ||
42 | data->init_data.consumer_supplies = supplies; | ||
43 | data->init_data.num_consumer_supplies = num_supplies; | ||
44 | |||
45 | data->pdev.name = "reg-fixed-voltage"; | ||
46 | data->pdev.id = id; | ||
47 | data->pdev.dev.platform_data = &data->cfg; | ||
48 | data->pdev.dev.release = regulator_fixed_release; | ||
49 | |||
50 | platform_device_register(&data->pdev); | ||
51 | |||
52 | return &data->pdev; | ||
53 | } | ||
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 82505fcb8d43..824c650436ed 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -149,7 +149,7 @@ static int max8649_enable_time(struct regulator_dev *rdev) | |||
149 | if (ret != 0) | 149 | if (ret != 0) |
150 | return ret; | 150 | return ret; |
151 | val &= MAX8649_VOL_MASK; | 151 | val &= MAX8649_VOL_MASK; |
152 | voltage = max8649_list_voltage(rdev, (unsigned char)ret); /* uV */ | 152 | voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */ |
153 | 153 | ||
154 | /* get rate */ | 154 | /* get rate */ |
155 | ret = regmap_read(info->regmap, MAX8649_RAMP, &val); | 155 | ret = regmap_read(info->regmap, MAX8649_RAMP, &val); |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index f1651eb69648..679734d26a16 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
@@ -35,7 +35,7 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
35 | if (constraints->min_uV != constraints->max_uV) | 35 | if (constraints->min_uV != constraints->max_uV) |
36 | constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; | 36 | constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; |
37 | /* Only one voltage? Then make sure it's set. */ | 37 | /* Only one voltage? Then make sure it's set. */ |
38 | if (constraints->min_uV == constraints->max_uV) | 38 | if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) |
39 | constraints->apply_uV = true; | 39 | constraints->apply_uV = true; |
40 | 40 | ||
41 | uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL); | 41 | uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL); |