summaryrefslogtreecommitdiff
path: root/drivers/regulator/fixed.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-05 16:42:01 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-05 16:49:35 +0400
commit6be5bfc3bf0d31a70745a52e69f7f46de974193f (patch)
treea6a157abba4cf674381104ebeb5521b7e0a9aab9 /drivers/regulator/fixed.c
parent4706fcab9b064e6077404ccb6c5ca9c188758068 (diff)
downloadlinux-6be5bfc3bf0d31a70745a52e69f7f46de974193f.tar.xz
regulator: fixed: dt: support for input supply
Add support for input supply in DT parsing of node. The input supply will be provided by the property "vin-supply" in the regulator node. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/fixed.c')
-rw-r--r--drivers/regulator/fixed.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index 1a0b17e8d8a9..185468c4d38f 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -102,6 +102,9 @@ of_get_fixed_voltage_config(struct device *dev)
if (of_find_property(np, "gpio-open-drain", NULL))
config->gpio_is_open_drain = true;
+ if (of_find_property(np, "vin-supply", NULL))
+ config->input_supply = "vin";
+
return config;
}
@@ -169,6 +172,17 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->desc.enable_time = config->startup_delay;
+ if (config->input_supply) {
+ drvdata->desc.supply_name = kstrdup(config->input_supply,
+ GFP_KERNEL);
+ if (!drvdata->desc.supply_name) {
+ dev_err(&pdev->dev,
+ "Failed to allocate input supply\n");
+ ret = -ENOMEM;
+ goto err_name;
+ }
+ }
+
if (config->microvolts)
drvdata->desc.n_voltages = 1;
@@ -202,7 +216,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
if (IS_ERR(drvdata->dev)) {
ret = PTR_ERR(drvdata->dev);
dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
- goto err_name;
+ goto err_input;
}
platform_set_drvdata(pdev, drvdata);
@@ -212,6 +226,8 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
return 0;
+err_input:
+ kfree(drvdata->desc.supply_name);
err_name:
kfree(drvdata->desc.name);
err:
@@ -223,6 +239,7 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev)
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
regulator_unregister(drvdata->dev);
+ kfree(drvdata->desc.supply_name);
kfree(drvdata->desc.name);
return 0;