}
/* 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);
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)
{
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)
{
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)
{
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)
{
}
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,
/* 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,
/* 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,