Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312616
b: refs/heads/master
c: 6be5bfc
h: refs/heads/master
v: v3
  • Loading branch information
Laxman Dewangan authored and Mark Brown committed Jul 5, 2012
1 parent bc24ae6 commit 27aa9d2
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4706fcab9b064e6077404ccb6c5ca9c188758068
refs/heads/master: 6be5bfc3bf0d31a70745a52e69f7f46de974193f
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Optional properties:
If this property is missing, the default assumed is Active low.
- gpio-open-drain: GPIO is open drain type.
If this property is missing then default assumption is false.
-vin-supply: Input supply name.

Any property defined as part of the core regulator
binding, defined in regulator.txt, can also be used.
Expand All @@ -29,4 +30,5 @@ Example:
enable-active-high;
regulator-boot-on;
gpio-open-drain;
vin-supply = <&parent_reg>;
};
19 changes: 18 additions & 1 deletion trunk/drivers/regulator/fixed.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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:
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/regulator/fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct regulator_init_data;
/**
* struct fixed_voltage_config - fixed_voltage_config structure
* @supply_name: Name of the regulator supply
* @input_supply: Name of the input regulator supply
* @microvolts: Output voltage of regulator
* @gpio: GPIO to use for enable control
* set to -EINVAL if not used
Expand All @@ -46,6 +47,7 @@ struct regulator_init_data;
*/
struct fixed_voltage_config {
const char *supply_name;
const char *input_supply;
int microvolts;
int gpio;
unsigned startup_delay;
Expand Down

0 comments on commit 27aa9d2

Please sign in to comment.