History log of /linux-master/drivers/regulator/arizona-micsupp.c
Revision Date Author Comments
# b65a0a8e 23-Mar-2023 Charles Keepax <ckeepax@opensource.cirrus.com>

regulator: arizona-micsupp: Use PROBE_FORCE_SYNCHRONOUS

Restore synchronous probing for Arizona regulators as the main MFD
relies on the ordering of the devices probing.

As these regulators are built into the CODEC and typically have no DT
representation the regulator framework is unaware of their existence
until the driver probes. These means the probing of the driver needs to
be synchronous to ensure the regulators are not substitued for the dummy
later when the users request them.

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


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

regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers between 4.19 and 5.4

This follows on the change ("regulator: Set PROBE_PREFER_ASYNCHRONOUS
for drivers that existed in 4.14") but changes regulators didn't exist
in Linux 4.19 but did exist in Linux 5.4.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230316125351.3.I45bf925ca9537da5f647e2acb0ad207c0c98af81@changeid
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>


# 9211402f 09-Nov-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

regulator: arizona-micsupp: Don't use a common regulator name

The Arizona and Madera codecs all have a datasheet name of "MICVDD"
for the regulator output. But future codecs with a regulator that
can be controlled by this driver have different naming convention
for the output of the regulator.

Move the setting of the supply name from arizona_micsupp_common_init()
to arizona_micsupp_probe() and madera_micsupp_probe().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221109165331.29332-8-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2da34b23 09-Nov-2022 Richard Fitzgerald <rf@opensource.cirrus.com>

regulator: arizona-micsupp: Don't hardcode use of ARIZONA defines

When Madera support was added to this driver the code was left
using ARIZONA_* defines. This wasn't causing any problem because
those defines just happened to have the same value as the
equivalent MADERA_* defines. But it is not ideal to assume this,
and future devices that can share this driver do not have the
same register map.

Fix the code to refer to the register data in struct regulator_desc.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221109165331.29332-7-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 60ab7f41 08-May-2020 Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

regulator: use linear_ranges helper

Change the regulator helpers to use common linear_ranges code.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/64f01d5e381b8631a271616b7790f9d5640974fb.1588944082.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 60b909e4 31-May-2019 Linus Walleij <linus.walleij@linaro.org>

regulator: arizona-micsupp: Delete unused include

This driver uses no symbols from <linux/gpio.h> so just drop
this include.

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>


# 7bd7916d 21-May-2019 Richard Fitzgerald <rf@opensource.cirrus.com>

regulator: arizona-micsupp: Add support for Cirrus Logic Madera codecs

This adds a new driver identity "madera-micsupp" and probe function
so that this driver can be used to control the micsupp regulator on
Cirrus Logic Madera codecs.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


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

regulator: arizona: Switch to SPDX identifier

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7d8d14b5 18-Apr-2017 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Factor out generic initialization

In preparation for sharing this driver with Madera codecs, factor out
the parts of initialization that aren't dependent on struct arizona.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e165983e 18-Apr-2017 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Make arizona_micsupp independent of struct arizona

In preparation for supporting Madera codecs, remove the dependency on
struct arizona in the regulator callbacks and struct arizona_micsupp.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 22161f3e 18-Apr-2017 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Move pdata into a separate structure

In preparation for sharing this driver with Madera, move the pdata
for the micsupp regulator out of struct arizona_pdata into a dedicated
pdata struct for this driver. As a result the code in
arizona_micsupp_of_get_pdata() can be made independent of struct arizona.

This patch also updates the definition of struct arizona_pdata and
the use of this pdata in mach-crag6410-module.c

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2543ef31 28-Mar-2017 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Avoid potential memory leak reading init_data

The device argument passed to of_get_regulator_init_data is used to
do some devres memory allocation. Currently the driver passes the MFD
device pointer to this function, this could result in the init_data
allocation being leaked if the regulator is unbound but the MFD isn't.

Correct this issue by correctly passing the local platform device.

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


# 2773ead1 28-Jan-2017 Bhumika Goyal <bhumirks@gmail.com>

regulator: arizona-micsupp: constify regulator_ops structure

Declare regulator_ops structure as const as it is only stored in the ops
field of a regulator_desc structure. This field is of type const, so
regulator_ops structures having this property can be made const too.

File size before: drivers/regulator/arizona-micsupp.o
text data bss dec hex filename
1738 464 8 2210 8a2 regulator/arizona-micsupp.o

File size after: drivers/regulator/arizona-micsupp.o
text data bss dec hex filename
1994 192 8 2194 892 regulator/arizona-micsupp.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 98cf9965 15-Dec-2016 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Use SoC component pin control functions

The name of a codec pin can have an optional prefix string, which is
defined by the SoC machine driver. The snd_soc_dapm_x_pin functions
take the fully-specified name including the prefix and so the existing
code would fail to find the pin if the audio machine driver had added
a prefix.

Switch to using the snd_soc_component_x_pin equivalent functions that
take a specified SoC component and automatically add the name prefix to
the provided pin name.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# f7293114 17-Jan-2015 Richard Fitzgerald <rf@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Add support for WM8280/WM8281

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# a7b976ae 20-Feb-2015 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Drop OF node reference on error path

We were not calling of_node_put if the regulator failed to register this
patch fixes this.

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


# 072e78b1 10-Nov-2014 Javier Martinez Canillas <javier@osg.samsung.com>

regulator: of: Add regulator desc param to of_get_regulator_init_data()

The of_get_regulator_init_data() function is used to extract the regulator
init_data but information on how to extract certain data is defined in the
static regulator descriptor (e.g: how to map the hardware operating modes).

Add a const struct regulator_desc * parameter to the function signature so
the parsing logic could use the information in the struct regulator_desc.

of_get_regulator_init_data() relies on of_get_regulation_constraints() to
actually extract the init_data so it has to pass the struct regulator_desc
but that is modified on a later patch.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
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>


# 6f1c9c57 08-May-2014 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Add missing #include

of.h is presently being included through asm-generic/gpio.h so will not
be included on some architectures, causing implicit declaration errors
for of_get_child_by_name, of_parse_phandle and of_node_put.

This patch adds the direct include that should be there.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 36bcdf1b 16-Apr-2014 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Add processing of init_data from device tree

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 820cd31e 18-Feb-2014 Sachin Kamat <sachin.kamat@linaro.org>

regulator: arizona-micsupp: 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>


# 71979aa3 15-Nov-2013 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Convert to use linear ranges

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# d2e7491e 15-Nov-2013 Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Correct wm5110 voltage selection

wm5110 provides different voltage configurations than the other Arizona
parts, this patch adds support for this into the regulator driver. Also
fixup the default for the configuration register for wm5110.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org (v3.12)


# b6b7709c 31-Aug-2013 Mark Brown <broonie@linaro.org>

regulator: arizona-micsupp: Convert to devm_regulator_register()

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


# 9fc50a2e 10-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Enable bypass in default constraints

This will be used as part of low power accessory detect.

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


# e6ed9058 10-Jan-2013 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Enable SYSCLK for charge pump

If we are in non-bypass mode then the SYSCLK is required for full charge
pump operation, otherwise we will fall back to bypass mode. Use the DAPM
context exposed by the ASoC driver to manage this.

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


# 95072818 27-Nov-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Add ramp time information

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>


# e477ce07 27-Aug-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Support get/set bypass

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


# 6dc027c9 03-Jul-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona-micsupp: Force regulated mode until we have API support

It's almost certainly what the user would expect.

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


# 7f217d36 26-Jun-2012 Axel Lin <axel.lin@gmail.com>

regulator: arizona-micsupp: Fix choosing selector in arizona_micsupp_map_voltage

If min_uV is in the range of: 3250001~3269999,
current code uses the equation:
selector = DIV_ROUND_UP(min_uV - 1700000, 50000);
Then selector will be 32.
Then arizona_micsupp_list_voltage returns -EINVAL for this case which is wrong.

This patch fixes this issue:
If min_uV > 3200000, selector should be ARIZONA_MICSUPP_MAX_SELECTOR.

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


# b667a45d 14-Jun-2012 Mark Brown <broonie@opensource.wolfsonmicro.com>

regulator: arizona: Add support for microphone supplies on Arizona devices

The Wolfson Arizona platform is used for a range of low power audio hub
CODECs. Many of these devices feature an integrated power supply for the
microphone which is supported by this driver.

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