diff options
author | Tom Rini <trini@konsulko.com> | 2019-07-18 11:31:37 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-18 11:31:37 -0400 |
commit | 0de815356474912ef5bef9a69f0327a5a93bb2c2 (patch) | |
tree | 92db8fda09396081f58a0c5fb182e72fbc3fdd50 /drivers/power/regulator/gpio-regulator.c | |
parent | 9a06eb800c1bdc68aa81fcad6d4f404e12dfff33 (diff) | |
parent | bf88d2b023063a0c46d7617a4f6897d5d561662d (diff) |
Merge branch '2019-07-17-master-imports'
- Various FS/disk related fixes with security implications.
- Proper fix for the pci_ep test.
- Assorted bugfixes
- Some MediaTek updates.
- 'env erase' support.
Diffstat (limited to 'drivers/power/regulator/gpio-regulator.c')
-rw-r--r-- | drivers/power/regulator/gpio-regulator.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index d18e5d8d2c..ec1dcb64b3 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -4,6 +4,7 @@ * Keerthy <j-keerthy@ti.com> */ +#include "regulator_common.h" #include <common.h> #include <fdtdec.h> #include <errno.h> @@ -18,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR; struct gpio_regulator_platdata { + struct regulator_common_platdata common; struct gpio_desc gpio; /* GPIO for regulator voltage control */ int states[GPIO_REGULATOR_MAX_STATES]; int voltages[GPIO_REGULATOR_MAX_STATES]; @@ -65,7 +67,7 @@ static int gpio_regulator_ofdata_to_platdata(struct udevice *dev) j++; } - return 0; + return regulator_common_ofdata_to_platdata(dev, &dev_pdata->common, "enable-gpios"); } static int gpio_regulator_get_value(struct udevice *dev) @@ -116,9 +118,23 @@ static int gpio_regulator_set_value(struct udevice *dev, int uV) return 0; } +static int gpio_regulator_get_enable(struct udevice *dev) +{ + struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + return regulator_common_get_enable(dev, &dev_pdata->common); +} + +static int gpio_regulator_set_enable(struct udevice *dev, bool enable) +{ + struct gpio_regulator_platdata *dev_pdata = dev_get_platdata(dev); + return regulator_common_set_enable(dev, &dev_pdata->common, enable); +} + static const struct dm_regulator_ops gpio_regulator_ops = { .get_value = gpio_regulator_get_value, .set_value = gpio_regulator_set_value, + .get_enable = gpio_regulator_get_enable, + .set_enable = gpio_regulator_set_enable, }; static const struct udevice_id gpio_regulator_ids[] = { |