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>
This commit is contained in:
parent
11ec7bf001
commit
068a8c8239
@ -941,7 +941,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
|
|||||||
struct regulator_dev **rdev;
|
struct regulator_dev **rdev;
|
||||||
struct max8997_data *max8997;
|
struct max8997_data *max8997;
|
||||||
struct i2c_client *i2c;
|
struct i2c_client *i2c;
|
||||||
int i, ret, size;
|
int i, ret, size, nr_dvs;
|
||||||
u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0;
|
u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0;
|
||||||
|
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
@ -973,7 +973,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
|
|||||||
memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3);
|
memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3);
|
||||||
max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect;
|
max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
nr_dvs = (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs ||
|
||||||
|
pdata->buck5_gpiodvs) ? 8 : 1;
|
||||||
|
|
||||||
|
for (i = 0; i < nr_dvs; i++) {
|
||||||
max8997->buck1_vol[i] = ret =
|
max8997->buck1_vol[i] = ret =
|
||||||
max8997_get_voltage_proper_val(
|
max8997_get_voltage_proper_val(
|
||||||
&buck1245_voltage_map_desc,
|
&buck1245_voltage_map_desc,
|
||||||
@ -1020,7 +1023,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize all the DVS related BUCK registers */
|
/* Initialize all the DVS related BUCK registers */
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < nr_dvs; i++) {
|
||||||
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
|
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
|
||||||
max8997->buck1_vol[i],
|
max8997->buck1_vol[i],
|
||||||
0x3f);
|
0x3f);
|
||||||
|
Loading…
Reference in New Issue
Block a user