/** * struct ab8500_ext_regulator_info - ab8500 regulator information * @dev: device pointer * @desc: regulator description * @cfg: regulator configuration (extension of regulator FW configuration) * @update_bank: bank to control on/off * @update_reg: register to control on/off * @update_mask: mask to enable/disable and set mode of regulator * @update_val: bits holding the regulator current mode * @update_val_hp: bits to set EN pin active (LPn pin deactive) * normally this means high power mode * @update_val_lp: bits to set EN pin active and LPn pin active * normally this means low power mode * @update_val_hw: bits to set regulator pins in HW control * SysClkReq pins and logic will choose mode
*/ struct ab8500_ext_regulator_info { struct device *dev; struct regulator_desc desc; struct ab8500_ext_regulator_cfg *cfg;
u8 update_bank;
u8 update_reg;
u8 update_mask;
u8 update_val;
u8 update_val_hp;
u8 update_val_lp;
u8 update_val_hw;
};
if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); return -EINVAL;
}
/* * To satisfy both HW high power request and SW request, the regulator * must be on in high power.
*/ if (info->cfg && info->cfg->hwreq)
regval = info->update_val_hp; else
regval = info->update_val;
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, regval); if (ret < 0) {
dev_err(rdev_get_dev(rdev), "couldn't set enable bits for regulator\n"); return ret;
}
staticint ab8500_ext_regulator_set_mode(struct regulator_dev *rdev, unsignedint mode)
{ int ret = 0; struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
u8 regval;
if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); return -EINVAL;
}
switch (mode) { case REGULATOR_MODE_NORMAL:
regval = info->update_val_hp; break; case REGULATOR_MODE_IDLE:
regval = info->update_val_lp; break;
default: return -EINVAL;
}
/* If regulator is enabled and info->cfg->hwreq is set, the regulator must be on in high power, so we don't need to write the register with the same value.
*/ if (ab8500_ext_regulator_is_enabled(rdev) &&
!(info->cfg && info->cfg->hwreq)) {
ret = abx500_mask_and_set_register_interruptible(info->dev,
info->update_bank, info->update_reg,
info->update_mask, regval); if (ret < 0) {
dev_err(rdev_get_dev(rdev), "Could not set regulator mode.\n"); return ret;
}
if (info == NULL) {
dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); return -EINVAL;
}
if (info->update_val == info->update_val_hp)
ret = REGULATOR_MODE_NORMAL; elseif (info->update_val == info->update_val_lp)
ret = REGULATOR_MODE_IDLE; else
ret = -EINVAL;
return ret;
}
staticint ab8500_ext_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV, unsigned *selector)
{ struct regulation_constraints *regu_constraints = rdev->constraints;
if (!regu_constraints) {
dev_err(rdev_get_dev(rdev), "No regulator constraints\n"); return -EINVAL;
}
if (regu_constraints->min_uV == min_uV &&
regu_constraints->max_uV == max_uV) return 0;
dev_err(rdev_get_dev(rdev), "Requested min %duV max %duV != constrained min %duV max %duV\n",
min_uV, max_uV,
regu_constraints->min_uV, regu_constraints->max_uV);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.