|
@@ -89,6 +89,12 @@ static int __acquire_regulator(struct msm_vidc_core *core,
|
|
|
{
|
|
|
int rc = 0;
|
|
|
|
|
|
+ rc = call_res_op(core, reset_control_acquire, core, "video_xo_reset");
|
|
|
+ if (rc) {
|
|
|
+ d_vpr_e("%s: failed to acquire video_xo_reset control\n", __func__);
|
|
|
+ goto fail_assert_xo_reset;
|
|
|
+ }
|
|
|
+
|
|
|
if (rinfo->hw_power_collapse) {
|
|
|
if (!rinfo->regulator) {
|
|
|
d_vpr_e("%s: invalid regulator\n", __func__);
|
|
@@ -133,6 +139,10 @@ static int __acquire_regulator(struct msm_vidc_core *core,
|
|
|
}
|
|
|
|
|
|
exit:
|
|
|
+ rc = call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+ if (rc)
|
|
|
+ d_vpr_e("%s: failed to release video_xo_reset reset\n", __func__);
|
|
|
+fail_assert_xo_reset:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
@@ -141,10 +151,16 @@ static int __hand_off_regulator(struct msm_vidc_core *core,
|
|
|
{
|
|
|
int rc = 0;
|
|
|
|
|
|
+ rc = call_res_op(core, reset_control_acquire, core, "video_xo_reset");
|
|
|
+ if (rc) {
|
|
|
+ d_vpr_e("%s: failed to acquire video_xo_reset control\n", __func__);
|
|
|
+ goto fail_assert_xo_reset;
|
|
|
+ }
|
|
|
+
|
|
|
if (rinfo->hw_power_collapse) {
|
|
|
if (!rinfo->regulator) {
|
|
|
d_vpr_e("%s: invalid regulator\n", __func__);
|
|
|
- return -EINVAL;
|
|
|
+ goto exit;
|
|
|
}
|
|
|
|
|
|
rc = regulator_set_mode(rinfo->regulator,
|
|
@@ -152,7 +168,7 @@ static int __hand_off_regulator(struct msm_vidc_core *core,
|
|
|
if (rc) {
|
|
|
d_vpr_e("Failed to hand off regulator control: %s\n",
|
|
|
rinfo->name);
|
|
|
- return rc;
|
|
|
+ goto exit;
|
|
|
} else {
|
|
|
/* set handoff done in core sub_state */
|
|
|
msm_vidc_change_core_sub_state(core,
|
|
@@ -168,6 +184,11 @@ static int __hand_off_regulator(struct msm_vidc_core *core,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+exit:
|
|
|
+ rc = call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+ if (rc)
|
|
|
+ d_vpr_e("%s: failed to release video_xo_reset reset\n", __func__);
|
|
|
+fail_assert_xo_reset:
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
@@ -188,18 +209,30 @@ static int __enable_regulator(struct msm_vidc_core *core, const char *reg_name)
|
|
|
continue;
|
|
|
found = true;
|
|
|
|
|
|
+ rc = call_res_op(core, reset_control_acquire, core, "video_xo_reset");
|
|
|
+ if (rc) {
|
|
|
+ d_vpr_e("%s: failed to acquire video_xo_reset control\n", __func__);
|
|
|
+ goto fail_assert_xo_reset;
|
|
|
+ }
|
|
|
+
|
|
|
rc = regulator_enable(rinfo->regulator);
|
|
|
if (rc) {
|
|
|
d_vpr_e("%s: failed to enable %s, rc = %d\n",
|
|
|
__func__, rinfo->name, rc);
|
|
|
- return rc;
|
|
|
+ goto fail_regulator_enable;
|
|
|
}
|
|
|
if (!regulator_is_enabled(rinfo->regulator)) {
|
|
|
d_vpr_e("%s: regulator %s not enabled\n",
|
|
|
__func__, rinfo->name);
|
|
|
regulator_disable(rinfo->regulator);
|
|
|
- return -EINVAL;
|
|
|
+ rc = -EINVAL;
|
|
|
+ goto fail_regulator_enable;
|
|
|
}
|
|
|
+
|
|
|
+ rc = call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+ if (rc)
|
|
|
+ d_vpr_e("%s: failed to release video_xo_reset reset\n", __func__);
|
|
|
+
|
|
|
d_vpr_h("%s: enabled regulator %s\n", __func__, rinfo->name);
|
|
|
break;
|
|
|
}
|
|
@@ -209,6 +242,11 @@ static int __enable_regulator(struct msm_vidc_core *core, const char *reg_name)
|
|
|
}
|
|
|
|
|
|
return rc;
|
|
|
+
|
|
|
+fail_regulator_enable:
|
|
|
+ call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+fail_assert_xo_reset:
|
|
|
+ return rc;
|
|
|
}
|
|
|
|
|
|
static int __disable_regulator(struct msm_vidc_core *core, const char *reg_name)
|
|
@@ -239,12 +277,23 @@ static int __disable_regulator(struct msm_vidc_core *core, const char *reg_name)
|
|
|
/* reset handoff done from core sub_state */
|
|
|
msm_vidc_change_core_sub_state(core, CORE_SUBSTATE_GDSC_HANDOFF, 0, __func__);
|
|
|
|
|
|
+ rc = call_res_op(core, reset_control_acquire, core, "video_xo_reset");
|
|
|
+ if (rc) {
|
|
|
+ d_vpr_e("%s: failed to acquire video_xo_reset control\n", __func__);
|
|
|
+ goto fail_assert_xo_reset;
|
|
|
+ }
|
|
|
+
|
|
|
rc = regulator_disable(rinfo->regulator);
|
|
|
if (rc) {
|
|
|
d_vpr_e("%s: failed to disable %s, rc = %d\n",
|
|
|
__func__, rinfo->name, rc);
|
|
|
- return rc;
|
|
|
+ goto fail_regulator_disable;
|
|
|
}
|
|
|
+
|
|
|
+ rc = call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+ if (rc)
|
|
|
+ d_vpr_e("%s: failed to release video_xo_reset reset\n", __func__);
|
|
|
+
|
|
|
d_vpr_h("%s: disabled regulator %s\n", __func__, rinfo->name);
|
|
|
break;
|
|
|
}
|
|
@@ -254,6 +303,11 @@ static int __disable_regulator(struct msm_vidc_core *core, const char *reg_name)
|
|
|
}
|
|
|
|
|
|
return rc;
|
|
|
+
|
|
|
+fail_regulator_disable:
|
|
|
+ call_res_op(core, reset_control_release, core, "video_xo_reset");
|
|
|
+fail_assert_xo_reset:
|
|
|
+ return rc;
|
|
|
}
|
|
|
|
|
|
static int __hand_off_regulators(struct msm_vidc_core *core)
|