diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-19 01:38:20 +0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-03-19 01:38:20 +0400 |
commit | c592c761a36286ab83451daa37a21c8558ea99c0 (patch) | |
tree | 8abf57708fabf2a915320e9515b1ae2730ebf499 /drivers/regulator | |
parent | 63236f4038f7e14762114606d95769c32cf6cac1 (diff) | |
parent | 33499df88b711725ee473ab5478e17efd21de4b0 (diff) | |
download | linux-c592c761a36286ab83451daa37a21c8558ea99c0.tar.xz |
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 @@ # -obj-$(CONFIG_REGULATOR) += core.o dummy.o +obj-$(CONFIG_REGULATOR) += core.o dummy.o fixed-helper.o obj-$(CONFIG_OF) += of_regulator.o obj-$(CONFIG_REGULATOR_FIXED_VOLTAGE) += fixed.o 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) * @dev: struct device for the regulator * @init_data: platform provided init data, passed through by driver * @driver_data: private regulator data + * @of_node: OpenFirmware node to parse for device tree bindings (may be + * NULL). * * Called by regulator drivers to register a regulator. * 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 @@ +#include <linux/slab.h> +#include <linux/platform_device.h> +#include <linux/regulator/machine.h> +#include <linux/regulator/fixed.h> + +struct fixed_regulator_data { + struct fixed_voltage_config cfg; + struct regulator_init_data init_data; + struct platform_device pdev; +}; + +static void regulator_fixed_release(struct device *dev) +{ + struct fixed_regulator_data *data = container_of(dev, + struct fixed_regulator_data, pdev.dev); + kfree(data); +} + +/** + * regulator_register_fixed - register a no-op fixed regulator + * @name: supply name + * @id: platform device id + * @supplies: consumers for this regulator + * @num_supplies: number of consumers + */ +struct platform_device *regulator_register_fixed(int id, + struct regulator_consumer_supply *supplies, int num_supplies) +{ + struct fixed_regulator_data *data; + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) + return NULL; + + data->cfg.supply_name = "dummy"; + data->cfg.microvolts = 0; + data->cfg.gpio = -EINVAL; + data->cfg.enabled_at_boot = 1; + data->cfg.init_data = &data->init_data; + + data->init_data.constraints.always_on = 1; + data->init_data.consumer_supplies = supplies; + data->init_data.num_consumer_supplies = num_supplies; + + data->pdev.name = "reg-fixed-voltage"; + data->pdev.id = id; + data->pdev.dev.platform_data = &data->cfg; + data->pdev.dev.release = regulator_fixed_release; + + platform_device_register(&data->pdev); + + return &data->pdev; +} 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) if (ret != 0) return ret; val &= MAX8649_VOL_MASK; - voltage = max8649_list_voltage(rdev, (unsigned char)ret); /* uV */ + voltage = max8649_list_voltage(rdev, (unsigned char)val); /* uV */ /* get rate */ 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, if (constraints->min_uV != constraints->max_uV) constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; /* Only one voltage? Then make sure it's set. */ - if (constraints->min_uV == constraints->max_uV) + if (min_uV && max_uV && constraints->min_uV == constraints->max_uV) constraints->apply_uV = true; uV_offset = of_get_property(np, "regulator-microvolt-offset", NULL); |