Skip to content

Commit 40a8655

Browse files
jonhunterbroonie
authored andcommitted
regulator: as3722: Add bypass support for LDO6
LD06 on the AS3722 power management IC supports a bypass mode. Bypass is enabled for the LDO by writing the value 0x3F to the voltage select field in the control register for the LDO. Note that this is the same register and field that is used to select the voltage as well for the LDO. Add support for bypass on LDO6 by specifying the various bypass parameters for regulator and adding new function pointer tables for the LDO. Note that the bypass OFF value is the same as the ON value simply because there is no actual OFF value and bypass will be disabled when a new voltage is written to the VSEL field. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f55532a commit 40a8655

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎drivers/regulator/as3722-regulator.c‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,31 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
432432
.get_current_limit = as3722_ldo3_get_current_limit,
433433
};
434434

435+
static struct regulator_ops as3722_ldo6_ops = {
436+
.is_enabled = regulator_is_enabled_regmap,
437+
.enable = regulator_enable_regmap,
438+
.disable = regulator_disable_regmap,
439+
.map_voltage = regulator_map_voltage_linear_range,
440+
.set_voltage_sel = regulator_set_voltage_sel_regmap,
441+
.get_voltage_sel = regulator_get_voltage_sel_regmap,
442+
.list_voltage = regulator_list_voltage_linear_range,
443+
.get_current_limit = as3722_ldo_get_current_limit,
444+
.set_current_limit = as3722_ldo_set_current_limit,
445+
.get_bypass = regulator_get_bypass_regmap,
446+
.set_bypass = regulator_set_bypass_regmap,
447+
};
448+
449+
static struct regulator_ops as3722_ldo6_extcntrl_ops = {
450+
.map_voltage = regulator_map_voltage_linear_range,
451+
.set_voltage_sel = regulator_set_voltage_sel_regmap,
452+
.get_voltage_sel = regulator_get_voltage_sel_regmap,
453+
.list_voltage = regulator_list_voltage_linear_range,
454+
.get_current_limit = as3722_ldo_get_current_limit,
455+
.set_current_limit = as3722_ldo_set_current_limit,
456+
.get_bypass = regulator_get_bypass_regmap,
457+
.set_bypass = regulator_set_bypass_regmap,
458+
};
459+
435460
static const struct regulator_linear_range as3722_ldo_ranges[] = {
436461
REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0),
437462
REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000),
@@ -829,6 +854,24 @@ static int as3722_regulator_probe(struct platform_device *pdev)
829854
}
830855
}
831856
break;
857+
case AS3722_REGULATOR_ID_LDO6:
858+
if (reg_config->ext_control)
859+
ops = &as3722_ldo6_extcntrl_ops;
860+
else
861+
ops = &as3722_ldo6_ops;
862+
as3722_regs->desc[id].enable_time = 500;
863+
as3722_regs->desc[id].bypass_reg =
864+
AS3722_LDO6_VOLTAGE_REG;
865+
as3722_regs->desc[id].bypass_mask =
866+
AS3722_LDO_VSEL_MASK;
867+
as3722_regs->desc[id].bypass_val_on =
868+
AS3722_LDO6_VSEL_BYPASS;
869+
as3722_regs->desc[id].bypass_val_off =
870+
AS3722_LDO6_VSEL_BYPASS;
871+
as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges;
872+
as3722_regs->desc[id].n_linear_ranges =
873+
ARRAY_SIZE(as3722_ldo_ranges);
874+
break;
832875
case AS3722_REGULATOR_ID_SD0:
833876
case AS3722_REGULATOR_ID_SD1:
834877
case AS3722_REGULATOR_ID_SD6:

‎include/linux/mfd/as3722.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@
196196
#define AS3722_LDO3_VSEL_MIN 0x01
197197
#define AS3722_LDO3_VSEL_MAX 0x2D
198198
#define AS3722_LDO3_NUM_VOLT 0x2D
199+
#define AS3722_LDO6_VSEL_BYPASS 0x3F
199200
#define AS3722_LDO_VSEL_MASK 0x7F
200201
#define AS3722_LDO_VSEL_MIN 0x01
201202
#define AS3722_LDO_VSEL_MAX 0x7F

0 commit comments

Comments
 (0)