/* * VP_CONFIG: error gain is not set here, it will be updated * on each scale, based on OPP.
*/
val = (voltdm->pmic->vp_erroroffset <<
__ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
vp->common->vpconfig_timeouten;
voltdm->write(val, vp->vpconfig);
int omap_vp_update_errorgain(struct voltagedomain *voltdm, unsignedlong target_volt)
{ struct omap_volt_data *volt_data;
if (!voltdm->vp) return -EINVAL;
/* Get volt_data corresponding to target_volt */
volt_data = omap_voltage_get_voltdata(voltdm, target_volt); if (IS_ERR(volt_data)) return -EINVAL;
/* Setting vp errorgain based on the voltage */
voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
volt_data->vp_errgain <<
__ffs(voltdm->vp->common->vpconfig_errorgain_mask),
voltdm->vp->vpconfig);
return 0;
}
/* VP force update method of voltage scaling */ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, unsignedlong target_volt)
{ struct omap_vp_instance *vp = voltdm->vp;
u32 vpconfig;
u8 target_vsel, current_vsel; int ret, timeout = 0;
ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, ¤t_vsel); if (ret) return ret;
/* * Clear all pending TransactionDone interrupt/status. Typical latency * is <3us
*/ while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vp->common->ops->clear_txdone(vp->id); if (!vp->common->ops->check_txdone(vp->id)) break;
udelay(1);
} if (timeout >= VP_TRANXDONE_TIMEOUT) {
pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted\n",
__func__, voltdm->name); return -ETIMEDOUT;
}
/* Force update of voltage */
voltdm->write(vpconfig | vp->common->vpconfig_forceupdate,
voltdm->vp->vpconfig);
/* * Wait for TransactionDone. Typical latency is <200us. * Depends on SMPSWAITTIMEMIN/MAX and voltage change
*/
timeout = 0;
omap_test_timeout(vp->common->ops->check_txdone(vp->id),
VP_TRANXDONE_TIMEOUT, timeout); if (timeout >= VP_TRANXDONE_TIMEOUT)
pr_err("%s: vdd_%s TRANXDONE timeout exceeded. TRANXDONE never got set after the voltage update\n",
__func__, voltdm->name);
/* * Disable TransactionDone interrupt , clear all status, clear * control registers
*/
timeout = 0; while (timeout++ < VP_TRANXDONE_TIMEOUT) {
vp->common->ops->clear_txdone(vp->id); if (!vp->common->ops->check_txdone(vp->id)) break;
udelay(1);
}
if (timeout >= VP_TRANXDONE_TIMEOUT)
pr_warn("%s: vdd_%s TRANXDONE timeout exceeded while trying to clear the TRANXDONE status\n",
__func__, voltdm->name);
/* Clear force bit */
voltdm->write(vpconfig, vp->vpconfig);
return 0;
}
/** * omap_vp_enable() - API to enable a particular VP * @voltdm: pointer to the VDD whose VP is to be enabled. * * This API enables a particular voltage processor. Needed by the smartreflex * class drivers.
*/ void omap_vp_enable(struct voltagedomain *voltdm)
{ struct omap_vp_instance *vp;
u32 vpconfig, volt;
if (!voltdm || IS_ERR(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__); return;
}
vp = voltdm->vp; if (!voltdm->read || !voltdm->write) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name); return;
}
/* If VP is already enabled, do nothing. Return */ if (vp->enabled) return;
volt = voltdm_get_voltage(voltdm); if (!volt) {
pr_warn("%s: unable to find current voltage for %s\n",
__func__, voltdm->name); return;
}
/** * omap_vp_disable() - API to disable a particular VP * @voltdm: pointer to the VDD whose VP is to be disabled. * * This API disables a particular voltage processor. Needed by the smartreflex * class drivers.
*/ void omap_vp_disable(struct voltagedomain *voltdm)
{ struct omap_vp_instance *vp;
u32 vpconfig; int timeout;
if (!voltdm || IS_ERR(voltdm)) {
pr_warn("%s: VDD specified does not exist!\n", __func__); return;
}
vp = voltdm->vp; if (!voltdm->read || !voltdm->write) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n",
__func__, voltdm->name); return;
}
/* If VP is already disabled, do nothing. Return */ if (!vp->enabled) {
pr_warn("%s: Trying to disable VP for vdd_%s when it is already disabled\n",
__func__, voltdm->name); return;
}
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.