Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: max8973: Set VSEL regmap ops if DVS GPIO is not set

Use regmap helpers for get_voltage_sel and set_voltage_sel ops
if the DVS GPIO is not set.

The DVS GPIO allows on the fly selection of the VSEL register
from two choices. However, if it is not set, the VSEL register
will stay fixed and we can use the regmap ops. This allows use
of the *hardware_vsel* regulator APIs.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Mikko Perttunen and committed by
Mark Brown
b10c7f3c ffaab991

+9
+9
drivers/regulator/max8973-regulator.c
··· 637 637 max->lru_index[i] = i; 638 638 max->lru_index[0] = max->curr_vout_reg; 639 639 max->lru_index[max->curr_vout_reg] = 0; 640 + } else { 641 + /* 642 + * If there is no DVS GPIO, the VOUT register 643 + * address is fixed. 644 + */ 645 + max->ops.set_voltage_sel = regulator_set_voltage_sel_regmap; 646 + max->ops.get_voltage_sel = regulator_get_voltage_sel_regmap; 647 + max->desc.vsel_reg = max->curr_vout_reg; 648 + max->desc.vsel_mask = MAX8973_VOUT_MASK; 640 649 } 641 650 642 651 if (pdata_from_dt)