Skip to content

Commit 7e37c85

Browse files
wensbroonie
authored andcommitted
regulator: mt6358: split ops for buck and linear range LDO regulators
The buck and linear range LDO (VSRAM_*) regulators share one set of ops. This set includes support for get/set mode. However this only makes sense for buck regulators, not LDOs. The callbacks were not checking whether the register offset and/or mask for mode setting was valid or not. This ends up making the kernel report "normal" mode operation for the LDOs. Create a new set of ops without the get/set mode callbacks for the linear range LDO regulators. Fixes: f67ff1b ("regulator: mt6358: Add support for MT6358 regulator") Signed-off-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 6223e07 commit 7e37c85

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/regulator/mt6358-regulator.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct mt6358_regulator_info {
4343
.desc = { \
4444
.name = #vreg, \
4545
.of_match = of_match_ptr(match), \
46-
.ops = &mt6358_volt_range_ops, \
46+
.ops = &mt6358_buck_ops, \
4747
.type = REGULATOR_VOLTAGE, \
4848
.id = MT6358_ID_##vreg, \
4949
.owner = THIS_MODULE, \
@@ -139,7 +139,7 @@ struct mt6358_regulator_info {
139139
.desc = { \
140140
.name = #vreg, \
141141
.of_match = of_match_ptr(match), \
142-
.ops = &mt6358_volt_range_ops, \
142+
.ops = &mt6358_buck_ops, \
143143
.type = REGULATOR_VOLTAGE, \
144144
.id = MT6366_ID_##vreg, \
145145
.owner = THIS_MODULE, \
@@ -450,7 +450,7 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev)
450450
}
451451
}
452452

453-
static const struct regulator_ops mt6358_volt_range_ops = {
453+
static const struct regulator_ops mt6358_buck_ops = {
454454
.list_voltage = regulator_list_voltage_linear,
455455
.map_voltage = regulator_map_voltage_linear,
456456
.set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = {
464464
.get_mode = mt6358_regulator_get_mode,
465465
};
466466

467+
static const struct regulator_ops mt6358_volt_range_ops = {
468+
.list_voltage = regulator_list_voltage_linear,
469+
.map_voltage = regulator_map_voltage_linear,
470+
.set_voltage_sel = regulator_set_voltage_sel_regmap,
471+
.get_voltage_sel = mt6358_get_buck_voltage_sel,
472+
.set_voltage_time_sel = regulator_set_voltage_time_sel,
473+
.enable = regulator_enable_regmap,
474+
.disable = regulator_disable_regmap,
475+
.is_enabled = regulator_is_enabled_regmap,
476+
.get_status = mt6358_get_status,
477+
};
478+
467479
static const struct regulator_ops mt6358_volt_table_ops = {
468480
.list_voltage = regulator_list_voltage_table,
469481
.map_voltage = regulator_map_voltage_iterate,

0 commit comments

Comments
 (0)