diff options
author | Mark Brown <broonie@kernel.org> | 2019-05-06 22:52:14 +0900 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-05-06 22:52:14 +0900 |
commit | e2a23affe6a6a15111ae56edd7e4f3c9673ef201 (patch) | |
tree | a69d90bfe04ff687e8ccde00ddac9aea357e33e6 | |
parent | c7b5128f72efc732be776569a862bb4169eb1dbc (diff) | |
parent | 498209445124920b365ef43aac93d6f1acbaa1b7 (diff) |
Merge branch 'regulator-5.2' into regulator-next
89 files changed, 1323 insertions, 2770 deletions
diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt index 1f496159e2bb..dd25e73b5d79 100644 --- a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt @@ -4,16 +4,30 @@ Required properties: - compatible : Must be "regulator-gpio". - regulator-name : Defined in regulator.txt as optional, but required here. -- states : Selection of available voltages and GPIO configs. - if there are no states, then use a fixed regulator +- gpios : Array of one or more GPIO pins used to select the + regulator voltage/current listed in "states". +- states : Selection of available voltages/currents provided by + this regulator and matching GPIO configurations to + achieve them. If there are no states in the "states" + array, use a fixed regulator instead. Optional properties: -- enable-gpio : GPIO to use to enable/disable the regulator. -- gpios : GPIO group used to control voltage. -- gpios-states : gpios pin's initial states array. 0: LOW, 1: HIGH. - defualt is LOW if nothing is specified. +- enable-gpios : GPIO used to enable/disable the regulator. + Warning, the GPIO phandle flags are ignored and the + GPIO polarity is controlled solely by the presence + of "enable-active-high" DT property. This is due to + compatibility with old DTs. +- enable-active-high : Polarity of "enable-gpio" GPIO is active HIGH. + Default is active LOW. +- gpios-states : On operating systems, that don't support reading back + gpio values in output mode (most notably linux), this + array provides the state of GPIO pins set when + requesting them from the gpio controller. Systems, + that are capable of preserving state when requesting + the lines, are free to ignore this property. + 0: LOW, 1: HIGH. Default is LOW if nothing else + is specified. - startup-delay-us : Startup time in microseconds. -- enable-active-high : Polarity of GPIO is active high (default is low). - regulator-type : Specifies what is being regulated, must be either "voltage" or "current", defaults to voltage. @@ -30,7 +44,7 @@ Example: regulator-max-microvolt = <2600000>; regulator-boot-on; - enable-gpio = <&gpio0 23 0x4>; + enable-gpios = <&gpio0 23 0x4>; gpios = <&gpio0 24 0x4 &gpio0 25 0x4>; states = <1800000 0x3 diff --git a/Documentation/devicetree/bindings/regulator/st,stm32mp1-pwr-reg.txt b/Documentation/devicetree/bindings/regulator/st,stm32mp1-pwr-reg.txt new file mode 100644 index 000000000000..e372dd3f0c8a --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/st,stm32mp1-pwr-reg.txt @@ -0,0 +1,43 @@ +STM32MP1 PWR Regulators +----------------------- + +Available Regulators in STM32MP1 PWR block are: + - reg11 for regulator 1V1 + - reg18 for regulator 1V8 + - usb33 for the swtich USB3V3 + +Required properties: +- compatible: Must be "st,stm32mp1,pwr-reg" +- list of child nodes that specify the regulator reg11, reg18 or usb33 + initialization data for defined regulators. The definition for each of + these nodes is defined using the standard binding for regulators found at + Documentation/devicetree/bindings/regulator/regulator.txt. +- vdd-supply: phandle to the parent supply/regulator node for vdd input +- vdd_3v3_usbfs-supply: phandle to the parent supply/regulator node for usb33 + +Example: + +pwr_regulators: pwr@50001000 { + compatible = "st,stm32mp1,pwr-reg"; + reg = <0x50001000 0x10>; + vdd-supply = <&vdd>; + vdd_3v3_usbfs-supply = <&vdd_usb>; + + reg11: reg11 { + regulator-name = "reg11"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + }; + + reg18: reg18 { + regulator-name = "reg18"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + usb33: usb33 { + regulator-name = "usb33"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; +}; diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 25fbbaf39cb9..21bae64e0451 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -34,7 +34,7 @@ /* Current settings - values are 2*2^(reg_val/4) microamps. These are * exported since they are used by multiple drivers. */ -int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = { +const unsigned int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = { 2, 2, 3, diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c index 79756c83f5f0..cf067424a156 100644 --- a/drivers/mfd/wm8400-core.c +++ b/drivers/mfd/wm8400-core.c @@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg) } } -int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data) -{ - return regmap_bulk_read(wm8400->regmap, reg, data, count); -} -EXPORT_SYMBOL_GPL(wm8400_block_read); - static int wm8400_register_codec(struct wm8400 *wm8400) { const struct mfd_cell cell = { diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c index 89bbd6e8bad1..9fd379732d18 100644 --- a/drivers/regulator/88pm800.c +++ b/drivers/regulator/88pm800.c @@ -77,11 +77,6 @@ struct pm800_regulator_info { int max_ua; }; -struct pm800_regulators { - struct pm80x_chip *chip; - struct regmap *map; -}; - /* * vreg - the buck regs string. * ereg - the string for the enable register. @@ -235,7 +230,6 @@ static int pm800_regulator_probe(struct platform_device *pdev) { struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm80x_platform_data *pdata = dev_get_platdata(pdev->dev.parent); - struct pm800_regulators *pm800_data; struct regulator_config config = { }; struct regulator_init_data *init_data; int i, ret; @@ -252,18 +246,8 @@ static int pm800_regulator_probe(struct platform_device *pdev) return -EINVAL; } - pm800_data = devm_kzalloc(&pdev->dev, sizeof(*pm800_data), - GFP_KERNEL); - if (!pm800_data) - return -ENOMEM; - - pm800_data->map = chip->subchip->regmap_power; - pm800_data->chip = chip; - - platform_set_drvdata(pdev, pm800_data); - config.dev = chip->dev; - config.regmap = pm800_data->map; + config.regmap = chip->subchip->regmap_power; for (i = 0; i < PM800_ID_RG_MAX; i++) { struct regulator_dev *regulator; diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 753a6a1b30c3..35d767aeeb57 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c @@ -235,6 +235,8 @@ static const struct regulator_ops pm8606_preg_ops = { { \ .desc = { \ .name = "PREG", \ + .of_match = of_match_ptr("PREG"), \ + .regulators_node = of_match_ptr("regulators"), \ .ops = &pm8606_preg_ops, \ .type = REGULATOR_CURRENT, \ .id = PM8606_ID_PREG, \ @@ -249,6 +251,8 @@ static const struct regulator_ops pm8606_preg_ops = { { \ .desc = { \ .name = #vreg, \ + .of_match = of_match_ptr(#vreg), \ + .regulators_node = of_match_ptr("regulators"), \ .ops = &pm8607_regulator_ops, \ .type = REGULATOR_VOLTAGE, \ .id = PM8607_ID_##vreg, \ @@ -270,6 +274,8 @@ static const struct regulator_ops pm8606_preg_ops = { { \ .desc = { \ .name = "LDO" #_id, \ + .of_match = of_match_ptr("LDO" #_id), \ + .regulators_node = of_match_ptr("regulators"), \ .ops = &pm8607_regulator_ops, \ .type = REGULATOR_VOLTAGE, \ .id = PM8607_ID_LDO##_id, \ @@ -309,36 +315,6 @@ static struct pm8607_regulator_info pm8606_regulator_info[] = { PM8606_PREG(PREREGULATORB, 5), }; -#ifdef CONFIG_OF -static int pm8607_regulator_dt_init(struct platform_device *pdev, - struct pm8607_regulator_info *info, - struct regulator_config *config) -{ - struct device_node *nproot, *np; - nproot = pdev->dev.parent->of_node; - if (!nproot) - return -ENODEV; - nproot = of_get_child_by_name(nproot, "regulators"); - if (!nproot) { - dev_err(&pdev->dev, "failed to find regulators node\n"); - return -ENODEV; - } - for_each_child_of_node(nproot, np) { - if (of_node_name_eq(np, info->desc.name)) { - config->init_data = - of_get_regulator_init_data(&pdev->dev, np, - &info->desc); - config->of_node = np; - break; - } - } - of_node_put(nproot); - return 0; -} -#else -#define pm8607_regulator_dt_init(x, y, z) (-1) -#endif - static int pm8607_regulator_probe(struct platform_device *pdev) { struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); @@ -373,12 +349,11 @@ static int pm8607_regulator_probe(struct platform_device *pdev) if ((i == PM8607_ID_BUCK3) && chip->buck3_double) info->slope_double = 1; - config.dev = &pdev->dev; + config.dev = chip->dev; config.driver_data = info; - if (pm8607_regulator_dt_init(pdev, info, &config)) - if (pdata) - config.init_data = pdata; + if (pdata) + config.init_data = pdata; if (chip->id == CHIP_PM8607) config.regmap = chip->regmap; diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index b7f249ee5e68..6c37f0df9323 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig @@ -223,6 +223,7 @@ config REGULATOR_CPCAP config REGULATOR_DA903X tristate "Dialog Semiconductor DA9030/DA9034 regulators" depends on PMIC_DA903X + depends on !CC_IS_CLANG # https://bugs.llvm.org/show_bug.cgi?id=38789 help Say y here to support the BUCKs and LDOs regulators found on Dialog Semiconductor DA9030/DA9034 PMIC. @@ -839,6 +840,13 @@ config REGULATOR_STM32_VREFBUF This driver can also be built as a module. If so, the module will be called stm32-vrefbuf. +config REGULATOR_STM32_PWR + bool "STMicroelectronics STM32 PWR" + depends on ARCH_STM32 || COMPILE_TEST + help + This driver supports internal regulators (1V1, 1V8, 3V3) in the + STMicroelectronics STM32 chips. + config REGULATOR_STPMIC1 tristate "STMicroelectronics STPMIC1 PMIC Regulators" depends on MFD_STPMIC1 @@ -1010,7 +1018,8 @@ config REGULATOR_TWL4030 config REGULATOR_UNIPHIER tristate "UniPhier regulator driver" depends on ARCH_UNIPHIER || COMPILE_TEST - depends on OF && MFD_SYSCON + depends on OF + select REGMAP_MMIO default ARCH_UNIPHIER help Support for regulators implemented on Socionext UniPhier SoCs. diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 1169f8a27d91..93f53840e8f1 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile @@ -105,6 +105,7 @@ obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o obj-$(CONFIG_REGULATOR_SC2731) += sc2731-regulator.o obj-$(CONFIG_REGULATOR_SKY81452) += sky81452-regulator.o obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o +obj-$(CONFIG_REGULATOR_STM32_PWR) += stm32-pwr.o obj-$(CONFIG_REGULATOR_STPMIC1) += stpmic1_regulator.o obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c index de2644490f0d..438509f55f05 100644 --- a/drivers/regulator/ab3100.c +++ b/drivers/regulator/ab3100.c @@ -48,7 +48,6 @@ * @regreg: regulator register number in the AB3100 */ struct ab3100_regulator { - struct regulator_dev *rdev; struct device *dev; struct ab3100_platform_data *plfdata; u8 regreg; @@ -354,14 +353,13 @@ static int ab3100_get_voltage_regulator_external(struct regulator_dev *reg) return 0; } -static struct regulator_ops regulator_ops_fixed = { - .list_voltage = regulator_list_voltage_linear, +static const struct regulator_ops regulator_ops_fixed = { .enable = ab3100_enable_regulator, .disable = ab3100_disable_regulator, .is_enabled = ab3100_is_enabled_regulator, }; -static struct regulator_ops regulator_ops_variable = { +static const struct regulator_ops regulator_ops_variable = { .enable = ab3100_enable_regulator, .disable = ab3100_disable_regulator, .is_enabled = ab3100_is_enabled_regulator, @@ -370,7 +368,7 @@ static struct regulator_ops regulator_ops_variable = { .list_voltage = regulator_list_voltage_table, }; -static struct regulator_ops regulator_ops_variable_sleepable = { +static const struct regulator_ops regulator_ops_variable_sleepable = { .enable = ab3100_enable_regulator, .disable = ab3100_disable_regulator, .is_enabled = ab3100_is_enabled_regulator, @@ -386,14 +384,14 @@ static struct regulator_ops regulator_ops_variable_sleepable = { * is an on/off switch plain an simple. The external * voltage is defined in the board set-up if any. |