Commit 318c658b authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: 88pm8607: Use enable_is_inverted flag with regulator_enable_regmap and friends APIs

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarHaojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 51dcdafc
...@@ -220,35 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) ...@@ -220,35 +220,6 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index)
return ret; return ret;
} }
static int pm8606_preg_enable(struct regulator_dev *rdev)
{
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
return pm860x_set_bits(info->i2c, rdev->desc->enable_reg,
1 << rdev->desc->enable_mask, 0);
}
static int pm8606_preg_disable(struct regulator_dev *rdev)
{
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
return pm860x_set_bits(info->i2c, rdev->desc->enable_reg,
1 << rdev->desc->enable_mask,
1 << rdev->desc->enable_mask);
}
static int pm8606_preg_is_enabled(struct regulator_dev *rdev)
{
struct pm8607_regulator_info *info = rdev_get_drvdata(rdev);
int ret;
ret = pm860x_reg_read(info->i2c, rdev->desc->enable_reg);
if (ret < 0)
return ret;
return !((unsigned char)ret & (1 << rdev->desc->enable_mask));
}
static struct regulator_ops pm8607_regulator_ops = { static struct regulator_ops pm8607_regulator_ops = {
.list_voltage = pm8607_list_voltage, .list_voltage = pm8607_list_voltage,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
...@@ -259,9 +230,9 @@ static struct regulator_ops pm8607_regulator_ops = { ...@@ -259,9 +230,9 @@ static struct regulator_ops pm8607_regulator_ops = {
}; };
static struct regulator_ops pm8606_preg_ops = { static struct regulator_ops pm8606_preg_ops = {
.enable = pm8606_preg_enable, .enable = regulator_enable_regmap,
.disable = pm8606_preg_disable, .disable = regulator_disable_regmap,
.is_enabled = pm8606_preg_is_enabled, .is_enabled = regulator_is_enabled_regmap,
}; };
#define PM8606_PREG(ereg, ebit) \ #define PM8606_PREG(ereg, ebit) \
...@@ -274,6 +245,7 @@ static struct regulator_ops pm8606_preg_ops = { ...@@ -274,6 +245,7 @@ static struct regulator_ops pm8606_preg_ops = {
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
.enable_reg = PM8606_##ereg, \ .enable_reg = PM8606_##ereg, \
.enable_mask = (ebit), \ .enable_mask = (ebit), \
.enable_is_inverted = true, \
}, \ }, \
} }
......
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