summaryrefslogtreecommitdiff
path: root/drivers/regulator/as3722-regulator.c
AgeCommit message (Collapse)Author
2023-03-20regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14Douglas Anderson
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>
2020-11-23regulator: as3722: Fix fall-through warnings for ClangGustavo A. R. Silva
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>
2020-05-08regulator: use linear_ranges helperMatti Vaittinen
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>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
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>
2019-04-01regulator: as3722: Slightly improve readabilityAxel Lin
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>
2019-04-01regulator: as3722: Convert to use regulator_set/get_current_limit_regmapAxel Lin
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>
2019-03-18regulator: as3722: Remove *rdevs[] from struct as3722_regulatorsAxel Lin
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>
2019-02-06regulator: as3722: Correct minor typoCharles Keepax
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>
2016-04-11regulator: as3722: Constify regulator opsThierry Reding
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>
2016-04-11regulator: as3722: Add bypass support for LDO6Jon Hunter
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>
2014-10-20regulator: drop owner assignment from platform_driversWolfram Sang
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>
2014-08-05Merge remote-tracking branches 'regulator/topic/88pm800', ↵Mark Brown
'regulator/topic/ab8500', 'regulator/topic/act8865', 'regulator/topic/as3722' and 'regulator/topic/bcm590xx' into regulator-next
2014-06-24regulator: as3722: Fix incorrect parameter initializationSachin Kamat
'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>
2014-06-03regulator: as3722: Make 0 a valid selectorThierry Reding
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>
2014-02-18regulator: as3722: Add missing of_node_putSachin Kamat
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>
2014-01-23Merge remote-tracking branches 'regulator/fix/pfuze100', ↵Mark Brown
'regulator/fix/s5m8767', 'regulator/topic/ab8500', 'regulator/topic/act8865', 'regulator/topic/anatop', 'regulator/topic/arizona' and 'regulator/topic/as3722' into regulator-linus
2014-01-06regulator: as3722: set enable time for SD0/1/6Vince Hsu
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>
2014-01-06regulator: as3722: detect SD0 low-voltage modeAndrew Bresticker
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>
2013-12-20regulator: as3722: Don't set min_uV/uV_step/linear_min_sel for linear_rangesAxel Lin
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>
2013-12-02regulator: as3722: set the correct current limitVince Hsu
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
2013-10-11regulator: Add REGULATOR_LINEAR_RANGE macroAxel Lin
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>
2013-10-11regulator: Remove max_uV from struct regulator_linear_rangeAxel Lin
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>
2013-10-03regulator: as3722: Fix off-by-one n_voltages setting for SDxAxel Lin
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>
2013-10-03regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macroAxel Lin
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>
2013-09-20regulator: as3722: add regulator driver for AMS AS3722Laxman Dewangan
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>