Skip to contentSkip to conversation

Fix MAX77620 regulator driver regression

PATCH In review Dmitry Osipenko 2 participants 4 messages May 23, 2021 – May 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Fix MAX77620 regulator driver regression

Hi,

The next-20210521 started to fail on Nexus 7 because of the change to regulator core that caused regression of the MAX77620 regulator driver. The regulator driver is now getting a deferred probe and turned out driver wasn't ready for this. The root of the problem is that OF node of the PMIC MFD sub-device is shared with the PINCTRL sub-device and we need to convey this information to the driver core, otherwise it will try to claim GPIO pin that is already claimed by PINCTRL and fail the probe.

Dmitry Osipenko (2):
regulator: max77620: Use device_set_of_node_from_dev()
regulator: max77620: Silence deferred probe error

 drivers/regulator/max77620-regulator.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 regulator: max77620: Use device_set_of_node_from_dev()

The MAX77620 driver fails to re-probe on deferred probe because driver core tries to claim resources that are already claimed by the PINCTRL device. Use device_set_of_node_from_dev() helper which marks OF node as reused, skipping erroneous execution of pinctrl_bind_pins() for the PMIC device on the re-probe.

Fixes aea6cb99703e ("regulator: resolve supply after creating regulator")
---
 drivers/regulator/max77620-regulator.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/regulator/max77620-regulator.c +7 -0
index 8d9731e4052b..5c439c850d09 100644
@@ -814,6 +814,13 @@ static int max77620_regulator_probe(struct platform_device *pdev)
 	config.dev = dev;
 	config.driver_data = pmic;
 
+	/*
+	 * Set of_node_reuse flag to prevent driver core from attempting to
+	 * claim any pinmux resources already claimed by the parent device.
+	 * Otherwise PMIC driver will fail to re-probe.
+	 */
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
+
 	for (id = 0; id < MAX77620_NUM_REGS; id++) {
 		struct regulator_dev *rdev;
 		struct regulator_desc *rdesc;
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 regulator: max77620: Silence deferred probe error

In reply to Dmitry Osipenko

One of previous changes to regulator core causes PMIC regulators to re-probe until supply regulator is registered. Silence noisy error message about the deferred probe.

---
 drivers/regulator/max77620-regulator.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/regulator/max77620-regulator.c +4 -6
index 5c439c850d09..3cf8f085170a 100644
@@ -846,12 +846,10 @@ static int max77620_regulator_probe(struct platform_device *pdev)
 			return ret;
 
 		rdev = devm_regulator_register(dev, rdesc, &config);
-		if (IS_ERR(rdev)) {
-			ret = PTR_ERR(rdev);
-			dev_err(dev, "Regulator registration %s failed: %d\n",
-				rdesc->name, ret);
-			return ret;
-		}
+		if (IS_ERR(rdev))
+			return dev_err_probe(dev, PTR_ERR(rdev),
+					     "Regulator registration %s failed\n",
+					     rdesc->name);
 	}
 
 	return 0;
Signature · 1 line
2.30.2
maintainer
#3 lore raw
In reply to Dmitry Osipenko
Quoted 10 lines · Dmitry Osipenko

The next-20210521 started to fail on Nexus 7 because of the change to regulator core that caused regression of the MAX77620 regulator driver. The regulator driver is now getting a deferred probe and turned out driver wasn't ready for this. The root of the problem is that OF node of the PMIC MFD sub-device is shared with the PINCTRL sub-device and we need to convey this information to the driver core, otherwise it will try to claim GPIO pin that is already claimed by PINCTRL and fail the probe.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/2] regulator: max77620: Use device_set_of_node_from_dev()

      commit: 6f55c5dd1118b3076d11d9cb17f5c5f4bc3a1162
[2/2] regulator: max77620: Silence deferred probe error
      commit: 62499a94ce5b9a41047dbadaad885347b1176079

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark