regulator: tps65910: Convert to get_voltage_sel
authorAxel Lin <axel.lin@gmail.com>
Wed, 9 May 2012 01:22:47 +0000 (09:22 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 9 May 2012 08:52:13 +0000 (09:52 +0100)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/tps65910-regulator.c

index 3d9c54f8a88cbcf0d8314d2fc0d9642e459a1f6b..79bb0f39d7939245f2af50e1ee5f1c7657340578 100644 (file)
@@ -620,10 +620,10 @@ static int tps65910_get_voltage_dcdc_sel(struct regulator_dev *dev)
        return -EINVAL;
 }
 
-static int tps65910_get_voltage(struct regulator_dev *dev)
+static int tps65910_get_voltage_sel(struct regulator_dev *dev)
 {
        struct tps65910_reg *pmic = rdev_get_drvdata(dev);
-       int reg, value, id = rdev_get_id(dev), voltage = 0;
+       int reg, value, id = rdev_get_id(dev);
 
        reg = pmic->get_ctrl_reg(id);
        if (reg < 0)
@@ -650,9 +650,7 @@ static int tps65910_get_voltage(struct regulator_dev *dev)
                return -EINVAL;
        }
 
-       voltage = pmic->info[id]->voltage_table[value] * 1000;
-
-       return voltage;
+       return value;
 }
 
 static int tps65910_get_voltage_vdd3(struct regulator_dev *dev)
@@ -660,10 +658,10 @@ static int tps65910_get_voltage_vdd3(struct regulator_dev *dev)
        return 5 * 1000 * 1000;
 }
 
-static int tps65911_get_voltage(struct regulator_dev *dev)
+static int tps65911_get_voltage_sel(struct regulator_dev *dev)
 {
        struct tps65910_reg *pmic = rdev_get_drvdata(dev);
-       int step_mv, id = rdev_get_id(dev);
+       int id = rdev_get_id(dev);
        u8 value, reg;
 
        reg = pmic->get_ctrl_reg(id);
@@ -676,13 +674,6 @@ static int tps65911_get_voltage(struct regulator_dev *dev)
        case TPS65911_REG_LDO4:
                value &= LDO1_SEL_MASK;
                value >>= LDO_SEL_SHIFT;
-               /* The first 5 values of the selector correspond to 1V */
-               if (value < 5)
-                       value = 0;
-               else
-                       value -= 4;
-
-               step_mv = 50;
                break;
        case TPS65911_REG_LDO3:
        case TPS65911_REG_LDO5:
@@ -691,23 +682,16 @@ static int tps65911_get_voltage(struct regulator_dev *dev)
        case TPS65911_REG_LDO8:
                value &= LDO3_SEL_MASK;
                value >>= LDO_SEL_SHIFT;
-               /* The first 3 values of the selector correspond to 1V */
-               if (value < 3)
-                       value = 0;
-               else
-                       value -= 2;
-
-               step_mv = 100;
                break;
        case TPS65910_REG_VIO:
                value &= LDO_SEL_MASK;
                value >>= LDO_SEL_SHIFT;
-               return pmic->info[id]->voltage_table[value] * 1000;
+               break;
        default:
                return -EINVAL;
        }
 
-       return (LDO_MIN_VOLT + value * step_mv) * 1000;
+       return value;
 }
 
 static int tps65910_set_voltage_dcdc_sel(struct regulator_dev *dev,
@@ -943,7 +927,7 @@ static struct regulator_ops tps65910_ops = {
        .enable_time            = tps65910_enable_time,
        .set_mode               = tps65910_set_mode,
        .get_mode               = tps65910_get_mode,
-       .get_voltage            = tps65910_get_voltage,
+       .get_voltage_sel        = tps65910_get_voltage_sel,
        .set_voltage_sel        = tps65910_set_voltage_sel,
        .list_voltage           = tps65910_list_voltage,
 };
@@ -955,7 +939,7 @@ static struct regulator_ops tps65911_ops = {
        .enable_time            = tps65910_enable_time,
        .set_mode               = tps65910_set_mode,
        .get_mode               = tps65910_get_mode,
-       .get_voltage            = tps65911_get_voltage,
+       .get_voltage_sel        = tps65911_get_voltage_sel,
        .set_voltage_sel        = tps65911_set_voltage_sel,
        .list_voltage           = tps65911_list_voltage,
 };