History log of /linux-master/drivers/regulator/wm8994-regulator.c
Revision Date Author Comments
# eef644d3 23-Mar-2023 Marek Szyprowski <m.szyprowski@samsung.com>

regulator: wm8994: Use PROBE_FORCE_SYNCHRONOUS

Restore synchronous probing for wm8994 regulators because otherwise the
sound device is never initialized on Exynos5250-based Arndale board.

Fixes: 259b93b21a9f ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230323083312.199189-1-m.szyprowski@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 259b93b2 16-Mar-2023 Douglas Anderson <dianders@chromium.org>

regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14

Probing of regulators can be a slow operation and can contribute to
slower boot times. This is especially true if a regulator is turned on
at probe time (with regulator-boot-on or regulator-always-on) and the
regulator requires delays (off-on-time, ramp time, etc).

While the overall kernel is not ready to switch to async probe by
default, as per the discussion on the mailing lists [1] it is believed
that the regulator subsystem is in good shape and we can move
regulator drivers over wholesale. There is no way to just magically
opt in all regulators (regulators are just normal drivers like
platform_driver), so we set PROBE_PREFER_ASYNCHRONOUS for all
regulators found in 'drivers/regulator' individually.

Given the number of drivers touched and the impossibility to test this
ahead of time, it wouldn't be shocking at all if this caused a
regression for someone. If there is a regression caused by this patch,
it's likely to be one of the cases talked about in [1]. As a "quick
fix", drivers involved in the regression could be fixed by changing
them to PROBE_FORCE_SYNCHRONOUS. That being said, the correct fix
would be to directly fix the problem that caused the issue with async
probe.

The approach here follows a similar approach that was used for the mmc
subsystem several years ago [2]. In fact, I ran nearly the same python
script to auto-generate the changes. The only thing I changed was to
search for "i2c_driver", "spmi_driver", and "spi_driver" in addition
to "platform_driver".

[1] https://lore.kernel.org/r/06db017f-e985-4434-8d1d-02ca2100cca0@sirena.org.uk
[2] https://lore.kernel.org/r/20200903232441.2694866-1-dianders@chromium.org/

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316125351.1.I2a4677392a38db5758dee0788b2cea5872562a82@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>


# 92d96b60 27-Mar-2022 Jonathan Bakker <xc-racer2@live.ca>

regulator: wm8994: Add an off-on delay for WM8994 variant

As per Table 130 of the wm8994 datasheet at [1], there is an off-on
delay for LDO1 and LDO2. In the wm8958 datasheet [2], I could not
find any reference to it. I could not find a wm1811 datasheet to
double-check there, but as no one has complained presumably it works
without it.

This solves the issue on Samsung Aries boards with a wm8994 where
register writes fail when the device is powered off and back-on
quickly.

[1] https://statics.cirrus.com/pubs/proDatasheet/WM8994_Rev4.6.pdf
[2] https://statics.cirrus.com/pubs/proDatasheet/WM8958_v3.5.pdf

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/CY4PR04MB056771CFB80DC447C30D5A31CB1D9@CY4PR04MB0567.namprd04.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e8d59d9a 17-Apr-2019 Axel Lin <axel.lin@ingics.com>

regulator: wm8994: Switch to SPDX identifier

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# daa531db 11-Dec-2018 Linus Walleij <linus.walleij@linaro.org>

regulator: wm8994: Rely on core to handle GPIO descriptor

After making sure that the regulator core always take over
handling of the GPIO descriptors, the gpiod_put()
on the errorpath of the wm8994 driver becomes redundant.

Reported-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 466affa0 21-Nov-2018 Charles Keepax <ckeepax@opensource.cirrus.com>

regulator: wm8994: Don't use devres for enable GPIOs

The regulator core takes over managing the lifetime of the enable GPIO
once the regulator is registered. As such we shouldn't register the
enable GPIO using devm, or it will be freed twice.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1d2f4681 15-Nov-2018 Linus Walleij <linus.walleij@linaro.org>

regulator: wm8994: Pass descriptor instead of GPIO number

Instead of passing a global GPIO number for the enable GPIO, pass
a descriptor looked up from the device tree node or the board file
decriptor table for the regulator.

There is a single board file passing the GPIOs for LDO1 and LDO2
through platform data, so augment this to pass descriptors
associated with the i2c device as well.

The special GPIO enable DT property for the enable GPIO is
nonstandard but this was accomodated in
commit 6a537d48461deacc57c07ed86d9915e5aa4b3539
"gpio: of: Support regulator nonstandard GPIO properties".

Cc: patches@opensource.cirrus.com
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ab4d11e2 30-May-2018 Mark Brown <broonie@kernel.org>

regulator: wm8994: Fix shared GPIOs

This reverts commit 3c6b38d45fa51c7c51 "regulator: wm8994: Pass
descriptor instead of GPIO number" as it has problems with shared
GPIOs similar to that on s2mps11.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3c6b38d4 14-May-2018 Linus Walleij <linus.walleij@linaro.org>

regulator: wm8994: Pass descriptor instead of GPIO number

Instead of passing a global GPIO number for the enable GPIO, pass
a descriptor looked up from the device tree node or the board file
decriptor table for the regulator.

There is a single board file passing the GPIOs for LDO1 and LDO2
through platform data, so augment this to pass descriptors
associated with the i2c device as well.

The special GPIO enable DT property for the enable GPIO is
nonstandard but this was accomodated in
commit 6a537d48461deacc57c07ed86d9915e5aa4b3539
"gpio: of: Support regulator nonstandard GPIO properties".

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# b0d6dd3b 19-Dec-2015 Julia Lawall <Julia.Lawall@lip6.fr>

