23 #include <linux/module.h>
28 #include <linux/slab.h>
50 of_get_fixed_voltage_config(
struct device *
dev)
74 "Fixed regulator specified with variable voltages\n");
81 config->
gpio = of_get_named_gpio(np,
"gpio", 0);
111 static int fixed_voltage_get_voltage(
struct regulator_dev *dev)
121 static int fixed_voltage_list_voltage(
struct regulator_dev *dev,
133 .get_voltage = fixed_voltage_get_voltage,
134 .list_voltage = fixed_voltage_list_voltage,
144 if (pdev->
dev.of_node) {
145 config = of_get_fixed_voltage_config(&pdev->
dev);
147 return PTR_ERR(config);
149 config = pdev->
dev.platform_data;
157 if (drvdata ==
NULL) {
158 dev_err(&pdev->
dev,
"Failed to allocate device data\n");
165 dev_err(&pdev->
dev,
"Failed to allocate supply name\n");
171 drvdata->
desc.ops = &fixed_voltage_ops;
178 if (!drvdata->
desc.supply_name) {
180 "Failed to allocate input supply\n");
187 drvdata->
desc.n_voltages = 1;
191 if (config->
gpio >= 0)
216 if (IS_ERR(drvdata->
dev)) {
217 ret = PTR_ERR(drvdata->
dev);
218 dev_err(&pdev->
dev,
"Failed to register regulator: %d\n", ret);
222 platform_set_drvdata(pdev, drvdata);
248 #if defined(CONFIG_OF)
250 { .compatible =
"regulator-fixed", },
257 .probe = reg_fixed_voltage_probe,
260 .name =
"reg-fixed-voltage",
266 static int __init regulator_fixed_voltage_init(
void)
272 static void __exit regulator_fixed_voltage_exit(
void)