Commit graph

5 commits

Author SHA1 Message Date
Axel Lin 8828bae464 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>
2013-10-11 12:49:16 +01:00
Axel Lin e277e65680 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>
2013-10-11 12:49:12 +01:00
Axel Lin 5e96570480 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>
2013-10-03 16:49:34 +01:00
Axel Lin 43f6fc9542 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>
2013-10-03 16:49:21 +01:00
Laxman Dewangan bc407334e9 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>
2013-09-20 18:08:00 +01:00