Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Laxman Dewangan and committed by
Mark Brown
6be5bfc3 4706fcab

+22 -1
+2
Documentation/devicetree/bindings/regulator/fixed-regulator.txt
··· 10 10 If this property is missing, the default assumed is Active low. 11 11 - gpio-open-drain: GPIO is open drain type. 12 12 If this property is missing then default assumption is false. 13 + -vin-supply: Input supply name. 13 14 14 15 Any property defined as part of the core regulator 15 16 binding, defined in regulator.txt, can also be used. ··· 30 29 enable-active-high; 31 30 regulator-boot-on; 32 31 gpio-open-drain; 32 + vin-supply = <&parent_reg>; 33 33 };
+18 -1
drivers/regulator/fixed.c
··· 102 102 if (of_find_property(np, "gpio-open-drain", NULL)) 103 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 108 return config; 106 109 } 107 110 ··· 172 169 173 170 drvdata->desc.enable_time = config->startup_delay; 174 171 172 + if (config->input_supply) { 173 + drvdata->desc.supply_name = kstrdup(config->input_supply, 174 + GFP_KERNEL); 175 + if (!drvdata->desc.supply_name) { 176 + dev_err(&pdev->dev, 177 + "Failed to allocate input supply\n"); 178 + ret = -ENOMEM; 179 + goto err_name; 180 + } 181 + } 182 + 175 183 if (config->microvolts) 176 184 drvdata->desc.n_voltages = 1; 177 185 ··· 216 202 if (IS_ERR(drvdata->dev)) { 217 203 ret = PTR_ERR(drvdata->dev); 218 204 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); 219 - goto err_name; 205 + goto err_input; 220 206 } 221 207 222 208 platform_set_drvdata(pdev, drvdata); ··· 226 212 227 213 return 0; 228 214 215 + err_input: 216 + kfree(drvdata->desc.supply_name); 229 217 err_name: 230 218 kfree(drvdata->desc.name); 231 219 err: ··· 239 223 struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); 240 224 241 225 regulator_unregister(drvdata->dev); 226 + kfree(drvdata->desc.supply_name); 242 227 kfree(drvdata->desc.name); 243 228 244 229 return 0;
+2
include/linux/regulator/fixed.h
··· 22 22 /** 23 23 * struct fixed_voltage_config - fixed_voltage_config structure 24 24 * @supply_name: Name of the regulator supply 25 + * @input_supply: Name of the input regulator supply 25 26 * @microvolts: Output voltage of regulator 26 27 * @gpio: GPIO to use for enable control 27 28 * set to -EINVAL if not used ··· 47 46 */ 48 47 struct fixed_voltage_config { 49 48 const char *supply_name; 49 + const char *input_supply; 50 50 int microvolts; 51 51 int gpio; 52 52 unsigned startup_delay;