History log of /linux-master/drivers/regulator/as3722-regulator.c
Revision Date Author Comments
# 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>


# b52b417c 19-Nov-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

regulator: as3722: Fix fall-through warnings for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a fallthrough pseudo-keyword instead of letting the
code fall through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/c0efb81064f71837f19408f65b52d155103ee514.1605896059.git.gustavoars@kernel.org
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>


# 1a59d1b8 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details you
should have received a copy of the gnu general public license along
with this program if not write to the free software foundation inc
59 temple place suite 330 boston ma 02111 1307 usa

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1334 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7dc6c766 26-Mar-2019 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Slightly improve readability

Add a local variable *desc to avoid too many change lines due to over 80
characters.

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


# ce0a383d 26-Mar-2019 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Convert to use regulator_set/get_current_limit_regmap

Use regulator_set/get_current_limit_regmap helpers to save some code.

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


# 4d92ac7b 15-Mar-2019 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Remove *rdevs[] from struct as3722_regulators

Current code is using devm_regulator_register() so it is not necessary
to save as3722_regs->rdevs[id] for clean up.
The *rdevs[] is not used now, remove it.

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


# 46689b1e 05-Feb-2019 Charles Keepax <ckeepax@opensource.cirrus.com>

regulator: as3722: Correct minor typo

A comma has been accidentally used where a semi-colon was clearly
intended, correct this typo.

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


# 162c5a36 07-Apr-2016 Thierry Reding <treding@nvidia.com>

regulator: as3722: Constify regulator ops

A const pointer to regulator ops is stored in regulator descriptors. The
operations never need to be modified, so define them as const as a hint
to the compiler that they can go into .rodata.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 40a86550 07-Apr-2016 Jon Hunter <jonathanh@nvidia.com>

regulator: as3722: Add bypass support for LDO6

LD06 on the AS3722 power management IC supports a bypass mode. Bypass
is enabled for the LDO by writing the value 0x3F to the voltage select
field in the control register for the LDO. Note that this is the same
register and field that is used to select the voltage as well for the
LDO.

Add support for bypass on LDO6 by specifying the various bypass
parameters for regulator and adding new function pointer tables for the
LDO. Note that the bypass OFF value is the same as the ON value simply
because there is no actual OFF value and bypass will be disabled when
a new voltage is written to the VSEL field.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
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>


# a181c1c7 24-Jun-2014 Sachin Kamat <sachin.kamat@samsung.com>

regulator: as3722: Fix incorrect parameter initialization

'name' field was re-initialized and getting overwritten in some
cases possibly due to a typo. Code inspection says the second time
it should be 'sname' instead of 'name'. Replace it.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 2050afde 03-Jun-2014 Thierry Reding <treding@nvidia.com>

regulator: as3722: Make 0 a valid selector

As of commit 064d5cd110f9 (regulator: core: Fix the init of DT defined
fixed regulators) the regulator core tries to query the current voltage
of a regulator when applying constraints. This exposes a bug in the
AS3722 regulator driver which fails to read the voltage of disabled
regulators. The reason is that the hardware is programmed to a selector
of 0, but none of the voltage tables include 0 as a valid selector. The
datasheets indicate that 0 is a valid selector when the regulators are
powered off.

To fix this, add a range including selector 0 to the voltage tables.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# ba40e557 17-Feb-2014 Sachin Kamat <sachin.kamat@linaro.org>

regulator: as3722: Add missing of_node_put

Add of_node_put to decrement the ref count.

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


# fb04f1b0 26-Dec-2013 Vince Hsu <vinceh@nvidia.com>

regulator: as3722: set enable time for SD0/1/6

Add an enable time of 600us for SD0/1/6 to ensure that we have
enough setup time for the power rail.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 762a8ee8 26-Dec-2013 Andrew Bresticker <abrestic@chromium.org>

regulator: as3722: detect SD0 low-voltage mode

SD0 may operate in low-voltage mode, with a minimum of 0.41V
and a maximum of 1.5V. This is indicated by bit 4 of FUSE7.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
broonie.e6264@m.evernote.com
Signed-off-by: Mark Brown <broonie@linaro.org>


# bc2571f4 19-Dec-2013 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Don't set min_uV/uV_step/linear_min_sel for linear_ranges

These settings are not used when using linear_ranges and it makes the code
looks confusing. Thus remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 6389075e 28-Nov-2013 Vince Hsu <vinceh@nvidia.com>

regulator: as3722: set the correct current limit

Simple fix to set the correct current limit for SD0/1/6.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Fixes: bc407334e9a6 (regulator: as3722: add regulator driver for AMS AS3722)
Cc: stable@vger.kernel.org


# 8828bae4 10-Oct-2013 Axel Lin <axel.lin@ingics.com>

regulator: Add REGULATOR_LINEAR_RANGE macro

Add REGULATOR_LINEAR_RANGE macro and convert regulator drivers to use it.

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


# e277e656 10-Oct-2013 Axel Lin <axel.lin@ingics.com>

regulator: Remove max_uV from struct regulator_linear_range

linear ranges means each range has linear voltage settings.
So we can calculate max_uV for each linear range in regulator core rather than
set the max_uV field in drivers.

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


# 5e965704 02-Oct-2013 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Fix off-by-one n_voltages setting for SDx

AS3722_SDx_VSEL_MAX means the maximum selecter, the n_voltages should be
AS3722_SDx_VSEL_MAX + 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 43f6fc95 02-Oct-2013 Axel Lin <axel.lin@ingics.com>

regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro

Fix off-by-one in the equation to calculate max_uV and also adjust the _min_uV
setting accordingly.

For LDOs:
The voltage select bits set the LDO output voltage 0.825V...3.3V, 25mV steps
....00h : LDO off
01h-24h : V_LDO4 = 0.8V + ldo4_vsel * 25mV
= 0.825V + (ldo4_vsel - 1h) * 25mV
25h-3Fh : do not use
40h-7Fh : V_LDO4 = 1.725V + (ldo4_vsel - 40h) * 25mV

For SD2345:
The voltage select bits set the DC/DC output voltage level and power the DC/DC
converter down.
....00h : DC/DC powered down
01h-40h : V_SD2 = 0.6V + sd2_vsel * 12.5mV
= 0.6125V + (sd2_vsel - 1h) * 12.5mV
41h-70h : V_SD2 = 1.4V + (sd2_vsel - 40h) * 25mV
= 1.425V + (sd2_vsel - 41h) * 25mV
71h-7Fh : V_SD2 = 2.6V + (sd2_vsel - 70h) * 50mV
= 2.65V + (sd2_vsel - 71h) * 50mV

Note, the third entry in as3722_sd2345_ranges is wrong in current code.
Fix it based on the datasheet.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# bc407334 20-Sep-2013 Laxman Dewangan <ldewangan@nvidia.com>

regulator: as3722: add regulator driver for AMS AS3722

The AMS AS3722 is a compact system PMU suitable for mobile phones,
tablets etc. It has 4 DCDC step down regulators, 3 DCDC step down
controller, 11 LDOs.

Add a driver to support accessing the DCDC/LDOs found on the AMS
AS3722 PMIC using regulators.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Florian Lobmaier <florian.lobmaier@ams.com>
Signed-off-by: Mark Brown <broonie@linaro.org>