Skip to content

Commit 02ecf56

Browse files
krzkgregkh
authored andcommitted
regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
commit b16bef6 upstream. The driver and its bindings, before commit 04f9f06 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4") were requiring to provide at least one safe/default voltage for DVS registers if DVS GPIO is not being enabled. IOW, if s5m8767,pmic-buck2-uses-gpio-dvs is missing, the s5m8767,pmic-buck2-dvs-voltage should still be present and contain one voltage. This requirement was coming from driver behavior matching this condition (none of DVS GPIO is enabled): it was always initializing the DVS selector pins to 0 and keeping the DVS enable setting at reset value (enabled). Therefore if none of DVS GPIO is enabled in devicetree, driver was configuring the first DVS voltage for buck[234]. Mentioned commit 04f9f06 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4") broke it because DVS voltage won't be parsed from devicetree if DVS GPIO is not enabled. After the change, driver will configure bucks to use the register reset value as voltage which might have unpleasant effects. Fix this by relaxing the bindings constrain: if DVS GPIO is not enabled in devicetree (therefore DVS voltage is also not parsed), explicitly disable it. Cc: <stable@vger.kernel.org> Fixes: 04f9f06 ("regulator: s5m8767: Modify parsing method of the voltage table of buck2/3/4") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Acked-by: Rob Herring <robh@kernel.org> Message-Id: <20211008113723.134648-2-krzysztof.kozlowski@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5b7e3bb commit 02ecf56

2 files changed

Lines changed: 17 additions & 25 deletions

File tree

‎Documentation/devicetree/bindings/regulator/samsung,s5m8767.txt‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ common regulator binding documented in:
1313

1414

1515
Required properties of the main device node (the parent!):
16+
- s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
17+
for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
18+
19+
[1] If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
20+
property is specified, then all the eight voltage values for the
21+
's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
22+
23+
Optional properties of the main device node (the parent!):
1624
- s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
1725
units for buck2 when changing voltage using gpio dvs. Refer to [1] below
1826
for additional information.
@@ -25,19 +33,6 @@ Required properties of the main device node (the parent!):
2533
units for buck4 when changing voltage using gpio dvs. Refer to [1] below
2634
for additional information.
2735

28-
- s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
29-
for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
30-
31-
[1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
32-
property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'
33-
property should specify atleast one voltage level (which would be a
34-
safe operating voltage).
35-
36-
If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
37-
property is specified, then all the eight voltage values for the
38-
's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
39-
40-
Optional properties of the main device node (the parent!):
4136
- s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
4237
- s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.
4338
- s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.

‎drivers/regulator/s5m8767.c‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -850,18 +850,15 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
850850
/* DS4 GPIO */
851851
gpio_direction_output(pdata->buck_ds[2], 0x0);
852852

853-
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
854-
pdata->buck4_gpiodvs) {
855-
regmap_update_bits(s5m8767->iodev->regmap_pmic,
856-
S5M8767_REG_BUCK2CTRL, 1 << 1,
857-
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
858-
regmap_update_bits(s5m8767->iodev->regmap_pmic,
859-
S5M8767_REG_BUCK3CTRL, 1 << 1,
860-
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
861-
regmap_update_bits(s5m8767->iodev->regmap_pmic,
862-
S5M8767_REG_BUCK4CTRL, 1 << 1,
863-
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
864-
}
853+
regmap_update_bits(s5m8767->iodev->regmap_pmic,
854+
S5M8767_REG_BUCK2CTRL, 1 << 1,
855+
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
856+
regmap_update_bits(s5m8767->iodev->regmap_pmic,
857+
S5M8767_REG_BUCK3CTRL, 1 << 1,
858+
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
859+
regmap_update_bits(s5m8767->iodev->regmap_pmic,
860+
S5M8767_REG_BUCK4CTRL, 1 << 1,
861+
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
865862

866863
/* Initialize GPIO DVS registers */
867864
for (i = 0; i < 8; i++) {

0 commit comments

Comments
 (0)