2013-07-30 11:45:30

by Mark Brown

[permalink] [raw]
Subject: [PATCH 0/5] Optional regulator support

This patch series adds a variant of regulator_get() which allows
regulator consumers to tell the core that the supply they are requesting
may genuinely be absent in the system. The goal is to help address some
of the problems with handling errors in regulator_get() in drivers that
are newly converted to the regulator API by allowing the core to provide
stub regulators for supplies that aren't hooked up without disrupting
the operation of drivers like MMC drivers which may genuinely not have
some of their supplies hooked up.

Currently the code simply introduces a new API call with exactly the
same implementation as regulator_get() so there should be zero impact
from the series other than a slightly larger kernel.

Right now all the MMC users are converted over as-is, though it does
look like drivers such as sdhci really ought to be insisting on having a
regulator for VMMC in the same way that the MMC core helper does (and
indeed in that case it looks like it ought to be converted over to the
core code).

If this series is OK I'd like to merge it via the regulator tree so that
the functionality to make use of the optional regulators can be built
out on top of it.

Mark Brown (5):
regulator: core: Provide hints to the core about optional supplies
mmc: core: Indicate that vmmcq may be absent
mmc: sdhci: Indicate that regulators may be absent
mmc: dw_mmc: Indicate that regulators may be absent
mmc: pxamci: Indicate that regulators may be absent

drivers/mmc/core/core.c | 2 +-
drivers/mmc/host/dw_mmc.c | 2 +-
drivers/mmc/host/pxamci.c | 2 +-
drivers/mmc/host/sdhci.c | 4 +--
drivers/regulator/core.c | 59 ++++++++++++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 18 +++++++++++-
6 files changed, 81 insertions(+), 6 deletions(-)


Attachments:
(No filename) (1.82 kB)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-07-30 12:40:52

by Chris Ball

[permalink] [raw]
Subject: Re: [PATCH 0/5] Optional regulator support

Hi,

On Tue, Jul 30 2013, Mark Brown wrote:
> This patch series adds a variant of regulator_get() which allows
> regulator consumers to tell the core that the supply they are requesting
> may genuinely be absent in the system. The goal is to help address some
> of the problems with handling errors in regulator_get() in drivers that
> are newly converted to the regulator API by allowing the core to provide
> stub regulators for supplies that aren't hooked up without disrupting
> the operation of drivers like MMC drivers which may genuinely not have
> some of their supplies hooked up.
>
> Currently the code simply introduces a new API call with exactly the
> same implementation as regulator_get() so there should be zero impact
> from the series other than a slightly larger kernel.

Looks good:

Acked-by: Chris Ball <[email protected]>

> Right now all the MMC users are converted over as-is, though it does
> look like drivers such as sdhci really ought to be insisting on having a
> regulator for VMMC in the same way that the MMC core helper does (and
> indeed in that case it looks like it ought to be converted over to the
> core code).

I didn't follow this part -- I don't think the MMC core insists on a
VMMC regulator, and I don't think sdhci should either, because e.g.
an x86 laptop isn't going to have one. What am I missing?

Thanks,

- Chris.
--
Chris Ball <[email protected]> <http://printf.net/>

2013-07-30 17:24:42

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH 0/5] Optional regulator support

On Tue, Jul 30, 2013 at 01:40:28PM +0100, Chris Ball wrote:
> On Tue, Jul 30 2013, Mark Brown wrote:

> > Right now all the MMC users are converted over as-is, though it does
> > look like drivers such as sdhci really ought to be insisting on having a
> > regulator for VMMC in the same way that the MMC core helper does (and
> > indeed in that case it looks like it ought to be converted over to the
> > core code).

> I didn't follow this part -- I don't think the MMC core insists on a
> VMMC regulator, and I don't think sdhci should either, because e.g.
> an x86 laptop isn't going to have one. What am I missing?

You're missing the fact that there will be a VMMC regulator there since
the card needs power to function, it just might not be one that software
knows about or can control. If it's one that software can control
that's not mapped in properly (eg, because the driver for the regulator
wasn't loaded) then obviously that's a serious problem and power saving
features in the regulator API may for example turn off the supply even
if it's on by default since they can't tell it's in use.

As things stand the expectation for x86 type systems is that MMC
controllers attached via PCI or USB ought to be setting up a fixed
regulator so that the consumer part can proceed without ignoring errors
that might be serious on other systems. It's probably not a bad idea to
do this anyway though hopefully in the future this work will make it
less needed. For embedded systems the system integration ought to be
doing the same thing, normally as part of the configuration of the PMIC.

The goal of this series is to make it much easier for the regulator core
to transparently support such systems where the regulators aren't
visible to software by transparently stubbing out normal supplies that
really must be present somehow for the hardware to operate without
confusing things by also stubbing out suppies that may be missing in
normal operation. This is the problem for the existing stubbing support
- it works well for normal supplies but it means that any consumer that
wants to handle a supply that's not there can't tell it's missing.


Attachments:
(No filename) (2.10 kB)
signature.asc (836.00 B)
Digital signature
Download all attachments