mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
regulator: gpio: support input supply
Add input supply, to create power tree. Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com> Change-Id: If67d2d545453b6b8e7d4e276ca5367bc8fb69dd1
This commit is contained in:
@@ -241,6 +241,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
|
||||
regtype);
|
||||
}
|
||||
|
||||
if (of_find_property(np, "vin-supply", NULL))
|
||||
config->input_supply = "vin";
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -275,6 +278,18 @@ static int gpio_regulator_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (config->input_supply) {
|
||||
drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
|
||||
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->nr_gpios != 0) {
|
||||
drvdata->gpios = kmemdup(config->gpios,
|
||||
config->nr_gpios * sizeof(struct gpio),
|
||||
|
||||
@@ -44,6 +44,7 @@ struct gpio_regulator_state {
|
||||
/**
|
||||
* struct gpio_regulator_config - config structure
|
||||
* @supply_name: Name of the regulator supply
|
||||
* @input_supply: Name of the regulator input supply
|
||||
* @enable_gpio: GPIO to use for enable control
|
||||
* set to -EINVAL if not used
|
||||
* @enable_high: Polarity of enable GPIO
|
||||
@@ -68,6 +69,7 @@ struct gpio_regulator_state {
|
||||
*/
|
||||
struct gpio_regulator_config {
|
||||
const char *supply_name;
|
||||
const char *input_supply;
|
||||
|
||||
int enable_gpio;
|
||||
unsigned enable_high:1;
|
||||
|
||||
Reference in New Issue
Block a user