diff options
author | Thomas Abraham <thomas.abraham@linaro.org> | 2012-11-23 03:03:14 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-24 12:57:04 -0500 |
commit | 068a8c8239d50a5fd025c97f94945d9f2ffa3438 (patch) | |
tree | c31e3bf13f37930a60b316cae3c1fe2ead7297ca | |
parent | 11ec7bf001e7bfd37f244042032e15dac2c301bc (diff) |
regulator: max8997: limit the number of dvs registers programmed in non-dvs mode
In case the gpio based volatage selection mode is not used for either of
buck 1/2/5, then only the BUCKxDVS1 register need to be programmed. So
determine whether dvs mode is used and limit the loop count appropriately.
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/regulator/max8997.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 04d9f29503ad..64cf2ee38f6c 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -941,7 +941,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) | |||
941 | struct regulator_dev **rdev; | 941 | struct regulator_dev **rdev; |
942 | struct max8997_data *max8997; | 942 | struct max8997_data *max8997; |
943 | struct i2c_client *i2c; | 943 | struct i2c_client *i2c; |
944 | int i, ret, size; | 944 | int i, ret, size, nr_dvs; |
945 | u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; | 945 | u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; |
946 | 946 | ||
947 | if (!pdata) { | 947 | if (!pdata) { |
@@ -973,7 +973,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) | |||
973 | memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3); | 973 | memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3); |
974 | max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect; | 974 | max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect; |
975 | 975 | ||
976 | for (i = 0; i < 8; i++) { | 976 | nr_dvs = (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs || |
977 | pdata->buck5_gpiodvs) ? 8 : 1; | ||
978 | |||
979 | for (i = 0; i < nr_dvs; i++) { | ||
977 | max8997->buck1_vol[i] = ret = | 980 | max8997->buck1_vol[i] = ret = |
978 | max8997_get_voltage_proper_val( | 981 | max8997_get_voltage_proper_val( |
979 | &buck1245_voltage_map_desc, | 982 | &buck1245_voltage_map_desc, |
@@ -1020,7 +1023,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) | |||
1020 | } | 1023 | } |
1021 | 1024 | ||
1022 | /* Initialize all the DVS related BUCK registers */ | 1025 | /* Initialize all the DVS related BUCK registers */ |
1023 | for (i = 0; i < 8; i++) { | 1026 | for (i = 0; i < nr_dvs; i++) { |
1024 | max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i, | 1027 | max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i, |
1025 | max8997->buck1_vol[i], | 1028 | max8997->buck1_vol[i], |
1026 | 0x3f); | 1029 | 0x3f); |