Lines Matching refs:voltdm

13 static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt)
15 struct omap_vp_instance *vp = voltdm->vp;
19 vsel = voltdm->pmic->uv_to_vsel(volt);
21 vpconfig = voltdm->read(vp->vpconfig);
26 voltdm->write(vpconfig, vp->vpconfig);
29 voltdm->write((vpconfig | vp->common->vpconfig_initvdd),
33 voltdm->write(vpconfig, vp->vpconfig);
39 void __init omap_vp_init(struct voltagedomain *voltdm)
41 struct omap_vp_instance *vp = voltdm->vp;
45 if (!voltdm->pmic || !voltdm->pmic->uv_to_vsel) {
46 pr_err("%s: No PMIC info for vdd_%s\n", __func__, voltdm->name);
50 if (!voltdm->read || !voltdm->write) {
52 __func__, voltdm->name);
59 sys_clk_rate = voltdm->sys_clk.rate / 1000;
61 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
62 vddmin = max(voltdm->vp_param->vddmin, voltdm->pmic->vddmin);
63 vddmax = min(voltdm->vp_param->vddmax, voltdm->pmic->vddmax);
64 vddmin = voltdm->pmic->uv_to_vsel(vddmin);
65 vddmax = voltdm->pmic->uv_to_vsel(vddmax);
67 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate,
68 1000 * voltdm->pmic->slew_rate);
69 vstepmin = voltdm->pmic->vp_vstepmin;
70 vstepmax = voltdm->pmic->vp_vstepmax;
76 val = (voltdm->pmic->vp_erroroffset <<
77 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
79 voltdm->write(val, vp->vpconfig);
84 voltdm->write(val, vp->vstepmin);
89 voltdm->write(val, vp->vstepmax);
95 voltdm->write(val, vp->vlimitto);
98 int omap_vp_update_errorgain(struct voltagedomain *voltdm,
103 if (!voltdm->vp)
107 volt_data = omap_voltage_get_voltdata(voltdm, target_volt);
112 voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask,
114 __ffs(voltdm->vp->common->vpconfig_errorgain_mask),
115 voltdm->vp->vpconfig);
121 int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
124 struct omap_vp_instance *vp = voltdm->vp;
129 ret = omap_vc_pre_scale(voltdm, target_volt, &target_vsel, &current_vsel);
145 __func__, voltdm->name);
149 vpconfig = _vp_set_init_voltage(voltdm, target_volt);
152 voltdm->write(vpconfig | vp->common->vpconfig_forceupdate,
153 voltdm->vp->vpconfig);
164 __func__, voltdm->name);
166 omap_vc_post_scale(voltdm, target_volt, target_vsel, current_vsel);
182 __func__, voltdm->name);
185 voltdm->write(vpconfig, vp->vpconfig);
192 * @voltdm: pointer to the VDD whose VP is to be enabled.
197 void omap_vp_enable(struct voltagedomain *voltdm)
202 if (!voltdm || IS_ERR(voltdm)) {
207 vp = voltdm->vp;
208 if (!voltdm->read || !voltdm->write) {
210 __func__, voltdm->name);
218 volt = voltdm_get_voltage(voltdm);
221 __func__, voltdm->name);
225 vpconfig = _vp_set_init_voltage(voltdm, volt);
229 voltdm->write(vpconfig, vp->vpconfig);
236 * @voltdm: pointer to the VDD whose VP is to be disabled.
241 void omap_vp_disable(struct voltagedomain *voltdm)
247 if (!voltdm || IS_ERR(voltdm)) {
252 vp = voltdm->vp;
253 if (!voltdm->read || !voltdm->write) {
255 __func__, voltdm->name);
262 __func__, voltdm->name);
267 vpconfig = voltdm->read(vp->vpconfig);
269 voltdm->write(vpconfig, vp->vpconfig);
274 omap_test_timeout((voltdm->read(vp->vstatus)),
278 pr_warn("%s: vdd_%s idle timedout\n", __func__, voltdm->name);