Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1364925
| From | Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/3] regulator: twl: Provide of_map_mode for twl4030 |
| Date | 2016-03-26 09:40 +0100 |
| Message-ID | <rgRVg-6G7-9@gated-at.bofh.it> (permalink) |
| References | <rgRLz-6Ae-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
of_map_mode is needed so to be possible to set initial regulators mode from
the board DTS. Otherwise, for DT boot, regulators are left in their default
state after reset/reboot.
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
---
drivers/regulator/twl-regulator.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c
index aad748b0..be8d05e 100644
--- a/drivers/regulator/twl-regulator.c
+++ b/drivers/regulator/twl-regulator.c
@@ -395,6 +395,12 @@ static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
return twl4030_send_pb_msg(message);
}
+static inline unsigned int twl4030reg_map_mode(unsigned int mode)
+{
+ return mode == RES_STATE_ACTIVE ?
+ REGULATOR_MODE_NORMAL : REGULATOR_MODE_STANDBY;
+}
+
static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
@@ -897,10 +903,11 @@ static struct regulator_ops twlsmps_ops = {
#define TWL4030_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
remap_conf) \
TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
- remap_conf, TWL4030, twl4030fixed_ops)
+ remap_conf, TWL4030, twl4030fixed_ops, \
+ twl4030reg_map_mode)
#define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \
- 0x0, TWL6030, twl6030fixed_ops)
+ 0x0, TWL6030, twl6030fixed_ops, 0x0)
#define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \
static const struct twlreg_info TWL4030_INFO_##label = { \
@@ -917,6 +924,7 @@ static const struct twlreg_info TWL4030_INFO_##label = { \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.enable_time = turnon_delay, \
+ .of_map_mode = twl4030reg_map_mode, \
}, \
}
@@ -932,6 +940,7 @@ static const struct twlreg_info TWL4030_INFO_##label = { \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.enable_time = turnon_delay, \
+ .of_map_mode = twl4030reg_map_mode, \
}, \
}
@@ -977,7 +986,7 @@ static const struct twlreg_info TWL6032_INFO_##label = { \
}
#define TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, remap_conf, \
- family, operations) \
+ family, operations, map_mode) \
static const struct twlreg_info TWLFIXED_INFO_##label = { \
.base = offset, \
.id = num, \
@@ -992,6 +1001,7 @@ static const struct twlreg_info TWLFIXED_INFO_##label = { \
.owner = THIS_MODULE, \
.min_uV = mVolts * 1000, \
.enable_time = turnon_delay, \
+ .of_map_mode = map_mode, \
}, \
}
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] regulator: twl: Fix regulator mode support Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-03-26 09:30 +0100
[PATCH 1/3] regulator: twl: Make sure we have access to powerbus before trying to write to it Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-03-26 09:30 +0100
[PATCH 3/3] regulator: twl: Regulator mode should not depend on regulator enabled state Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-03-26 09:40 +0100
[PATCH 2/3] regulator: twl: Provide of_map_mode for twl4030 Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> - 2016-03-26 09:40 +0100
Re: [PATCH 2/3] regulator: twl: Provide of_map_mode for twl4030 Mark Brown <broonie@kernel.org> - 2016-03-29 09:50 +0200
csiph-web