summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/as3722-regulator.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* regulator: as3722: Slightly improve readabilityAxel Lin2019-04-011-79/+58
| | | | | | | | | 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>
* regulator: as3722: Convert to use regulator_set/get_current_limit_regmapAxel Lin2019-04-011-152/+60
| | | | | | | | 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>
* regulator: as3722: Remove *rdevs[] from struct as3722_regulatorsAxel Lin2019-03-181-2/+0
| | | | | | | | | 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>
* regulator: as3722: Correct minor typoCharles Keepax2019-02-061-1/+1
| | | | | | | | 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>
* regulator: as3722: Constify regulator opsThierry Reding2016-04-111-13/+13
| | | | | | | | | 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>
* regulator: as3722: Add bypass support for LDO6Jon Hunter2016-04-111-0/+43
| | | | | | | | | | | | | | | | | | 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>
* regulator: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | 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>
*-. Merge remote-tracking branches 'regulator/topic/88pm800', ↵Mark Brown2014-08-051-2/+2
|\ \ | | | | | | | | | 'regulator/topic/ab8500', 'regulator/topic/act8865', 'regulator/topic/as3722' and 'regulator/topic/bcm590xx' into regulator-next
| | * regulator: as3722: Fix incorrect parameter initializationSachin Kamat2014-06-241-2/+2
| |/ | | | | | | | | | | | | | | | | | | '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>
* / regulator: as3722: Make 0 a valid selectorThierry Reding2014-06-031-0/+2
|/ | | | | | | | | | | | | | | | 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>
* regulator: as3722: Add missing of_node_putSachin Kamat2014-02-181-0/+1
| | | | | | | 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>
*-. Merge remote-tracking branches 'regulator/fix/pfuze100', ↵Mark Brown2014-01-231-7/+27
|\ \ | | | | | | | | | 'regulator/fix/s5m8767', 'regulator/topic/ab8500', 'regulator/topic/act8865', 'regulator/topic/anatop', 'regulator/topic/arizona' and 'regulator/topic/as3722' into regulator-linus
| | * regulator: as3722: set enable time for SD0/1/6Vince Hsu2014-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * regulator: as3722: detect SD0 low-voltage modeAndrew Bresticker2014-01-061-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| | * regulator: as3722: Don't set min_uV/uV_step/linear_min_sel for linear_rangesAxel Lin2013-12-201-3/+0
| |/ | | | | | | | | | | | | | | | | 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>
* / regulator: as3722: set the correct current limitVince Hsu2013-12-021-1/+1
|/ | | | | | | | | 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
* regulator: Add REGULATOR_LINEAR_RANGE macroAxel Lin2013-10-111-13/+5
| | | | | | | 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>
* regulator: Remove max_uV from struct regulator_linear_rangeAxel Lin2013-10-111-1/+0
| | | | | | | | | 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>
* regulator: as3722: Fix off-by-one n_voltages setting for SDxAxel Lin2013-10-031-7/+7
| | | | | | | | | 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>
* regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macroAxel Lin2013-10-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* regulator: as3722: add regulator driver for AMS AS3722Laxman Dewangan2013-09-201-0/+917
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>