Skip to content

Commit 41cce1b

Browse files
Dragan Simicgregkh
authored andcommitted
regulator: rk808: Restrict DVS GPIOs to the RK808 variant only
[ Upstream commit 0d214f2 ] The rk808-regulator driver supports multiple PMIC variants from the Rockckip RK80x and RK81x series, but the DVS GPIOs are supported on the RK808 variant only, according to the DT bindings [1][2][3][4][5][6] and the datasheets for the supported PMIC variants. [7][8][9][10][11][12] Thus, change the probe path so the "dvs-gpios" property is checked for and its value possibly used only when the handled PMIC variant is RK808. There's no point in doing that on the other PMIC variants, because they don't support the DVS GPIOs, and it goes against the DT bindings to allow a possible out- of-place "dvs-gpios" property to actually be handled in the driver. This eliminates the following messages, emitted when the "dvs-gpios" property isn't found in the DT, from the kernel log on boards that actually don't use the RK808 variant, which may have provided a source of confusion: rk808-regulator rk808-regulator.2.auto: there is no dvs0 gpio rk808-regulator rk808-regulator.2.auto: there is no dvs1 gpio Furthermore, demote these kernel messages to debug messages, because they are useful during the board bringup phase only. Emitting them afterwards, on the boards that use the RK808 variant, but actually don't use the DVS0/1 GPIOs, clutters the kernel log a bit, while they provide no value and may actually cause false impression that some PMIC-related issues are present. [1] Documentation/devicetree/bindings/mfd/rockchip,rk805.yaml [2] Documentation/devicetree/bindings/mfd/rockchip,rk806.yaml [3] Documentation/devicetree/bindings/mfd/rockchip,rk808.yaml [4] Documentation/devicetree/bindings/mfd/rockchip,rk816.yaml [5] Documentation/devicetree/bindings/mfd/rockchip,rk817.yaml [6] Documentation/devicetree/bindings/mfd/rockchip,rk818.yaml [7] https://rockchip.fr/RK805%20datasheet%20V1.2.pdf [8] https://wmsc.lcsc.com/wmsc/upload/file/pdf/v2/lcsc/2401261533_Rockchip-RK806-1_C5156483.pdf [9] https://rockchip.fr/RK808%20datasheet%20V1.4.pdf [10] https://rockchip.fr/RK816%20datasheet%20V1.3.pdf [11] https://rockchip.fr/RK817%20datasheet%20V1.01.pdf [12] https://rockchip.fr/RK818%20datasheet%20V1.0.pdf Fixes: 1137529 ("regulator: rk808: Add regulator driver for RK818") Reported-by: Diederik de Haas <didi.debian@cknow.org> Signed-off-by: Dragan Simic <dsimic@manjaro.org> Link: https://patch.msgid.link/9a415c59699e76fc7b88a2552520a4ca2538f44e.1728902488.git.dsimic@manjaro.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f390525 commit 41cce1b

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

drivers/regulator/rk808-regulator.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ static int rk808_regulator_dt_parse_pdata(struct device *dev,
18531853
}
18541854

18551855
if (!pdata->dvs_gpio[i]) {
1856-
dev_info(dev, "there is no dvs%d gpio\n", i);
1856+
dev_dbg(dev, "there is no dvs%d gpio\n", i);
18571857
continue;
18581858
}
18591859

@@ -1889,12 +1889,6 @@ static int rk808_regulator_probe(struct platform_device *pdev)
18891889
if (!pdata)
18901890
return -ENOMEM;
18911891

1892-
ret = rk808_regulator_dt_parse_pdata(&pdev->dev, regmap, pdata);
1893-
if (ret < 0)
1894-
return ret;
1895-
1896-
platform_set_drvdata(pdev, pdata);
1897-
18981892
switch (rk808->variant) {
18991893
case RK805_ID:
19001894
regulators = rk805_reg;
@@ -1905,6 +1899,11 @@ static int rk808_regulator_probe(struct platform_device *pdev)
19051899
nregulators = ARRAY_SIZE(rk806_reg);
19061900
break;
19071901
case RK808_ID:
1902+
/* DVS0/1 GPIOs are supported on the RK808 only */
1903+
ret = rk808_regulator_dt_parse_pdata(&pdev->dev, regmap, pdata);
1904+
if (ret < 0)
1905+
return ret;
1906+
19081907
regulators = rk808_reg;
19091908
nregulators = RK808_NUM_REGULATORS;
19101909
break;
@@ -1930,6 +1929,8 @@ static int rk808_regulator_probe(struct platform_device *pdev)
19301929
return -EINVAL;
19311930
}
19321931

1932+
platform_set_drvdata(pdev, pdata);
1933+
19331934
config.dev = &pdev->dev;
19341935
config.driver_data = pdata;
19351936
config.regmap = regmap;

0 commit comments

Comments
 (0)