mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: WEN Pingbo <pingbo.wen@linaro.org>
Cc: linux-kernel@vger.kernel.org, lgirdwood@gmail.com,
	vincent.guittot@linaro.org, stephen.boyd@linaro.org
Subject: Re: [RFC PATCH] regulator: introduce boot protection flag
Date: Wed, 8 Jun 2016 18:16:08 +0100	[thread overview]
Message-ID: <20160608171608.GM7510@sirena.org.uk> (raw)
In-Reply-To: <1462777508-24934-1-git-send-email-pingbo.wen@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2369 bytes --]

On Mon, May 09, 2016 at 03:05:08PM +0800, WEN Pingbo wrote:

> In some platforms, critical shared regulator is initialized in
> bootloader. But during kernel booting, the driver probing order and
> conflicting operations from other regulator consumers, may set the
> regulator in a undefined state, which will cause serious problem.

> This patch try to add a boot_protection flag in regulator constraints.

This still feels like a short term hack that doesn't belong in an ABI.
It's all very implementation specific and not very robust, it's not
describing the outcome we're looking for but rather a very specific
behaviour which won't work outside of a fairly narrow system
configuration.  The difficulty in coherently explaining what the end of
boot is and what protection means is a big warning sign here.

I think you need to be looking at some combination of getting the
devices you're interested in started up early and more precisely
describing the end result you're trying to achieve.  The issues with
probe deferral do seem related here, it's another symptom of not really
making any decisions about init ordering and so sometimes making bad
ones.

> And regulator core will postpone all operations until all consumers
> have taked their place.

It doesn't, it postpones them until late_initacall().  This is both
after the consumers have loaded if they are built in and before any
consumers built as modules come up.

> The boot_protection flag only work before late_initicall. And as other
> constraints liked, you can specify this flag in a board file, or in
> dts file.

Anything added to the DT ABI needs a binding.

> +	/* constraints check has already done */
> +	if (rdev->boot_mode)
> +		rdev->desc->ops->set_mode(rdev, rdev->boot_mode);

This whole sequence of code ignores errors - that's not great.  We
should at least log them.

> +	mutex_unlock(&rdev->mutex);
> +
> +	if (regulator)
> +		regulator_set_voltage(regulator, regulator->min_uV,
> +				regulator->max_uV);

That's...  exciting.  There's a couple of issues here.  One is that
this is not operating on the rdev but rather on a consumer regulator
device, the other is that we drop out of the lock before doing the
update which tends to be a warning sign that something fun is going on
and at least an internal function should be used.  These two most likely
come down to the same issue.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2016-06-08 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  7:05 WEN Pingbo
2016-06-08 17:16 ` Mark Brown [this message]
2016-06-15 12:05   ` Pingbo Wen
2016-06-15 13:32     ` Mark Brown
2016-06-17  3:34       ` Pingbo Wen
2016-06-17 11:42         ` Mark Brown
2016-06-23 12:02           ` Pingbo Wen

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=20160608171608.GM7510@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pingbo.wen@linaro.org \
    --cc=stephen.boyd@linaro.org \
    --cc=vincent.guittot@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

all inboxes | Powered by JetHome®