[lkml]   [2017]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRE: [PATCH] regulator: core: Allow dummy regulators for supplies
Hi Mark,

> -----Original Message-----
> From: Mark Brown []
> Sent: Wednesday, April 12, 2017 4:37 AM
> To: A.S. Dong
> Cc: Liam Girdwood;;;
> Robin Gong
> Subject: Re: [PATCH] regulator: core: Allow dummy regulators for supplies
> On Tue, Apr 11, 2017 at 09:34:37PM +0100, Mark Brown wrote:
> > Rather than just not resolving the supply when there is explicitly no
> > supply mapping fall through and allow a dummy supply to be substituted.
> I should mention that this is completely untested, sorry.

It did break the MX6Q cpufreq as follows:
[ 3.950097] coda 2040000.vpu: Direct firmware load for vpu/vpu_fw_imx6q.bin failed with error -2
[ 3.950111] coda 2040000.vpu: firmware request failed
[ 4.074044] cpu cpu0: failed to scale vddarm down: -22
[ 4.079262] cpu cpu0: failed to scale vddsoc down: -22
[ 4.084809] cpu cpu0: failed to scale vddpu down: -22

It seems the regulator supply behavior is changed a bit after apply this patch.

Before this patch, the regulator core will not report an error if can't resolve
A non exist supply. (It's exactly what this patch removes)

Now we allow a supply to be a dummy regulator. But due to
fc42112c0eaa ("regulator: core: Propagate voltage changes to supply regulators")
which supports propagate voltage change to supply regulator,
then it will certainly fail if we want to configure a dummy supply.

I tried a quick fix as follows and test seemed ok.
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 43dafac..a1c952db 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2935,7 +2935,8 @@ static int regulator_set_voltage_unlocked(struct regulator *regulator,
if (ret < 0)
goto out2;

- if (rdev->supply && (rdev->desc->min_dropout_uV ||
+ if (rdev->supply && rdev->supply->rdev != dummy_regulator_rdev &&
+ (rdev->desc->min_dropout_uV ||

Not sure if it's a sufficient fix.
Please help check it.

Dong Aisheng
 \ /
  Last update: 2017-04-12 17:34    [W:0.052 / U:1.576 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site