Commit 8096236d authored by Anand K Mistry's avatar Anand K Mistry Committed by Mark Brown

regulator: mt6397: Implement of_map_mode

Implementing of_map_mode is necessary to be able to specify operating
modes in the devicetree using 'regulator-allowed-modes', and to change
regulator modes.
Signed-off-by: default avatarAnand K Mistry <amistry@google.com>
Link: https://lore.kernel.org/r/20200702162231.v2.3.I7acfb591bfacf3b1b04a3d388385098bfcc9fecd@changeidSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1c537b2d
...@@ -53,6 +53,7 @@ struct mt6397_regulator_info { ...@@ -53,6 +53,7 @@ struct mt6397_regulator_info {
.vsel_mask = vosel_mask, \ .vsel_mask = vosel_mask, \
.enable_reg = enreg, \ .enable_reg = enreg, \
.enable_mask = BIT(0), \ .enable_mask = BIT(0), \
.of_map_mode = mt6397_map_mode, \
}, \ }, \
.qi = BIT(13), \ .qi = BIT(13), \
.vselon_reg = voselon, \ .vselon_reg = voselon, \
...@@ -144,6 +145,18 @@ static const unsigned int ldo_volt_table7[] = { ...@@ -144,6 +145,18 @@ static const unsigned int ldo_volt_table7[] = {
1300000, 1500000, 1800000, 2000000, 2500000, 2800000, 3000000, 3300000, 1300000, 1500000, 1800000, 2000000, 2500000, 2800000, 3000000, 3300000,
}; };
static unsigned int mt6397_map_mode(unsigned int mode)
{
switch (mode) {
case MT6397_BUCK_MODE_AUTO:
return REGULATOR_MODE_NORMAL;
case MT6397_BUCK_MODE_FORCE_PWM:
return REGULATOR_MODE_FAST;
default:
return REGULATOR_MODE_INVALID;
}
}
static int mt6397_regulator_set_mode(struct regulator_dev *rdev, static int mt6397_regulator_set_mode(struct regulator_dev *rdev,
unsigned int mode) unsigned int mode)
{ {
......
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