diff --git a/driver/vidc/inc/msm_vidc_driver.h b/driver/vidc/inc/msm_vidc_driver.h index 931a2bcc2f..9458225c8b 100644 --- a/driver/vidc/inc/msm_vidc_driver.h +++ b/driver/vidc/inc/msm_vidc_driver.h @@ -499,7 +499,7 @@ bool msm_vidc_allow_streamon(struct msm_vidc_inst *inst, u32 type); enum msm_vidc_allow msm_vidc_allow_input_psc(struct msm_vidc_inst *inst); bool msm_vidc_allow_drain_last_flag(struct msm_vidc_inst *inst); bool msm_vidc_allow_psc_last_flag(struct msm_vidc_inst *inst); -bool msm_vidc_allow_pm_suspend(struct msm_vidc_core *core); +enum msm_vidc_allow msm_vidc_allow_pm_suspend(struct msm_vidc_core *core); int msm_vidc_state_change_streamon(struct msm_vidc_inst *inst, u32 type); int msm_vidc_state_change_streamoff(struct msm_vidc_inst *inst, u32 type); int msm_vidc_state_change_input_psc(struct msm_vidc_inst *inst); diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index 73e461436a..a2745b1fb8 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -1285,27 +1285,27 @@ bool msm_vidc_allow_psc_last_flag(struct msm_vidc_inst *inst) return false; } -bool msm_vidc_allow_pm_suspend(struct msm_vidc_core *core) +enum msm_vidc_allow msm_vidc_allow_pm_suspend(struct msm_vidc_core *core) { if (!core) { d_vpr_e("%s: invalid param\n", __func__); - return false; + return MSM_VIDC_DISALLOW; } /* core must be in valid state to do pm_suspend */ if (!core_in_valid_state(core)) { d_vpr_e("%s: invalid core state %s\n", __func__, core_state_name(core->state)); - return false; + return MSM_VIDC_DISALLOW; } /* check if power is enabled */ if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE)) { d_vpr_e("%s: Power already disabled\n", __func__); - return false; + return MSM_VIDC_IGNORE; } - return true; + return MSM_VIDC_ALLOW; } bool is_hevc_10bit_decode_session(struct msm_vidc_inst *inst) diff --git a/driver/vidc/src/msm_vidc_probe.c b/driver/vidc/src/msm_vidc_probe.c index bd8d863dfd..92cb939175 100644 --- a/driver/vidc/src/msm_vidc_probe.c +++ b/driver/vidc/src/msm_vidc_probe.c @@ -863,7 +863,7 @@ static int msm_vidc_pm_suspend(struct device *dev) { int rc = 0; struct msm_vidc_core *core; - bool allow = false; + enum msm_vidc_allow allow = MSM_VIDC_DISALLOW; /* * Bail out if @@ -882,8 +882,14 @@ static int msm_vidc_pm_suspend(struct device *dev) core_lock(core, __func__); allow = msm_vidc_allow_pm_suspend(core); - if (!allow) { - d_vpr_e("%s: pm suspend not allowed\n", __func__); + + if (allow == MSM_VIDC_IGNORE) { + d_vpr_h("%s: pm already suspended\n", __func__); + msm_vidc_change_core_sub_state(core, 0, CORE_SUBSTATE_PM_SUSPEND, __func__); + rc = 0; + goto unlock; + } else if (allow != MSM_VIDC_ALLOW) { + d_vpr_h("%s: pm suspend not allowed\n", __func__); rc = 0; goto unlock; }