Commit bae5e9c3 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

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: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent c972a029
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment