History log of /linux-master/drivers/regulator/qcom_rpm-regulator.c
Revision Date Author Comments
# 8f7e17d8 17-Oct-2023 Rob Herring <robh@kernel.org>

regulator: Use device_get_match_data()

Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203442.2699322-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 55975401 10-Aug-2023 Li Zetao <lizetao1@huawei.com>

regulator: qcom_rpm-regulator: Use devm_kmemdup to replace devm_kmalloc + memcpy

Use the helper function devm_kmemdup() rather than duplicating its
implementation, which helps to enhance code readability.

Signed-off-by: Li Zetao <lizetao1@huawei.com>
Link: https://lore.kernel.org/r/20230810114858.2103928-1-lizetao1@huawei.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>


# 8478ed58 09-Sep-2022 Linus Walleij <linus.walleij@linaro.org>

regulator: qcom_rpm: Fix circular deferral regression

On recent kernels, the PM8058 L16 (or any other PM8058 LDO-regulator)
does not come up if they are supplied by an SMPS-regulator. This
is not very strange since the regulators are registered in a long
array and the L-regulators are registered before the S-regulators,
and if an L-regulator defers, it will never get around to registering
the S-regulator that it needs.

See arch/arm/boot/dts/qcom-apq8060-dragonboard.dts:

pm8058-regulators {
(...)
vdd_l13_l16-supply = <&pm8058_s4>;
(...)

Ooops.

Fix this by moving the PM8058 S-regulators first in the array.

Do the same for the PM8901 S-regulators (though this is currently
not causing any problems with out device trees) so that the pattern
of registration order is the same on all PMnnnn chips.

Fixes: 087a1b5cdd55 ("regulator: qcom: Rework to single platform device")
Cc: stable@vger.kernel.org
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Konrad Dybcio <konrad.dybcio@somainline.org>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20220909112529.239143-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8d41df64 29-Jun-2020 Rikard Falkeborn <rikard.falkeborn@gmail.com>

regulator: qcom_rpm: Constify struct regulator_ops

These are never modified, so make them const to allow the compiler to
put them in read-only memory.

Before:
text data bss dec hex filename
17485 500 8 17993 4649 drivers/regulator/qcom_rpm-regulator.o

After:
text data bss dec hex filename
17881 104 8 17993 4649 drivers/regulator/qcom_rpm-regulator.o

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20200629194632.8147-2-rikard.falkeborn@gmail.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>


# d2c2c218 09-Apr-2020 Jason Yan <yanaijie@huawei.com>

regulator: qcom_rpm: remove defined but not used 'pm8921_ftsmps'

Fix the following gcc warning:

drivers/regulator/qcom_rpm-regulator.c:607:34: warning: ‘pm8921_ftsmps’
defined but not used [-Wunused-const-variable=]
static const struct qcom_rpm_reg pm8921_ftsmps = {
^~~~~~~~~~~~~

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200409114026.38383-1-yanaijie@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b5f25304 19-Feb-2020 Ansuel Smith <ansuelsmth@gmail.com>

regulator: add smb208 support

Smb208 regulators are used on some ipq806x soc.
Add support for it to make it avaiable on some routers
that use it.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Adrian Panella <ianchi74@outlook.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200219163711.479-1-ansuelsmth@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 97fb5e8d 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

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 version 2 and
only version 2 as published by the free software foundation 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

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2f2472ba 06-Jul-2017 Gustavo A. R. Silva <garsilva@embeddedor.com>

regulator: qcom_rpm-regulator: add NULL check on of_match_device() return value

Check return value from call to of_match_device()
in order to prevent a NULL pointer dereference.

In case of NULL print error message and return.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ddc085d4 11-Aug-2016 Neil Armstrong <narmstrong@baylibre.com>

regulator: qcom_rpm-regulator: Add support for pm8018 rpm regulator

In order to support the Qualcomm MDM9615 SoC, add support for the
PM8018 RPM regulator in the qcom_rpm-regulator driver.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>


# ce8ae17c 06-Apr-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom: Tidy up probe()

Tidy up error reporting and move rpm reference retrieval out of the for
loop for improved readability.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 087a1b5c 06-Apr-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom: Rework to single platform device

Modeling the individual RPM resources as platform devices consumes at
least 12-15kb of RAM, just to hold the platform_device structs. Rework
this to instead have one device per pmic exposed by the RPM.

With this representation we can more accurately define the input pins on
the pmic and have the supply description match the data sheet.

Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 469a9514 06-Apr-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom: Refactor of-parsing code

Refactor out all custom property parsing code from the probe function
into a function suitable for regulator_desc->of_parse_cb usage.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4d1e4d62 06-Apr-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom: Don't enable DRMS in driver

The driver itself should not flag regulators as being DRMS compatible,
this should come from board or dt files.

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2b85c28a 11-Feb-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom-rpm: Implement set_load and enable drms

Pass the requested load directly to the rpm.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 00cea31f 29-Jan-2015 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom-rpm: Make it possible to specify supply

Make it possible to specify the supply of a regulator, through the
vin-supply property in dt.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a412ec27 28-Jan-2015 Dan Carpenter <dan.carpenter@oracle.com>

regulator: qcom-rpm: signedness bug in probe()

"force_mode" is a u32 so it is never "< 0", but because of type
promotion then comparing "== -1" will do what we want.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c6515d2f 23-Jan-2015 Axel Lin <axel.lin@ingics.com>

regulator: qcom_rpm: Don't update vreg->uV/mV if rpm_reg_write fails

Ensure get_voltage return correct voltage if set_voltage fails.

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


# 80392682 26-Nov-2014 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom-rpm: Add missing state flag in call to RPM

This adds the missing state parameter to the call down to the RPM. This
is currently hard coded to the active state, as that's all we're
supporting at this moment.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Lee Jones <lee.jones@linaro.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>


# 0f5bb5b5 20-Nov-2014 Josh Cartwright <joshc@codeaurora.org>

regulator: rpm: add support for RPM-controller SMB208

The IPQ8064 reference boards make use of SMB208 regulators which are
controlled by RPM. Implement support for these regulators in the RPM
regulator driver.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.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>


# 6a642509 24-Sep-2014 Axel Lin <axel.lin@ingics.com>

regulator: qcom_rpm: Fix FORCE_MODE_IS_2_BITS macro

Current code does not take the macro parameter, fix it.
This is not a problem at this moment because the only user actually passes
vreg to FORCE_MODE_IS_2_BITS().

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


# aad615c6 24-Sep-2014 Axel Lin <axel.lin@ingics.com>

regulator: qcom_rpm: Don't explicitly initialise the first field of config

Doing so generates a warning as the first field is a pointer but we use
0 to initialize it.

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


# 2720386e 22-Sep-2014 Bjorn Andersson <bjorn.andersson@sonymobile.com>

regulator: qcom-rpm: Regulator driver for the Qualcomm RPM

Driver for regulators exposed by the Resource Power Manager (RPM) found
in Qualcomm 8660, 8960 and 8064 based devices.

Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Mark Brown <broonie@kernel.org>