Commit 0ff3897d authored by Balaji T K's avatar Balaji T K Committed by Liam Girdwood

regulator: twl6030: do not write to _GRP for regulator disable

TWL6030: regulator is disabled via VREG_STATE
TWL4030: regulator is disabled via VREG_GRP
Since there is nothing common, split twlreg_enable similar to other regulator_ops
Signed-off-by: default avatarBalaji T K <balajitk@ti.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent f8c2940b
...@@ -194,7 +194,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev) ...@@ -194,7 +194,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev)
return ret; return ret;
} }
static int twlreg_disable(struct regulator_dev *rdev) static int twl4030reg_disable(struct regulator_dev *rdev)
{ {
struct twlreg_info *info = rdev_get_drvdata(rdev); struct twlreg_info *info = rdev_get_drvdata(rdev);
int grp; int grp;
...@@ -204,28 +204,25 @@ static int twlreg_disable(struct regulator_dev *rdev) ...@@ -204,28 +204,25 @@ static int twlreg_disable(struct regulator_dev *rdev)
if (grp < 0) if (grp < 0)
return grp; return grp;
/* For 6030, set the off state for all grps enabled */ grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
if (twl_class_is_6030()) {
ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
(grp & (P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030)) <<
TWL6030_CFG_STATE_GRP_SHIFT |
TWL6030_CFG_STATE_OFF);
if (ret)
return ret;
}
if (twl_class_is_4030())
grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030);
else
grp &= ~(P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030);
ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp);
/* Next, associate cleared grp in state register */ return ret;
if (!ret && twl_class_is_6030()) }
ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
grp << TWL6030_CFG_STATE_GRP_SHIFT | static int twl6030reg_disable(struct regulator_dev *rdev)
TWL6030_CFG_STATE_OFF); {
struct twlreg_info *info = rdev_get_drvdata(rdev);
int grp = 0;
int ret;
grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030;
/* For 6030, set the off state for all grps enabled */
ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE,
(grp) << TWL6030_CFG_STATE_GRP_SHIFT |
TWL6030_CFG_STATE_OFF);
return ret; return ret;
} }
...@@ -485,7 +482,7 @@ static struct regulator_ops twl4030ldo_ops = { ...@@ -485,7 +482,7 @@ static struct regulator_ops twl4030ldo_ops = {
.get_voltage = twl4030ldo_get_voltage, .get_voltage = twl4030ldo_get_voltage,
.enable = twl4030reg_enable, .enable = twl4030reg_enable,
.disable = twlreg_disable, .disable = twl4030reg_disable,
.is_enabled = twl4030reg_is_enabled, .is_enabled = twl4030reg_is_enabled,
.set_mode = twl4030reg_set_mode, .set_mode = twl4030reg_set_mode,
...@@ -543,7 +540,7 @@ static struct regulator_ops twl6030ldo_ops = { ...@@ -543,7 +540,7 @@ static struct regulator_ops twl6030ldo_ops = {
.get_voltage = twl6030ldo_get_voltage, .get_voltage = twl6030ldo_get_voltage,
.enable = twl6030reg_enable, .enable = twl6030reg_enable,
.disable = twlreg_disable, .disable = twl6030reg_disable,
.is_enabled = twl6030reg_is_enabled, .is_enabled = twl6030reg_is_enabled,
.set_mode = twl6030reg_set_mode, .set_mode = twl6030reg_set_mode,
...@@ -576,7 +573,7 @@ static struct regulator_ops twl4030fixed_ops = { ...@@ -576,7 +573,7 @@ static struct regulator_ops twl4030fixed_ops = {
.get_voltage = twlfixed_get_voltage, .get_voltage = twlfixed_get_voltage,
.enable = twl4030reg_enable, .enable = twl4030reg_enable,
.disable = twlreg_disable, .disable = twl4030reg_disable,
.is_enabled = twl4030reg_is_enabled, .is_enabled = twl4030reg_is_enabled,
.set_mode = twl4030reg_set_mode, .set_mode = twl4030reg_set_mode,
...@@ -590,7 +587,7 @@ static struct regulator_ops twl6030fixed_ops = { ...@@ -590,7 +587,7 @@ static struct regulator_ops twl6030fixed_ops = {
.get_voltage = twlfixed_get_voltage, .get_voltage = twlfixed_get_voltage,
.enable = twl6030reg_enable, .enable = twl6030reg_enable,
.disable = twlreg_disable, .disable = twl6030reg_disable,
.is_enabled = twl6030reg_is_enabled, .is_enabled = twl6030reg_is_enabled,
.set_mode = twl6030reg_set_mode, .set_mode = twl6030reg_set_mode,
...@@ -600,7 +597,7 @@ static struct regulator_ops twl6030fixed_ops = { ...@@ -600,7 +597,7 @@ static struct regulator_ops twl6030fixed_ops = {
static struct regulator_ops twl6030_fixed_resource = { static struct regulator_ops twl6030_fixed_resource = {
.enable = twl6030reg_enable, .enable = twl6030reg_enable,
.disable = twlreg_disable, .disable = twl6030reg_disable,
.is_enabled = twl6030reg_is_enabled, .is_enabled = twl6030reg_is_enabled,
.get_status = twl6030reg_get_status, .get_status = twl6030reg_get_status,
}; };
......
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