linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Fix MAX77620 regulator driver regression
@ 2021-05-23 22:42 Dmitry Osipenko
  2021-05-23 22:42 ` [PATCH v1 1/2] regulator: max77620: Use device_set_of_node_from_dev() Dmitry Osipenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2021-05-23 22:42 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Mark Brown, Liam Girdwood
  Cc: linux-kernel, linux-tegra

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(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 1/2] regulator: max77620: Use device_set_of_node_from_dev()
  2021-05-23 22:42 [PATCH v1 0/2] Fix MAX77620 regulator driver regression Dmitry Osipenko
@ 2021-05-23 22:42 ` Dmitry Osipenko
  2021-05-23 22:42 ` [PATCH v1 2/2] regulator: max77620: Silence deferred probe error Dmitry Osipenko
  2021-05-24 11:59 ` [PATCH v1 0/2] Fix MAX77620 regulator driver regression Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2021-05-23 22:42 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Mark Brown, Liam Girdwood
  Cc: linux-kernel, linux-tegra

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")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/regulator/max77620-regulator.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 8d9731e4052b..5c439c850d09 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] regulator: max77620: Silence deferred probe error
  2021-05-23 22:42 [PATCH v1 0/2] Fix MAX77620 regulator driver regression Dmitry Osipenko
  2021-05-23 22:42 ` [PATCH v1 1/2] regulator: max77620: Use device_set_of_node_from_dev() Dmitry Osipenko
@ 2021-05-23 22:42 ` Dmitry Osipenko
  2021-05-24 11:59 ` [PATCH v1 0/2] Fix MAX77620 regulator driver regression Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Osipenko @ 2021-05-23 22:42 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Mark Brown, Liam Girdwood
  Cc: linux-kernel, linux-tegra

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.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/regulator/max77620-regulator.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c
index 5c439c850d09..3cf8f085170a 100644
--- a/drivers/regulator/max77620-regulator.c
+++ b/drivers/regulator/max77620-regulator.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 0/2] Fix MAX77620 regulator driver regression
  2021-05-23 22:42 [PATCH v1 0/2] Fix MAX77620 regulator driver regression Dmitry Osipenko
  2021-05-23 22:42 ` [PATCH v1 1/2] regulator: max77620: Use device_set_of_node_from_dev() Dmitry Osipenko
  2021-05-23 22:42 ` [PATCH v1 2/2] regulator: max77620: Silence deferred probe error Dmitry Osipenko
@ 2021-05-24 11:59 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2021-05-24 11:59 UTC (permalink / raw)
  To: Dmitry Osipenko, Jonathan Hunter, Thierry Reding, Liam Girdwood
  Cc: Mark Brown, linux-kernel, linux-tegra

On Mon, 24 May 2021 01:42:41 +0300, Dmitry Osipenko wrote:
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-24 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 22:42 [PATCH v1 0/2] Fix MAX77620 regulator driver regression Dmitry Osipenko
2021-05-23 22:42 ` [PATCH v1 1/2] regulator: max77620: Use device_set_of_node_from_dev() Dmitry Osipenko
2021-05-23 22:42 ` [PATCH v1 2/2] regulator: max77620: Silence deferred probe error Dmitry Osipenko
2021-05-24 11:59 ` [PATCH v1 0/2] Fix MAX77620 regulator driver regression Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).