regulator: wm8*: constify regulator_ops structures

The regulator_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1de3821a 03-Nov-2014 Markus Pargmann <mpa@pengutronix.de>

regulator: Set ena_gpio_initialized in regulator drivers

This patch sets ena_gpio_initialized for all drivers which set a
ena_gpio from parsed DT properties. Drivers using pdata may get zero
initialized pdata and therefore copy a 0 into the regulator_config
ena_gpio field.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c794b26 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

regulator: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 4deaf85a 20-Feb-2014 Sachin Kamat <sachin.kamat@linaro.org>

regulator: wm8994: Remove redundant error message

kzalloc prints its own OOM message upon failure.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 9e2bfbbd 30-Aug-2013 Mark Brown <broonie@linaro.org>

regulator: wm8994: Convert to devm_regulator_register

Signed-off-by: Mark Brown <broonie@linaro.org>


# dff91d0b 30-Jul-2013 Jingoo Han <jg1.han@samsung.com>

regulator: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 405c5400 03-May-2013 Axel Lin <axel.lin@ingics.com>

regulator: Remove all platform_set_drvdata(pdev, NULL) in drivers

Since 0998d06310 "device-core: Ensure drvdata = NULL when no driver is bound",
this is done by driver core after device_release or on probe failure.
Thus we can remove all platform_set_drvdata(pdev, NULL) in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3ea93896 11-Apr-2013 Sylwester Nawrocki <s.nawrocki@samsung.com>

regulator: wm8994: Use GPIO parsed from DT when registering regulators

Ensure the regulators are registered with a GPIO parsed from the device
tree when available.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# e3d27775 05-Apr-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Provide default init data

Almost all systems use the regulators on the WM8994 series devices to
provide DCVDD and AVDD1 so if no init data is supplied then set up the
supplies for the user. This simplifies integration of the device into
systems, especially when device tree is supported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 05650216 03-Apr-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Convert to module_platform_driver()

The regulators can only be used to supply the CODEC so we don't need to
worry about users that still need fudges for init ordering issues.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8dc995f5 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a5023574 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5eb9f2b9 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

regulator: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 495fd8c8 27-Jun-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Use core GPIO enable support

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 00581b30 27-Jun-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Set enable_time in descriptor

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f2d103ad 23-May-2012 Axel Lin <axel.lin@gmail.com>

regulator: wm8994: Convert wm8994_ldo1_ops to regulator_[list|map]_voltage_linear

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b68b45d7 14-May-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Allow registration with no platform data

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5d0526ea 08-May-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Use main I2C device as struct device

This makes logging a bit clearer as it gives the actual bus location and
makes things like board hookup a bit smoother.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 09e3fd20 07-May-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Convert to gpio_request_one()

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 633b6fcd 15-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Use core voltage selector operations

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>


# 9f29c9e3 15-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Convert to set_voltage_sel()

There's no need to implement set_voltage() as there is only a very small
range of selectors for the regulators in the WM8994 and the voltages are
not expected to vary frequently at runtime.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# c172708d 03-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: core: Use a struct to pass in regulator runtime configuration

Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.

The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 25e4d602 03-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Constify regulator_desc

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b9e0348f 16-Feb-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: wm8994: Convert to devm_kzalloc()

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2c043bcb 18-Nov-2011 Rajendra Nayak <rnayak@ti.com>

regulator: pass additional of_node to regulator_register()

With device tree support for regulators, its needed that the
regulator_dev->dev device has the right of_node attached.
To be able to do this add an additional parameter to the
regulator_register() api, wherein the dt-adapted driver can
then pass this additional info onto the regulator core.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# a1ff89ef 23-Jul-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Add WM1811 support

The WM1811 has a slightly different range on LDO2 to other WM8994 class
devices.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 2ae3636b 24-May-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Use _cansleep() for WM8994 regulator GPIOs

The WM8994 regulator driver is perfectly happy if the GPIO used to enable
the regulator sleeps so call the appropriate GPIO API.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# d9f0f287 12-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Convert WM8994 to use get_voltage_sel()

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 3a93f2a9 10-Nov-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Report actual configured voltage to set_voltage()

Change the interface used by set_voltage() to report the selected value
to the regulator core in terms of a selector used by list_voltage().
This allows the regulator core to know the voltage that was chosen
without having to do an explict get_voltage(), which would be much more
expensive as it will generally access hardware.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 5a7743ed 13-Dec-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Update LDO2 for WM8958

LDO2 has a slightly different range of supported voltages on WM8958
so update the selector<->voltage mappings to match.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# c4604e49 06-Aug-2010 Joonyoung Shim <jy0922.shim@samsung.com>

regulator: Default GPIO controlled WM8994 regulators to disabled

This ensures that if the GPIO was not enabled prior to the driver
starting the regulator API will insert the required powerup ramp
delay when it enables the regulator. The gpiolib API does not
provide this information.

[Rewrote changelog to describe the actual change -- broonie.]

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 598b3578 24-Feb-2010 Dmitry Torokhov <dmitry.torokhov@gmail.com>

Regulators: wm8994 - clean up driver data after removal

It is a good tone to reset driver data after unbinding the device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 69dc16c3 25-Jan-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: Add WM8994 regulator support

The WM8994 contains two LDOs with mixed hardware/software control to
minimise the number of external supplies required while delivering
optimal voltages to minimise power consumption.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>