linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ravikumar Kattekola <callmerk1986@gmail.com>
To: Mark Brown <broonie@kernel.org>, Peter Geis <pgwipeout@gmail.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-mmc@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	devicetree@vger.kernel.org
Subject: Re: [BUG] mmc_regulator_set_ocr can't cope with regulator-fixed
Date: Fri, 6 Aug 2021 13:44:45 +0530	[thread overview]
Message-ID: <81006771-99bf-a5f9-4001-2cf3dc84f69d@gmail.com> (raw)
In-Reply-To: <20210805130842.GO26252@sirena.org.uk>

Hi,
Resending my reply as my Mail client settings prevented delivery

On 05/08/21 6:38 pm, Mark Brown wrote:
> On Thu, Aug 05, 2021 at 08:58:58AM -0400, Peter Geis wrote:
>> On Thu, Aug 5, 2021 at 8:47 AM Mark Brown <broonie@kernel.org> wrote:
> 
>>> One thing to watch out for with this approach is if there's things that
>>> really need a specific voltage to be set then you'll have to stop those
>>> things happening if you've got a voltage regulator that can't deliver a
>>> voltage in the required range.  I don't know if this affects MMC or not,
>>> if it's just a case of being less efficient it's not such an issue.
> 
>> Yeah, but if this is a fixed regulator and it's a problem, then the
>> hardware is screwed anyways.
> 
> Well, the fact that the voltage is being changed at runtime indicates
> that we're changing something from whatever was in the fixed setup - it
> can sometimes be that we don't have access to some higher performance or
> lower power features for example.  That's not ideal but works perfectly
> safely.
> 
Suggested approach of checking "mmc->ocr_avail" might work.

But, IMO mmc core should check if the voltage can be changed or not

before trying to do regulator_set_voltage() in mmc_regulator_set_ocr().

Wouldn't that be better and solve this issue for other hosts as well.

Something like below in mmc_regulator_set_ocr ():

+               result = regulator_check_voltage_constraints(supply,
+                       min_uV, max_uV);
+               if(!result) {
+                       result = regulator_set_voltage(supply, min_uV, 
max_uV);
+                       if (result != -EINVAL && !mmc->regulator_enabled) {
+                               result = regulator_enable(supply);
+                               if (!result)
+                                       mmc->regulator_enabled = true;
+                       }

We could wrap the existing check_voltage function

+/* Check voltage constraints helper function */
+int regulator_check_voltage_constraints(struct regulator *regulator,
+                                       int min_uV, int max_uV)
+{
+       return regulator_check_voltage(regulator->rdev, &min_uV, &max_uV);
+}
+EXPORT_SYMBOL_GPL(regulator_check_voltage_constraints);

I hope this makes sense.

Regards,
RK

  reply	other threads:[~2021-08-06  8:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210804143357epcas1p1c67eca591d8bb557c11b8175baaa8550@epcas1p1.samsung.com>
2021-08-04 14:32 ` [BUG] mmc_regulator_set_ocr can't cope with regulator-fixed Peter Geis
2021-08-04 16:15   ` Mark Brown
2021-08-05 10:00   ` Jaehoon Chung
2021-08-05 11:38     ` Peter Geis
2021-08-05 12:46       ` Mark Brown
2021-08-05 12:58         ` Peter Geis
2021-08-05 13:08           ` Mark Brown
2021-08-06  8:14             ` Ravikumar Kattekola [this message]
2021-08-06 10:59               ` 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=81006771-99bf-a5f9-4001-2cf3dc84f69d@gmail.com \
    --to=callmerk1986@gmail.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jh80.chung@samsung.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=pgwipeout@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).