Re: [PATCH v6 0/5] Add coupled regulators mechanism

From: Maciej Purski
Date: Mon Mar 12 2018 - 08:23:05 EST


On 03/09/2018 04:58 PM, Tony Lindgren wrote:
* Mark Brown <broonie@xxxxxxxxxx> [180309 12:43]:
On Fri, Mar 09, 2018 at 01:22:02PM +0100, Maciej Purski wrote:

I would like to kindly ask Fabio Estevam and Tony Lindgren to test the patch
series on their boards.

I gave it a quick try and this set still causes at least mmc0
to fail for me.

Regards,

Tony



Thanks. Here's a small patch, which adds some debugs. Maybe they will reveal,
where the problem is.

Best Regards,
Maciej Purski

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f1f11cf..0e80ba5 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2280,7 +2280,6 @@ int regulator_enable(struct regulator *regulator)
{
struct regulator_dev *rdev = regulator->rdev;
int ret = 0;
- int ret2;

if (rdev->coupling_desc.n_resolved != rdev->coupling_desc.n_coupled) {
rdev_err(rdev, "not all coupled regulators registered\n");
@@ -2298,15 +2297,9 @@ int regulator_enable(struct regulator *regulator)

regulator_lock_dependent(rdev);
ret = _regulator_enable(rdev);
- ret2 = regulator_balance_voltage(rdev, PM_SUSPEND_ON);
+ regulator_balance_voltage(rdev, PM_SUSPEND_ON);
regulator_unlock_dependent(rdev);

- if (ret2 != 0) {
- rdev_err(rdev,
- "balancing failed when trying to enable regulator: %d",
- ret2);
- }
-
if (ret != 0 && rdev->supply)
regulator_disable(rdev->supply);

@@ -3149,7 +3142,7 @@ static int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV,
ret = regulator_set_voltage_unlocked(rdev->supply,
best_supply_uV, INT_MAX, state);
if (ret)
- dev_err(&rdev->dev, "Failed to decrease supply voltage: %d\n",
+ dev_warn(&rdev->dev, "Failed to decrease supply voltage: %d\n",
ret);
/* No need to fail here */
ret = 0;
@@ -3332,11 +3325,8 @@ static int regulator_balance_voltage(struct regulator_dev *rdev,
ret = regulator_set_voltage_rdev(best_rdev, best_uV,
best_uV, state);

- if (ret < 0) {
- rdev_err(rdev,
- "Failed to set voltage with error: %d", ret);
+ if (ret < 0)
goto out;
- }
}

out: