video: driver: add core sub_state support
Introduce core->sub_state similar to inst->sub_state. [1] pm_suspended - moved to this substate in case of PM suspend [2] handoff - moved to this state after successful handoff_regulator call. [3] fw_power_control - moved to this state in case of IFPC. [4] power_enable - will track core power_on/power_off status. [5] page_fault - used to rate_limit fault logs. [6] cpu_wd - indicates hw fired wd interrupt. [7] video_unresponsive - moved to this state if sync cmd fails. Change-Id: Iceb65cf404fd93aff7846860b0276307e4eab570 Signed-off-by: Govindaraj Rajagopal <quic_grajagop@quicinc.com>
This commit is contained in:
@@ -252,7 +252,7 @@ static int __power_off_iris2_hardware(struct msm_vidc_core *core)
|
||||
int rc = 0, i;
|
||||
u32 value = 0;
|
||||
|
||||
if (core->hw_power_control) {
|
||||
if (is_core_sub_state(core, CORE_SUBSTATE_FW_PWR_CTRL)) {
|
||||
d_vpr_h("%s: hardware power control enabled\n", __func__);
|
||||
goto disable_power;
|
||||
}
|
||||
@@ -417,7 +417,7 @@ static int __power_off_iris2(struct msm_vidc_core *core)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!core->power_enabled)
|
||||
if (!is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
|
||||
return 0;
|
||||
|
||||
/**
|
||||
@@ -442,7 +442,7 @@ static int __power_off_iris2(struct msm_vidc_core *core)
|
||||
disable_irq_nosync(core->resource->irq);
|
||||
core->intr_status = 0;
|
||||
|
||||
core->power_enabled = false;
|
||||
msm_vidc_change_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE, 0, __func__);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -504,9 +504,15 @@ static int __power_on_iris2(struct msm_vidc_core *core)
|
||||
u32 freq = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (core->power_enabled)
|
||||
if (is_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE))
|
||||
return 0;
|
||||
|
||||
if (!core_in_valid_state(core)) {
|
||||
d_vpr_e("%s: invalid core state %s\n",
|
||||
__func__, core_state_name(core->state));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Vote for all hardware resources */
|
||||
rc = call_res_op(core, set_bw, core, INT_MAX, INT_MAX);
|
||||
if (rc) {
|
||||
@@ -526,7 +532,9 @@ static int __power_on_iris2(struct msm_vidc_core *core)
|
||||
goto fail_power_on_hardware;
|
||||
}
|
||||
/* video controller and hardware powered on successfully */
|
||||
core->power_enabled = true;
|
||||
rc = msm_vidc_change_core_sub_state(core, 0, CORE_SUBSTATE_POWER_ENABLE, __func__);
|
||||
if (rc)
|
||||
goto fail_power_on_substate;
|
||||
|
||||
freq_tbl = core->resource->freq_set.freq_tbl;
|
||||
freq = core->power.clk_freq ? core->power.clk_freq :
|
||||
@@ -552,12 +560,14 @@ static int __power_on_iris2(struct msm_vidc_core *core)
|
||||
|
||||
return rc;
|
||||
|
||||
fail_power_on_substate:
|
||||
__power_off_iris2_hardware(core);
|
||||
fail_power_on_hardware:
|
||||
__power_off_iris2_controller(core);
|
||||
fail_power_on_controller:
|
||||
call_res_op(core, set_bw, core, 0, 0);
|
||||
fail_vote_buses:
|
||||
core->power_enabled = false;
|
||||
msm_vidc_change_core_sub_state(core, CORE_SUBSTATE_POWER_ENABLE, 0, __func__);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user