regulator: stpmic1: Add active discharge support
Add support for active discharge for USB power switches. Signed-off-by: pascal paillet <p.paillet@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
714a74f13e
Коммит
e6fff62ab8
|
@ -176,11 +176,19 @@ static const struct regulator_ops stpmic1_vref_ddr_ops = {
|
||||||
.disable = regulator_disable_regmap,
|
.disable = regulator_disable_regmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct regulator_ops stpmic1_boost_regul_ops = {
|
||||||
|
.is_enabled = regulator_is_enabled_regmap,
|
||||||
|
.enable = regulator_enable_regmap,
|
||||||
|
.disable = regulator_disable_regmap,
|
||||||
|
.set_over_current_protection = stpmic1_set_icc,
|
||||||
|
};
|
||||||
|
|
||||||
static const struct regulator_ops stpmic1_switch_regul_ops = {
|
static const struct regulator_ops stpmic1_switch_regul_ops = {
|
||||||
.is_enabled = regulator_is_enabled_regmap,
|
.is_enabled = regulator_is_enabled_regmap,
|
||||||
.enable = regulator_enable_regmap,
|
.enable = regulator_enable_regmap,
|
||||||
.disable = regulator_disable_regmap,
|
.disable = regulator_disable_regmap,
|
||||||
.set_over_current_protection = stpmic1_set_icc,
|
.set_over_current_protection = stpmic1_set_icc,
|
||||||
|
.set_active_discharge = regulator_set_active_discharge_regmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define REG_LDO(ids, base) { \
|
#define REG_LDO(ids, base) { \
|
||||||
|
@ -281,7 +289,24 @@ static const struct regulator_ops stpmic1_switch_regul_ops = {
|
||||||
.supply_name = #base, \
|
.supply_name = #base, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REG_SWITCH(ids, base, reg, mask, val) { \
|
#define REG_BOOST(ids, base) { \
|
||||||
|
.name = #ids, \
|
||||||
|
.id = STPMIC1_##ids, \
|
||||||
|
.n_voltages = 1, \
|
||||||
|
.ops = &stpmic1_boost_regul_ops, \
|
||||||
|
.type = REGULATOR_VOLTAGE, \
|
||||||
|
.owner = THIS_MODULE, \
|
||||||
|
.min_uV = 0, \
|
||||||
|
.fixed_uV = 5000000, \
|
||||||
|
.enable_reg = BST_SW_CR, \
|
||||||
|
.enable_mask = BOOST_ENABLED, \
|
||||||
|
.enable_val = BOOST_ENABLED, \
|
||||||
|
.disable_val = 0, \
|
||||||
|
.enable_time = PMIC_ENABLE_TIME_US, \
|
||||||
|
.supply_name = #base, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define REG_VBUS_OTG(ids, base) { \
|
||||||
.name = #ids, \
|
.name = #ids, \
|
||||||
.id = STPMIC1_##ids, \
|
.id = STPMIC1_##ids, \
|
||||||
.n_voltages = 1, \
|
.n_voltages = 1, \
|
||||||
|
@ -290,12 +315,35 @@ static const struct regulator_ops stpmic1_switch_regul_ops = {
|
||||||
.owner = THIS_MODULE, \
|
.owner = THIS_MODULE, \
|
||||||
.min_uV = 0, \
|
.min_uV = 0, \
|
||||||
.fixed_uV = 5000000, \
|
.fixed_uV = 5000000, \
|
||||||
.enable_reg = (reg), \
|
.enable_reg = BST_SW_CR, \
|
||||||
.enable_mask = (mask), \
|
.enable_mask = USBSW_OTG_SWITCH_ENABLED, \
|
||||||
.enable_val = (val), \
|
.enable_val = USBSW_OTG_SWITCH_ENABLED, \
|
||||||
.disable_val = 0, \
|
.disable_val = 0, \
|
||||||
.enable_time = PMIC_ENABLE_TIME_US, \
|
.enable_time = PMIC_ENABLE_TIME_US, \
|
||||||
.supply_name = #base, \
|
.supply_name = #base, \
|
||||||
|
.active_discharge_reg = BST_SW_CR, \
|
||||||
|
.active_discharge_mask = VBUS_OTG_DISCHARGE, \
|
||||||
|
.active_discharge_on = VBUS_OTG_DISCHARGE, \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define REG_SW_OUT(ids, base) { \
|
||||||
|
.name = #ids, \
|
||||||
|
.id = STPMIC1_##ids, \
|
||||||
|
.n_voltages = 1, \
|
||||||
|
.ops = &stpmic1_switch_regul_ops, \
|
||||||
|
.type = REGULATOR_VOLTAGE, \
|
||||||
|
.owner = THIS_MODULE, \
|
||||||
|
.min_uV = 0, \
|
||||||
|
.fixed_uV = 5000000, \
|
||||||
|
.enable_reg = BST_SW_CR, \
|
||||||
|
.enable_mask = SWIN_SWOUT_ENABLED, \
|
||||||
|
.enable_val = SWIN_SWOUT_ENABLED, \
|
||||||
|
.disable_val = 0, \
|
||||||
|
.enable_time = PMIC_ENABLE_TIME_US, \
|
||||||
|
.supply_name = #base, \
|
||||||
|
.active_discharge_reg = BST_SW_CR, \
|
||||||
|
.active_discharge_mask = SW_OUT_DISCHARGE, \
|
||||||
|
.active_discharge_on = SW_OUT_DISCHARGE, \
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct stpmic1_regulator_cfg stpmic1_regulator_cfgs[] = {
|
static const struct stpmic1_regulator_cfg stpmic1_regulator_cfgs[] = {
|
||||||
|
@ -375,23 +423,17 @@ static const struct stpmic1_regulator_cfg stpmic1_regulator_cfgs[] = {
|
||||||
.mask_reset_mask = BIT(6),
|
.mask_reset_mask = BIT(6),
|
||||||
},
|
},
|
||||||
[STPMIC1_BOOST] = {
|
[STPMIC1_BOOST] = {
|
||||||
.desc = REG_SWITCH(BOOST, boost, BST_SW_CR,
|
.desc = REG_BOOST(BOOST, boost),
|
||||||
BOOST_ENABLED,
|
|
||||||
BOOST_ENABLED),
|
|
||||||
.icc_reg = BUCKS_ICCTO_CR,
|
.icc_reg = BUCKS_ICCTO_CR,
|
||||||
.icc_mask = BIT(6),
|
.icc_mask = BIT(6),
|
||||||
},
|
},
|
||||||
[STPMIC1_VBUS_OTG] = {
|
[STPMIC1_VBUS_OTG] = {
|
||||||
.desc = REG_SWITCH(VBUS_OTG, pwr_sw1, BST_SW_CR,
|
.desc = REG_VBUS_OTG(VBUS_OTG, pwr_sw1),
|
||||||
USBSW_OTG_SWITCH_ENABLED,
|
|
||||||
USBSW_OTG_SWITCH_ENABLED),
|
|
||||||
.icc_reg = BUCKS_ICCTO_CR,
|
.icc_reg = BUCKS_ICCTO_CR,
|
||||||
.icc_mask = BIT(4),
|
.icc_mask = BIT(4),
|
||||||
},
|
},
|
||||||
[STPMIC1_SW_OUT] = {
|
[STPMIC1_SW_OUT] = {
|
||||||
.desc = REG_SWITCH(SW_OUT, pwr_sw2, BST_SW_CR,
|
.desc = REG_SW_OUT(SW_OUT, pwr_sw2),
|
||||||
SWIN_SWOUT_ENABLED,
|
|
||||||
SWIN_SWOUT_ENABLED),
|
|
||||||
.icc_reg = BUCKS_ICCTO_CR,
|
.icc_reg = BUCKS_ICCTO_CR,
|
||||||
.icc_mask = BIT(5),
|
.icc_mask = BIT(5),
|
||||||
},
|
},
|
||||||
|
|
Загрузка…
Ссылка в новой задаче