regulator: max8998 BUCK1/2 internal voltages and indexes defined
authorLukasz Majewski <l.majewski@samsung.com>
Mon, 27 Sep 2010 12:32:25 +0000 (14:32 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 28 Oct 2010 22:30:11 +0000 (00:30 +0200)
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>
drivers/regulator/max8998.c
include/linux/mfd/max8998-private.h

index 1e5bd504fbad844cba184ce30f3e5467bd56fe03..7ae0639c1394f878b228cd4b6c3e34d1ebb4e12f 100644 (file)
@@ -39,6 +39,11 @@ struct max8998_data {
        struct max8998_dev      *iodev;
        int                     num_regulators;
        struct regulator_dev    **rdev;
+       u8                      buck1_vol[4]; /* voltages for selection */
+       u8                      buck2_vol[2];
+       unsigned int            buck1_idx; /* index to last changed voltage */
+                                          /* value in a set */
+       unsigned int            buck2_idx;
 };
 
 struct voltage_map_desc {
@@ -218,6 +223,7 @@ static int max8998_get_voltage_register(struct regulator_dev *rdev,
                                int *_reg, int *_shift, int *_mask)
 {
        int ldo = max8998_get_ldo(rdev);
+       struct max8998_data *max8998 = rdev_get_drvdata(rdev);
        int reg, shift = 0, mask = 0xff;
 
        switch (ldo) {
@@ -254,10 +260,10 @@ static int max8998_get_voltage_register(struct regulator_dev *rdev,
                reg = MAX8998_REG_LDO12 + (ldo - MAX8998_LDO12);
                break;
        case MAX8998_BUCK1:
-               reg = MAX8998_REG_BUCK1_DVSARM1;
+               reg = MAX8998_REG_BUCK1_VOLTAGE1 + max8998->buck1_idx;
                break;
        case MAX8998_BUCK2:
-               reg = MAX8998_REG_BUCK2_DVSINT1;
+               reg = MAX8998_REG_BUCK2_VOLTAGE1 + max8998->buck2_idx;
                break;
        case MAX8998_BUCK3:
                reg = MAX8998_REG_BUCK3;
index 0ff42116d5dd2bad342f4faef9e20291563a6efa..7363dea6bbcdfcd8fd719426357346a043b266cd 100644 (file)
@@ -48,12 +48,12 @@ enum {
        MAX8998_REG_ONOFF2,
        MAX8998_REG_ONOFF3,
        MAX8998_REG_ONOFF4,
-       MAX8998_REG_BUCK1_DVSARM1,
-       MAX8998_REG_BUCK1_DVSARM2,
-       MAX8998_REG_BUCK1_DVSARM3,
-       MAX8998_REG_BUCK1_DVSARM4,
-       MAX8998_REG_BUCK2_DVSINT1,
-       MAX8998_REG_BUCK2_DVSINT2,
+       MAX8998_REG_BUCK1_VOLTAGE1,
+       MAX8998_REG_BUCK1_VOLTAGE2,
+       MAX8998_REG_BUCK1_VOLTAGE3,
+       MAX8998_REG_BUCK1_VOLTAGE4,
+       MAX8998_REG_BUCK2_VOLTAGE1,
+       MAX8998_REG_BUCK2_VOLTAGE2,
        MAX8998_REG_BUCK3,
        MAX8998_REG_BUCK4,
        MAX8998_REG_LDO2_LDO3,