diff options
Diffstat (limited to 'drivers/regulator/stpmic1_regulator.c')
-rw-r--r-- | drivers/regulator/stpmic1_regulator.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/regulator/stpmic1_regulator.c b/drivers/regulator/stpmic1_regulator.c index 61227e0855..3ed351b580 100644 --- a/drivers/regulator/stpmic1_regulator.c +++ b/drivers/regulator/stpmic1_regulator.c @@ -1,11 +1,11 @@ -// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0-only // Copyright (C) STMicroelectronics 2018 // Author: Pascal Paillet <p.paillet@st.com> for STMicroelectronics. #include <common.h> #include <init.h> #include <of_device.h> -#include <regmap.h> +#include <linux/regmap.h> #include <linux/regulator/of_regulator.h> #include <regulator.h> #include <linux/mfd/stpmic1.h> @@ -126,6 +126,7 @@ static const struct regulator_ops stpmic1_ldo_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, }; @@ -135,6 +136,7 @@ static const struct regulator_ops stpmic1_ldo3_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, }; @@ -150,6 +152,7 @@ static const struct regulator_ops stpmic1_buck_ops = { .is_enabled = regulator_is_enabled_regmap, .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, + .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, }; @@ -182,6 +185,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = LDO_ENABLE_MASK, \ .enable_val = 1, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_LDO3(ids, base) { \ @@ -195,6 +199,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = LDO_ENABLE_MASK, \ .enable_val = 1, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_LDO4(ids, base) { \ @@ -205,6 +210,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = LDO_ENABLE_MASK, \ .enable_val = 1, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_BUCK(ids, base) { \ @@ -218,6 +224,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = BUCK_ENABLE_MASK, \ .enable_val = 1, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_VREF_DDR(ids, base) { \ @@ -228,6 +235,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = BUCK_ENABLE_MASK, \ .enable_val = 1, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_BOOST(ids, base) { \ @@ -238,6 +246,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = BOOST_ENABLED, \ .enable_val = BOOST_ENABLED, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_VBUS_OTG(ids, base) { \ @@ -248,6 +257,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = USBSW_OTG_SWITCH_ENABLED, \ .enable_val = USBSW_OTG_SWITCH_ENABLED, \ .disable_val = 0, \ + .supply_name = #base, \ } #define REG_SW_OUT(ids, base) { \ @@ -258,6 +268,7 @@ static const struct regulator_ops stpmic1_switch_regul_ops = { .enable_mask = SWIN_SWOUT_ENABLED, \ .enable_val = SWIN_SWOUT_ENABLED, \ .disable_val = 0, \ + .supply_name = #base, \ } static struct stpmic1_regulator_cfg stpmic1_regulator_cfgs[] = { @@ -376,7 +387,7 @@ static struct of_regulator_match stpmic1_matches[] = { MATCH(pwr_sw2, SW_OUT), }; -static int stpmic1_regulator_register(struct device_d *dev, int id, +static int stpmic1_regulator_register(struct device *dev, int id, struct of_regulator_match *match, struct stpmic1_regulator_cfg *cfg) { @@ -404,11 +415,11 @@ static int stpmic1_regulator_register(struct device_d *dev, int id, return 0; } -static int stpmic1_regulator_probe(struct device_d *dev) +static int stpmic1_regulator_probe(struct device *dev) { int i, ret; - ret = of_regulator_match(dev, dev->device_node, stpmic1_matches, + ret = of_regulator_match(dev, dev->of_node, stpmic1_matches, ARRAY_SIZE(stpmic1_matches)); if (ret < 0) { dev_err(dev, "Error in PMIC regulator device tree node"); @@ -431,8 +442,9 @@ static __maybe_unused const struct of_device_id stpmic1_regulator_of_match[] = { { .compatible = "st,stpmic1-regulators" }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE(of, stpmic1_regulator_of_match); -static struct driver_d stpmic1_regulator_driver = { +static struct driver stpmic1_regulator_driver = { .name = "stpmic1-regulator", .probe = stpmic1_regulator_probe, .of_compatible = DRV_OF_COMPAT(stpmic1_regulator_of_match), |