aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/fixed.c
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-07-05 08:42:01 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-07-05 08:49:35 -0400
commit6be5bfc3bf0d31a70745a52e69f7f46de974193f (patch)
treea6a157abba4cf674381104ebeb5521b7e0a9aab9 /drivers/regulator/fixed.c
parent4706fcab9b064e6077404ccb6c5ca9c188758068 (diff)
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)
102 if (of_find_property(np, "gpio-open-drain", NULL)) 102 if (of_find_property(np, "gpio-open-drain", NULL))
103 config->gpio_is_open_drain = true; 103 config->gpio_is_open_drain = true;
104 104
105 if (of_find_property(np, "vin-supply", NULL))
106 config->input_supply = "vin";
107
105 return config; 108 return config;
106} 109}
107 110
@@ -169,6 +172,17 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
169 172
170 drvdata->desc.enable_time = config->startup_delay; 173 drvdata->desc.enable_time = config->startup_delay;
171 174
175 if (config->input_supply) {
176 drvdata->desc.supply_name = kstrdup(config->input_supply,
177 GFP_KERNEL);
178 if (!drvdata->desc.supply_name) {
179 dev_err(&pdev->dev,
180 "Failed to allocate input supply\n");
181 ret = -ENOMEM;
182 goto err_name;
183 }
184 }
185
172 if (config->microvolts) 186 if (config->microvolts)
173 drvdata->desc.n_voltages = 1; 187 drvdata->desc.n_voltages = 1;
174 188
@@ -202,7 +216,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
202 if (IS_ERR(drvdata->dev)) { 216 if (IS_ERR(drvdata->dev)) {
203 ret = PTR_ERR(drvdata->dev); 217 ret = PTR_ERR(drvdata->dev);
204 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 218 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
205 goto err_name; 219 goto err_input;
206 } 220 }
207 221
208 platform_set_drvdata(pdev, drvdata); 222 platform_set_drvdata(pdev, drvdata);
@@ -212,6 +226,8 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
212 226
213 return 0; 227 return 0;
214 228
229err_input:
230 kfree(drvdata->desc.supply_name);
215err_name: 231err_name:
216 kfree(drvdata->desc.name); 232 kfree(drvdata->desc.name);
217err: 233err:
@@ -223,6 +239,7 @@ static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev)
223 struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); 239 struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
224 240
225 regulator_unregister(drvdata->dev); 241 regulator_unregister(drvdata->dev);
242 kfree(drvdata->desc.supply_name);
226 kfree(drvdata->desc.name); 243 kfree(drvdata->desc.name);
227 244
228 return 0; 245 return 0;