History log of /linux-master/drivers/regulator/stm32-pwr.c
Revision Date Author Comments
# 045a44d4 14-Jul-2023 Rob Herring <robh@kernel.org>

regulator: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

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


# 959c3476 17-May-2023 Marek Vasut <marex@denx.de>

regulator: stm32-pwr: Fix regulator disabling

The following shows up in the kernel log on systems using the STM32MP15xx USBPHYC:
"
regulator regulator.19: regulator disable timed out!
reg18: failed to disable: -ETIMEDOUT
"
This 'regulator.19' is 'pwr@50001000' 'reg18' in stm32mp151.dts DT, or
"Power control (PWR)" register "PWR_CR3" bits "REG18" on STM32MP15xx
reference manual.

The reason for the timeout seems to be the poll which this patch changes.
When turning this regulator OFF, PWR_CR3 reads 0xf0000000 , then REG18_EN
bit is cleared, and then this poll waits until REG18_RDY bit is cleared as
well, but that never happens, the PWR_CR3 keeps reading 0xe0000000 .

I am not sure whether this should happen, I suspect the 1V8 supply is
always READY when the 1V8 input is present, and the regulator can only
ever be enabled/disabled using the REG18_EN bit, but the REG18_READY
bit is never cleared again.

This patch adjusts the poll to check whether REG18_EN has been cleared
on regulator disable, but retains the check for REG18_READY in regulator
enable as there it makes sense to verify the regulator is really READY.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230518023946.530381-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1c8744d83 07-Mar-2023 Nick Alcock <nick.alcock@oracle.com>

regulator: stm32-pwr: remove MODULE_LICENSE in non-modules

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>


# c4a413e5 11-Apr-2023 YAN SHI <m202071378@hust.edu.cn>

regulator: stm32-pwr: fix of_iomap leak

Smatch reports:
drivers/regulator/stm32-pwr.c:166 stm32_pwr_regulator_probe() warn:
'base' from of_iomap() not released on lines: 151,166.

In stm32_pwr_regulator_probe(), base is not released
when devm_kzalloc() fails to allocate memory or
devm_regulator_register() fails to register a new regulator device,
which may cause a leak.

To fix this issue, replace of_iomap() with
devm_platform_ioremap_resource(). devm_platform_ioremap_resource()
is a specialized function for platform devices.
It allows 'base' to be automatically released whether the probe
function succeeds or fails.

Besides, use IS_ERR(base) instead of !base
as the return value of devm_platform_ioremap_resource()
can either be a pointer to the remapped memory or
an ERR_PTR() encoded error code if the operation fails.

Fixes: dc62f951a6a8 ("regulator: stm32-pwr: Fix return value check in stm32_pwr_regulator_probe()")
Signed-off-by: YAN SHI <m202071378@hust.edu.cn>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304111750.o2643eJN-lkp@intel.com/
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Link: https://lore.kernel.org/r/20230412033529.18890-1-m202071378@hust.edu.cn
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>


# a94a11ce 20-Aug-2020 Jisheng Zhang <Jisheng.Zhang@synaptics.com>

regulator: stm32-pwr: Fix W=1 build warning when CONFIG_OF=n

Fix below warning when CONFIG_OF=n:

drivers/regulator/stm32-pwr.c:169:34: warning: ‘stm32_pwr_of_match’ defined but not used [-Wunused-const-variable=]
169 | static const struct of_device_id stm32_pwr_of_match[] = {
| ^~~~~~~~~~~~~~~~~~

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Link: https://lore.kernel.org/r/20200821111726.38e0e746@xhacker.debian
Signed-off-by: Mark Brown <broonie@kernel.org>


# 311a68a5 30-Apr-2019 Axel Lin <axel.lin@ingics.com>

regulator: stm32-pwr: Remove unneeded .min_uV and .list_volage

For fixed regulator, setting .n_voltages = 1 and .fixed_uV is enough,
no need to set .min_uV and .list_volage.

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


# 7bcbdbe0 30-Apr-2019 Axel Lin <axel.lin@ingics.com>

regulator: stm32-pwr: Remove unneeded *desc from struct stm32_pwr_reg

Just use rdev->desc instead.

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


# dc62f951 16-Apr-2019 Wei Yongjun <weiyongjun1@huawei.com>

regulator: stm32-pwr: Fix return value check in stm32_pwr_regulator_probe()

In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 6cdae8173f67 ("regulator: Add support for stm32 power regulators")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 82f26185 15-Apr-2019 kbuild test robot <lkp@intel.com>

regulator: ready_mask_table[] can be static

Fixes: 6cdae8173f67 ("regulator: Add support for stm32 power regulators")
Signed-off-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6cdae817 15-Apr-2019 Pascal PAILLET-LME <p.paillet@st.com>

regulator: Add support for stm32 power regulators

Add support for 1V1 1V8 USB3V3 power regulators.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>