diff options
author | Lukasz Majewski <l.majewski@samsung.com> | 2010-09-27 08:32:25 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:30:11 -0400 |
commit | 889cd5a60f880e0a56b7b769d0b74eb222e6896c (patch) | |
tree | e223052fd8cfd75f039cd456b51e4b164286063f | |
parent | 509bd4764c110b89bb3d09a5b6621fd31dc58044 (diff) |
regulator: max8998 BUCK1/2 internal voltages and indexes defined
BUCK1/2 internal voltages and indexes defined in the struct max8998_data
max_get_voltage_register now uses index values to chose proper register
More generic BUCK1/2 registers names provided
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/regulator/max8998.c | 10 | ||||
-rw-r--r-- | include/linux/mfd/max8998-private.h | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 1e5bd504fbad..7ae0639c1394 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -39,6 +39,11 @@ struct max8998_data { | |||
39 | struct max8998_dev *iodev; | 39 | struct max8998_dev *iodev; |
40 | int num_regulators; | 40 | int num_regulators; |
41 | struct regulator_dev **rdev; | 41 | struct regulator_dev **rdev; |
42 | u8 buck1_vol[4]; /* voltages for selection */ | ||
43 | u8 buck2_vol[2]; | ||
44 | unsigned int buck1_idx; /* index to last changed voltage */ | ||
45 | /* value in a set */ | ||
46 | unsigned int buck2_idx; | ||
42 | }; | 47 | }; |
43 | 48 | ||
44 | struct voltage_map_desc { | 49 | struct voltage_map_desc { |
@@ -218,6 +223,7 @@ static int max8998_get_voltage_register(struct regulator_dev *rdev, | |||
218 | int *_reg, int *_shift, int *_mask) | 223 | int *_reg, int *_shift, int *_mask) |
219 | { | 224 | { |
220 | int ldo = max8998_get_ldo(rdev); | 225 | int ldo = max8998_get_ldo(rdev); |
226 | struct max8998_data *max8998 = rdev_get_drvdata(rdev); | ||
221 | int reg, shift = 0, mask = 0xff; | 227 | int reg, shift = 0, mask = 0xff; |
222 | 228 | ||
223 | switch (ldo) { | 229 | switch (ldo) { |
@@ -254,10 +260,10 @@ static int max8998_get_voltage_register(struct regulator_dev *rdev, | |||
254 | reg = MAX8998_REG_LDO12 + (ldo - MAX8998_LDO12); | 260 | reg = MAX8998_REG_LDO12 + (ldo - MAX8998_LDO12); |
255 | break; | 261 | break; |
256 | case MAX8998_BUCK1: | 262 | case MAX8998_BUCK1: |
257 | reg = MAX8998_REG_BUCK1_DVSARM1; | 263 | reg = MAX8998_REG_BUCK1_VOLTAGE1 + max8998->buck1_idx; |
258 | break; | 264 | break; |
259 | case MAX8998_BUCK2: | 265 | case MAX8998_BUCK2: |
260 | reg = MAX8998_REG_BUCK2_DVSINT1; | 266 | reg = MAX8998_REG_BUCK2_VOLTAGE1 + max8998->buck2_idx; |
261 | break; | 267 | break; |
262 | case MAX8998_BUCK3: | 268 | case MAX8998_BUCK3: |
263 | reg = MAX8998_REG_BUCK3; | 269 | reg = MAX8998_REG_BUCK3; |
diff --git a/include/linux/mfd/max8998-private.h b/include/linux/mfd/max8998-private.h index 0ff42116d5dd..7363dea6bbcd 100644 --- a/include/linux/mfd/max8998-private.h +++ b/include/linux/mfd/max8998-private.h | |||
@@ -48,12 +48,12 @@ enum { | |||
48 | MAX8998_REG_ONOFF2, | 48 | MAX8998_REG_ONOFF2, |
49 | MAX8998_REG_ONOFF3, | 49 | MAX8998_REG_ONOFF3, |
50 | MAX8998_REG_ONOFF4, | 50 | MAX8998_REG_ONOFF4, |
51 | MAX8998_REG_BUCK1_DVSARM1, | 51 | MAX8998_REG_BUCK1_VOLTAGE1, |
52 | MAX8998_REG_BUCK1_DVSARM2, | 52 | MAX8998_REG_BUCK1_VOLTAGE2, |
53 | MAX8998_REG_BUCK1_DVSARM3, | 53 | MAX8998_REG_BUCK1_VOLTAGE3, |
54 | MAX8998_REG_BUCK1_DVSARM4, | 54 | MAX8998_REG_BUCK1_VOLTAGE4, |
55 | MAX8998_REG_BUCK2_DVSINT1, | 55 | MAX8998_REG_BUCK2_VOLTAGE1, |
56 | MAX8998_REG_BUCK2_DVSINT2, | 56 | MAX8998_REG_BUCK2_VOLTAGE2, |
57 | MAX8998_REG_BUCK3, | 57 | MAX8998_REG_BUCK3, |
58 | MAX8998_REG_BUCK4, | 58 | MAX8998_REG_BUCK4, |
59 | MAX8998_REG_LDO2_LDO3, | 59 | MAX8998_REG_LDO2_LDO3, |