mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "A.S. Dong" <aisheng.dong@nxp.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	Robin Gong <yibin.gong@nxp.com>,
	"dongas86@gmail.com" <dongas86@gmail.com>
Subject: RE: [PATCH] regulator: core: Allow dummy regulators for supplies
Date: Wed, 12 Apr 2017 15:33:14 +0000	[thread overview]
Message-ID: <DB5PR04MB1431F575508A7AD0EE0E2B9980030@DB5PR04MB1431.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20170411203636.qyxm4e2pwd4cwl2i@sirena.org.uk>

Hi Mark,

> -----Original Message-----
> From: Mark Brown [mailto:broonie@kernel.org]
> Sent: Wednesday, April 12, 2017 4:37 AM
> To: A.S. Dong
> Cc: Liam Girdwood; linux-kernel@vger.kernel.org; shawnguo@kernel.org;
> 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.

Regards
Dong Aisheng

  reply	other threads:[~2017-04-12 15:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 20:34 Mark Brown
2017-04-11 20:36 ` Mark Brown
2017-04-12 15:33   ` A.S. Dong [this message]
2017-04-13 12:20     ` Mark Brown
2017-04-13 13:44       ` Dong Aisheng
2017-04-14 17:12 ` Applied "regulator: core: Allow dummy regulators for supplies" to the regulator tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB5PR04MB1431F575508A7AD0EE0E2B9980030@DB5PR04MB1431.eurprd04.prod.outlook.com \
    --to=aisheng.dong@nxp.com \
    --cc=broonie@kernel.org \
    --cc=dongas86@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=yibin.gong@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®