提交 40a86550 编写于 作者: J Jon Hunter 提交者: Mark Brown

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: NJon Hunter <jonathanh@nvidia.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 f55532a0
...@@ -432,6 +432,31 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = { ...@@ -432,6 +432,31 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
.get_current_limit = as3722_ldo3_get_current_limit, .get_current_limit = as3722_ldo3_get_current_limit,
}; };
static struct regulator_ops as3722_ldo6_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.map_voltage = regulator_map_voltage_linear_range,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear_range,
.get_current_limit = as3722_ldo_get_current_limit,
.set_current_limit = as3722_ldo_set_current_limit,
.get_bypass = regulator_get_bypass_regmap,
.set_bypass = regulator_set_bypass_regmap,
};
static struct regulator_ops as3722_ldo6_extcntrl_ops = {
.map_voltage = regulator_map_voltage_linear_range,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear_range,
.get_current_limit = as3722_ldo_get_current_limit,
.set_current_limit = as3722_ldo_set_current_limit,
.get_bypass = regulator_get_bypass_regmap,
.set_bypass = regulator_set_bypass_regmap,
};
static const struct regulator_linear_range as3722_ldo_ranges[] = { static const struct regulator_linear_range as3722_ldo_ranges[] = {
REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0), REGULATOR_LINEAR_RANGE(0, 0x00, 0x00, 0),
REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000), REGULATOR_LINEAR_RANGE(825000, 0x01, 0x24, 25000),
...@@ -829,6 +854,24 @@ static int as3722_regulator_probe(struct platform_device *pdev) ...@@ -829,6 +854,24 @@ static int as3722_regulator_probe(struct platform_device *pdev)
} }
} }
break; break;
case AS3722_REGULATOR_ID_LDO6:
if (reg_config->ext_control)
ops = &as3722_ldo6_extcntrl_ops;
else
ops = &as3722_ldo6_ops;
as3722_regs->desc[id].enable_time = 500;
as3722_regs->desc[id].bypass_reg =
AS3722_LDO6_VOLTAGE_REG;
as3722_regs->desc[id].bypass_mask =
AS3722_LDO_VSEL_MASK;
as3722_regs->desc[id].bypass_val_on =
AS3722_LDO6_VSEL_BYPASS;
as3722_regs->desc[id].bypass_val_off =
AS3722_LDO6_VSEL_BYPASS;
as3722_regs->desc[id].linear_ranges = as3722_ldo_ranges;
as3722_regs->desc[id].n_linear_ranges =
ARRAY_SIZE(as3722_ldo_ranges);
break;
case AS3722_REGULATOR_ID_SD0: case AS3722_REGULATOR_ID_SD0:
case AS3722_REGULATOR_ID_SD1: case AS3722_REGULATOR_ID_SD1:
case AS3722_REGULATOR_ID_SD6: case AS3722_REGULATOR_ID_SD6:
......
...@@ -196,6 +196,7 @@ ...@@ -196,6 +196,7 @@
#define AS3722_LDO3_VSEL_MIN 0x01 #define AS3722_LDO3_VSEL_MIN 0x01
#define AS3722_LDO3_VSEL_MAX 0x2D #define AS3722_LDO3_VSEL_MAX 0x2D
#define AS3722_LDO3_NUM_VOLT 0x2D #define AS3722_LDO3_NUM_VOLT 0x2D
#define AS3722_LDO6_VSEL_BYPASS 0x3F
#define AS3722_LDO_VSEL_MASK 0x7F #define AS3722_LDO_VSEL_MASK 0x7F
#define AS3722_LDO_VSEL_MIN 0x01 #define AS3722_LDO_VSEL_MIN 0x01
#define AS3722_LDO_VSEL_MAX 0x7F #define AS3722_LDO_VSEL_MAX 0x7F
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册