summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-15 10:24:56 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-15 18:32:57 +0100
commitbae5e9c33f44633b71d69b350884b243874fd92d (patch)
treecb85c8a1c0ca4c6e9c50ee7c86543b5f5f1474d8
parentc972a029483ac5a546a6405e30e4eede6fbd19f9 (diff)
regulator: da903x: Kill da903x_[get|set]_[ldo12|ldo14]_voltage_sel() functions
Now the implementation of da903x_set_voltage_sel, da9030_set_ldo14_voltage_sel, and da9034_set_ldo12_voltage_sel are exactly the same. da903x_get_voltage_sel, da9030_get_ldo14_voltage_sel and da9034_get_ldo12_voltage_sel are exactly the same. So we can use da903x_[get|set]_voltage_sel and kill other functions. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--drivers/regulator/da903x.c73
1 files changed, 6 insertions, 67 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c
index 6e78ef1667fb..1005f5f7e603 100644
--- a/drivers/regulator/da903x.c
+++ b/drivers/regulator/da903x.c
@@ -101,8 +101,7 @@ static inline int check_range(struct da903x_regulator_info *info,
}
/* DA9030/DA9034 common operations */
-static int da903x_set_ldo_voltage_sel(struct regulator_dev *rdev,
- unsigned selector)
+static int da903x_set_voltage_sel(struct regulator_dev *rdev, unsigned selector)
{
struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
struct device *da9034_dev = to_da903x_dev(rdev);
@@ -185,19 +184,6 @@ static int da9030_set_ldo1_15_voltage_sel(struct regulator_dev *rdev,
return da903x_update(da903x_dev, info->vol_reg, val, mask);
}
-static int da9030_set_ldo14_voltage_sel(struct regulator_dev *rdev,
- unsigned selector)
-{
- struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
- struct device *da903x_dev = to_da903x_dev(rdev);
- uint8_t val, mask;
-
- val = selector << info->vol_shift;
- mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
-
- return da903x_update(da903x_dev, info->vol_reg, val, mask);
-}
-
static int da9030_map_ldo14_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
@@ -220,23 +206,6 @@ static int da9030_map_ldo14_voltage(struct regulator_dev *rdev,
return sel;
}
-static int da9030_get_ldo14_voltage_sel(struct regulator_dev *rdev)
-{
- struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
- struct device *da903x_dev = to_da903x_dev(rdev);
- uint8_t val, mask;
- int ret;
-
- ret = da903x_read(da903x_dev, info->vol_reg, &val);
- if (ret)
- return ret;
-
- mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
- val = (val & mask) >> info->vol_shift;
-
- return val;
-}
-
static int da9030_list_ldo14_voltage(struct regulator_dev *rdev,
unsigned selector)
{
@@ -277,19 +246,6 @@ static int da9034_set_dvc_voltage_sel(struct regulator_dev *rdev,
return ret;
}
-static int da9034_set_ldo12_voltage_sel(struct regulator_dev *rdev,
- unsigned selector)
-{
- struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
- struct device *da9034_dev = to_da903x_dev(rdev);
- uint8_t val, mask;
-
- val = selector << info->vol_shift;
- mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
-
- return da903x_update(da9034_dev, info->vol_reg, val, mask);
-}
-
static int da9034_map_ldo12_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
@@ -307,23 +263,6 @@ static int da9034_map_ldo12_voltage(struct regulator_dev *rdev,
return sel;
}
-static int da9034_get_ldo12_voltage_sel(struct regulator_dev *rdev)
-{
- struct da903x_regulator_info *info = rdev_get_drvdata(rdev);
- struct device *da9034_dev = to_da903x_dev(rdev);
- uint8_t val, mask;
- int ret;
-
- ret = da903x_read(da9034_dev, info->vol_reg, &val);
- if (ret)
- return ret;
-
- mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
- val = (val & mask) >> info->vol_shift;
-
- return val;
-}
-
static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
unsigned selector)
{
@@ -342,7 +281,7 @@ static int da9034_list_ldo12_voltage(struct regulator_dev *rdev,
}
static struct regulator_ops da903x_regulator_ldo_ops = {
- .set_voltage_sel = da903x_set_ldo_voltage_sel,
+ .set_voltage_sel = da903x_set_voltage_sel,
.get_voltage_sel = da903x_get_voltage_sel,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
@@ -353,8 +292,8 @@ static struct regulator_ops da903x_regulator_ldo_ops = {
/* NOTE: this is dedicated for the insane DA9030 LDO14 */
static struct regulator_ops da9030_regulator_ldo14_ops = {
- .set_voltage_sel = da9030_set_ldo14_voltage_sel,
- .get_voltage_sel = da9030_get_ldo14_voltage_sel,
+ .set_voltage_sel = da903x_set_voltage_sel,
+ .get_voltage_sel = da903x_get_voltage_sel,
.list_voltage = da9030_list_ldo14_voltage,
.map_voltage = da9030_map_ldo14_voltage,
.enable = da903x_enable,
@@ -385,8 +324,8 @@ static struct regulator_ops da9034_regulator_dvc_ops = {
/* NOTE: this is dedicated for the insane LDO12 */
static struct regulator_ops da9034_regulator_ldo12_ops = {
- .set_voltage_sel = da9034_set_ldo12_voltage_sel,
- .get_voltage_sel = da9034_get_ldo12_voltage_sel,
+ .set_voltage_sel = da903x_set_voltage_sel,
+ .get_voltage_sel = da903x_get_voltage_sel,
.list_voltage = da9034_list_ldo12_voltage,
.map_voltage = da9034_map_ldo12_voltage,
.enable = da903x_enable,