提交 32e5deac 编写于 作者: I Ivaylo Dimitrov 提交者: Mark Brown

regulator: twl: Regulator mode should not depend on regulator enabled state

When machine constraints are applied, regulator framework first sets
initial mode (if any) and then enables the regulator if needed. The current
code in twl4030reg_set_mode always checks if the regulator is enabled
before applying the mode. That results in -EACCES error returned for
"always-on" regulators which have "initial-mode" set in the board DTS. Fix
that by removing the unneeded check.
Signed-off-by: NIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 2330b05c
...@@ -371,7 +371,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) ...@@ -371,7 +371,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
{ {
struct twlreg_info *info = rdev_get_drvdata(rdev); struct twlreg_info *info = rdev_get_drvdata(rdev);
unsigned message; unsigned message;
int status;
/* We can only set the mode through state machine commands... */ /* We can only set the mode through state machine commands... */
switch (mode) { switch (mode) {
...@@ -385,13 +384,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode) ...@@ -385,13 +384,6 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
return -EINVAL; return -EINVAL;
} }
/* Ensure the resource is associated with some group */
status = twlreg_grp(rdev);
if (status < 0)
return status;
if (!(status & (P3_GRP_4030 | P2_GRP_4030 | P1_GRP_4030)))
return -EACCES;
return twl4030_send_pb_msg(message); return twl4030_send_pb_msg(message);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册